]> xenbits.xensource.com Git - osstest.git/commitdiff
sg-report-job-history (nfc): Drop $hostsq query
authorIan Jackson <ian.jackson@eu.citrix.com>
Wed, 12 Aug 2020 12:51:32 +0000 (13:51 +0100)
committerIan Jackson <ian.jackson@eu.citrix.com>
Wed, 19 Aug 2020 10:41:18 +0000 (11:41 +0100)
We have eliminated all the users of @hostvarcols before @hostvarcols2
is calculated from the row data.

The query which produces this is very slow and can't be cached.  We
can abolish it now and just use the @hostvarcols2 calculation.

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

index 5d913b96e12c2cff6e546bc7aa022cad88664294..5684ac02fd5db7e67c92f53b220009a8eb6b860c 100755 (executable)
@@ -147,25 +147,6 @@ END
 END
     $flightsq->execute(@params);
 
-    my $hostsq= db_prepare(<<END);
-        SELECT DISTINCT name
-        FROM runvars
-        JOIN flights USING (flight)
-       WHERE ($cond)
-         AND flight >= COALESCE(
-             (
-             SELECT flight $fromstuff
-             LIMIT 1 OFFSET $offset
-            ), 0)
-     ORDER BY name;
-END
-    $hostsq->execute(@params, @params); # sql text contains $cond twice
-    my @hostvarcols;
-    while (my ($hostvar) = $hostsq->fetchrow_array()) {
-       next unless $hostvar =~ m/(^|_)host$/;
-       push @hostvarcols, $hostvar;
-    }
-
     my $hostq= db_prepare(<<END);
         SELECT name, val
           FROM runvars
@@ -213,8 +194,7 @@ END
     foreach my $ri (@test_rows) {
        $hostvarnames{$_}=1 foreach keys %{ $ri->{Hosts} }
     }
-    my @hostvarcols2 = sort keys %hostvarnames;
-    die unless "@hostvarcols" eq "@hostvarcols2";
+    my @hostvarcols = sort keys %hostvarnames;
 
     my $osstestverq= db_prepare(<<END);
         SELECT DISTINCT harness