]> xenbits.xensource.com Git - osstest.git/commitdiff
sg-report-host-history: Move SET LOCAL into transaction
authorIan Jackson <ian.jackson@eu.citrix.com>
Thu, 24 Jan 2019 17:01:50 +0000 (17:01 +0000)
committerIan Jackson <ian.jackson@eu.citrix.com>
Thu, 24 Jan 2019 18:40:21 +0000 (18:40 +0000)
Gets rid of this warning:
  WARNING:  SET LOCAL can only be used in transaction blocks

This suggests that this code was previously not effective...

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
sg-report-host-history

index 871ad5fe980d74b223669735a3cb22e7b306b9ca..51814534898733494a93f1766641456173100385 100755 (executable)
@@ -266,15 +266,16 @@ db_retry($dbh_tests, [], sub {
     computeflightsrange();
 });
 
-$dbh_tests->do("SET LOCAL enable_seqscan=false");
-# Otherwise the PostgreSQL query planner likes to do a complete scan
-# of the runvars table, rather than walking backwards through the
-# flights until it has what we've told it is enough.
-
 foreach my $host (@ARGV) {
     if ($host =~ m/^flight:/) {
        my $flight=$'; #';
        db_retry($dbh_tests, [], sub {
+            $dbh_tests->do("SET LOCAL enable_seqscan=false");
+            # Otherwise the PostgreSQL query planner likes to do a
+            # complete scan of the runvars table, rather than walking
+            # backwards through the flights until it has what we've
+            # told it is enough.
+
            our $hostsinflightq //= db_prepare(<<END);
                SELECT DISTINCT val
                  FROM runvars