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

[Xen-devel] [OSSTEST PATCH 3/4] host allocation: Dedupe "other hosts" flights in duration estimation



The old query would return one row for each step in each relevant
flight.  But we are really only interested in the flight.

Group by the flight and sort on max(finished).

Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 Osstest/Executive.pm |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/Osstest/Executive.pm b/Osstest/Executive.pm
index 69f0319..c82a9c7 100644
--- a/Osstest/Executive.pm
+++ b/Osstest/Executive.pm
@@ -1051,14 +1051,16 @@ sub duration_estimator ($$;$$) {
 END
 
     my $duration_anyref_q= $dbh_tests->prepare(<<END);
-            SELECT f.flight AS flight
+            SELECT f.flight AS flight,
+                   max(s.finished) AS max_finished
                      FROM steps s JOIN flights f
                        ON s.flight=f.flight
                     WHERE s.job=? AND f.blessing=? AND f.branch=?
                        AND s.finished IS NOT NULL
                        AND f.started IS NOT NULL
                        AND f.started >= ?
-                     ORDER BY s.finished DESC
+                     GROUP BY f.flight
+                     ORDER BY max_finished DESC
 END
     # s J J J # fix perl-mode
 
-- 
1.7.10.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

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