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.jack...@eu.citrix.com>
---
 sg-report-host-history | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/sg-report-host-history b/sg-report-host-history
index 871ad5fe..51814534 100755
--- a/sg-report-host-history
+++ b/sg-report-host-history
@@ -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
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to