forked from lix-project/hydra
Don't use a prepared statement for the active build steps query
Prepared statements are sometimes much slower than unprepared statements, because the planner doesn't have access to the query parameters. This is the case for the active build steps query (in /status), where a prepared statement is three orders of magnitude slower. So disable the use of prepared statements in this case. (Since the query parameters are constant here, it would be nicer if we could tell DBIx::Class to prepare a statement with those parameters fixed. But I don't know an easy way to do so.)
This commit is contained in:
parent
68a867da67
commit
8d65ab6158
|
@ -95,11 +95,15 @@ sub timeline :Local {
|
||||||
|
|
||||||
sub status :Local {
|
sub status :Local {
|
||||||
my ($self, $c) = @_;
|
my ($self, $c) = @_;
|
||||||
$c->stash->{steps} = [ $c->model('DB::BuildSteps')->search(
|
$c->model('DB')->storage->dbh_do(sub {
|
||||||
{ 'me.busy' => 1, 'build.busy' => 1 },
|
my (undef, $dbh) = @_;
|
||||||
{ join => [ 'build' ]
|
local $dbh->{pg_server_prepare} = 0;
|
||||||
, order_by => [ 'machine' ]
|
$c->stash->{steps} = [ $c->model('DB::BuildSteps')->search(
|
||||||
} ) ];
|
{ 'me.busy' => 1, 'build.finished' => 0, 'build.busy' => 1 },
|
||||||
|
{ join => [ 'build' ]
|
||||||
|
, order_by => [ 'machine' ]
|
||||||
|
} ) ];
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ sub getBuild {
|
||||||
return $build;
|
return $build;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
sub getPreviousBuild {
|
sub getPreviousBuild {
|
||||||
my ($c, $build) = @_;
|
my ($c, $build) = @_;
|
||||||
return undef if !defined $build;
|
return undef if !defined $build;
|
||||||
|
@ -38,6 +39,7 @@ sub getPreviousBuild {
|
||||||
return $prevBuild;
|
return $prevBuild;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
sub getNextBuild {
|
sub getNextBuild {
|
||||||
my ($c, $build) = @_;
|
my ($c, $build) = @_;
|
||||||
return undef if !defined $build;
|
return undef if !defined $build;
|
||||||
|
@ -54,6 +56,7 @@ sub getNextBuild {
|
||||||
return $nextBuild;
|
return $nextBuild;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
sub getPreviousSuccessfulBuild {
|
sub getPreviousSuccessfulBuild {
|
||||||
my ($c, $build) = @_;
|
my ($c, $build) = @_;
|
||||||
return undef if !defined $build;
|
return undef if !defined $build;
|
||||||
|
@ -71,6 +74,7 @@ sub getPreviousSuccessfulBuild {
|
||||||
return $prevBuild;
|
return $prevBuild;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
sub getBuildStats {
|
sub getBuildStats {
|
||||||
my ($c, $builds) = @_;
|
my ($c, $builds) = @_;
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,6 @@ sub sendEmailNotification {
|
||||||
, finished => 1
|
, finished => 1
|
||||||
, id => { '!=', $build->id }
|
, id => { '!=', $build->id }
|
||||||
}, { order_by => ["timestamp DESC"] }
|
}, { order_by => ["timestamp DESC"] }
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
# if there is a previous build with same buildstatus, do not send email
|
# if there is a previous build with same buildstatus, do not send email
|
||||||
|
@ -192,7 +191,6 @@ sub sendEmailNotification {
|
||||||
To => $to,
|
To => $to,
|
||||||
From => "Hydra Build Daemon <$sender>",
|
From => "Hydra Build Daemon <$sender>",
|
||||||
Subject => "Hydra job $jobName on " . $build->system . ", build " . $build->id . ": $status",
|
Subject => "Hydra job $jobName on " . $build->system . ", build " . $build->id . ": $status",
|
||||||
|
|
||||||
'X-Hydra-Instance' => $baseurl,
|
'X-Hydra-Instance' => $baseurl,
|
||||||
'X-Hydra-Project' => $build->project->name,
|
'X-Hydra-Project' => $build->project->name,
|
||||||
'X-Hydra-Jobset' => $build->jobset->name,
|
'X-Hydra-Jobset' => $build->jobset->name,
|
||||||
|
|
|
@ -498,10 +498,12 @@ create index IndexBuildInputsOnDependency on BuildInputs(dependency);
|
||||||
create index IndexBuildProducstOnBuildAndType on BuildProducts(build, type);
|
create index IndexBuildProducstOnBuildAndType on BuildProducts(build, type);
|
||||||
create index IndexBuildProductsOnBuild on BuildProducts(build);
|
create index IndexBuildProductsOnBuild on BuildProducts(build);
|
||||||
create index IndexBuildStepsOnBuild on BuildSteps(build);
|
create index IndexBuildStepsOnBuild on BuildSteps(build);
|
||||||
|
create index IndexBuildStepsOnBusy on BuildSteps(busy);
|
||||||
create index IndexBuildStepsOnDrvpathTypeBusyStatus on BuildSteps(drvpath, type, busy, status);
|
create index IndexBuildStepsOnDrvpathTypeBusyStatus on BuildSteps(drvpath, type, busy, status);
|
||||||
create index IndexBuildStepsOnOutpath on BuildSteps(outpath);
|
create index IndexBuildStepsOnOutpath on BuildSteps(outpath);
|
||||||
create index IndexBuildStepsOnOutpathBuild on BuildSteps (outpath, build);
|
create index IndexBuildStepsOnOutpathBuild on BuildSteps (outpath, build);
|
||||||
create index IndexBuildsOnFinished on Builds(finished);
|
create index IndexBuildsOnFinished on Builds(finished);
|
||||||
|
create index IndexBuildsOnFinishedBusy on Builds(finished, busy);
|
||||||
create index IndexBuildsOnIsCurrent on Builds(isCurrent);
|
create index IndexBuildsOnIsCurrent on Builds(isCurrent);
|
||||||
create index IndexBuildsOnJobsetIsCurrent on Builds(project, jobset, isCurrent);
|
create index IndexBuildsOnJobsetIsCurrent on Builds(project, jobset, isCurrent);
|
||||||
create index IndexBuildsOnJobIsCurrent on Builds(project, jobset, job, isCurrent);
|
create index IndexBuildsOnJobIsCurrent on Builds(project, jobset, job, isCurrent);
|
||||||
|
|
Loading…
Reference in a new issue