forked from lix-project/hydra
hydra-build: Don't send a giant query to the database
We had Postgres barfing with this error: DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::Pg::st execute failed: ERROR: stack depth limit exceeded because the ‘drvpath => [ @dependentDrvs ]’ in failDependents can cause a query of unbounded size. (In this specific case there was a failure of Bison, which has > 10000 dependent derivations.) So now we just get all scheduled builds from the DB.
This commit is contained in:
parent
35aad40692
commit
3f68076577
|
@ -92,6 +92,7 @@ in rec {
|
||||||
PadWalker
|
PadWalker
|
||||||
CatalystDevel
|
CatalystDevel
|
||||||
Readonly
|
Readonly
|
||||||
|
SetScalar
|
||||||
SQLSplitStatement
|
SQLSplitStatement
|
||||||
Starman
|
Starman
|
||||||
SysHostnameLong
|
SysHostnameLong
|
||||||
|
|
|
@ -11,6 +11,7 @@ use Hydra::Helper::Nix;
|
||||||
use Hydra::Helper::PluginHooks;
|
use Hydra::Helper::PluginHooks;
|
||||||
use Hydra::Model::DB;
|
use Hydra::Model::DB;
|
||||||
use Hydra::Helper::AddBuilds;
|
use Hydra::Helper::AddBuilds;
|
||||||
|
use Set::Scalar;
|
||||||
|
|
||||||
STDOUT->autoflush();
|
STDOUT->autoflush();
|
||||||
|
|
||||||
|
@ -41,16 +42,18 @@ sub failDependents {
|
||||||
my ($drvPath, $status, $errorMsg, $dependents) = @_;
|
my ($drvPath, $status, $errorMsg, $dependents) = @_;
|
||||||
|
|
||||||
# Get the referrer closure of $drvPath.
|
# Get the referrer closure of $drvPath.
|
||||||
my @dependentDrvs = computeFSClosure(1, 0, $drvPath);
|
my $dependentDrvs = Set::Scalar->new(computeFSClosure(1, 0, $drvPath));
|
||||||
|
|
||||||
my $time = time();
|
my $time = time();
|
||||||
|
|
||||||
txn_do($db, sub {
|
txn_do($db, sub {
|
||||||
|
|
||||||
my @dependentBuilds = $db->resultset('Builds')->search(
|
my @dependentBuilds = $db->resultset('Builds')->search(
|
||||||
{ drvpath => [ @dependentDrvs ], finished => 0, busy => 0 });
|
{ finished => 0, busy => 0 },
|
||||||
|
{ columns => ["id", "project", "jobset", "job", "drvpath"] });
|
||||||
|
|
||||||
for my $d (@dependentBuilds) {
|
for my $d (@dependentBuilds) {
|
||||||
|
next unless $dependentDrvs->has($d->drvpath);
|
||||||
print STDERR "failing dependent build ", $d->id, " of ", $d->project->name, ":", $d->jobset->name, ":", $d->job->name, "\n";
|
print STDERR "failing dependent build ", $d->id, " of ", $d->project->name, ":", $d->jobset->name, ":", $d->job->name, "\n";
|
||||||
$d->update(
|
$d->update(
|
||||||
{ finished => 1
|
{ finished => 1
|
||||||
|
|
Loading…
Reference in a new issue