[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[OSSTEST PATCH 43/60] sg-report-job-history (nfc): Query hosts runvars in one go


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
  • Date: Fri, 14 Aug 2020 18:21:48 +0100
  • Authentication-results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
  • Delivery-date: Fri, 14 Aug 2020 17:26:49 +0000
  • Ironport-sdr: c+HtNVfBRqiEuS7oPCcV+A5GgAx4Melnt4EpEKEP6BqPLAPx09xcs3kNdbSCGHAVPVf+IdX4UO fgVU/EUhnHq7HDQCkrp8i6GcLPdbTYj+GS9G9XC5CHVY9JW6Q/ljlbp0tOVnyu7bzED4ZoQ6t1 pEABwFd1hl0rpP4mQDtjLClo/XQXOhHOD62xVYTU+EAI47veStj2bf3VI6yp2c8fOtmt7fXvBL luJ/yRg+foH1J6njqR6f5tRnQXipxTFOT0uEMWl3LUKQumQDCYA/jKuawmDkcXvoz/NLoWqCMg BwQ=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Rather than doing one query for each entry in @hostvarcols, do one
query for all the relevant runvars.  This is quite a bit faster and
will enable us to use the cache.

This is correct because @hostvarcols was the union of all the host
runvars, so this produces the same answers as the individual queries.

Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 sg-report-job-history | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/sg-report-job-history b/sg-report-job-history
index fb2930a9..5d913b96 100755
--- a/sg-report-job-history
+++ b/sg-report-job-history
@@ -167,16 +167,19 @@ END
     }
 
     my $hostq= db_prepare(<<END);
-        SELECT val FROM runvars WHERE flight=? AND job=? AND name=?
+        SELECT name, val
+          FROM runvars
+         WHERE flight=?
+           AND job=?
+           AND (name = 'host' OR name LIKE '%\\_host')
 END
 
     while (my $f= $flightsq->fetchrow_hashref()) {
         my $ri= report_run_getinfo($f);
 
        $ri->{Hosts} = { };
-       foreach my $hostvar (@hostvarcols) {
-           $hostq->execute($f->{flight}, $f->{job}, $hostvar);
-           my ($host) = $hostq->fetchrow_array();
+       $hostq->execute($f->{flight}, $f->{job});
+       while (my ($hostvar,$host) = $hostq->fetchrow_array()) {
            $ri->{Hosts}{$hostvar} = $host;
        }
 
-- 
2.11.0




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.