From 0f9190d25ec6b08d60a8fb6aad33813f87afa2d0 Mon Sep 17 00:00:00 2001 From: "rniwa@webkit.org" Date: Tue, 5 Nov 2013 04:05:50 +0000 Subject: [PATCH] JSON generation on new flakiness dashboard is still too slow https://bugs.webkit.org/show_bug.cgi?id=123776 Reviewed by Mark Rowe. * init-database.sql: Added a constraint that result is unique for each (build, test) pair. * public/include/test-results.php: (ResultsJSONGenerator::generate): Don't sort results by latest_revision_time since that's done in the client side anyway. (update_flakiness_for_build): Don't update is_flaky flag if it's already set to the right value. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@158637 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Websites/test-results/ChangeLog | 15 +++++++++++++++ Websites/test-results/init-database.sql | 3 ++- .../test-results/public/include/test-results.php | 8 ++++---- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/Websites/test-results/ChangeLog b/Websites/test-results/ChangeLog index 7d018ee97051..c39430133bdd 100644 --- a/Websites/test-results/ChangeLog +++ b/Websites/test-results/ChangeLog @@ -1,3 +1,18 @@ +2013-11-04 Ryosuke Niwa + + JSON generation on new flakiness dashboard is still too slow + https://bugs.webkit.org/show_bug.cgi?id=123776 + + Reviewed by Mark Rowe. + + * init-database.sql: Added a constraint that result is unique for each (build, test) pair. + + * public/include/test-results.php: + (ResultsJSONGenerator::generate): Don't sort results by latest_revision_time since that's done + in the client side anyway. + (update_flakiness_for_build): Don't update is_flaky flag if it's already set to the right value. + + 2013-11-04 Ryosuke Niwa Build fixes. In particular, we were missing the code to generate JSONs in report.php :( diff --git a/Websites/test-results/init-database.sql b/Websites/test-results/init-database.sql index 57ccd44bc60c..2c2e12307dfc 100644 --- a/Websites/test-results/init-database.sql +++ b/Websites/test-results/init-database.sql @@ -57,7 +57,8 @@ CREATE TABLE results ( actual varchar(64) NOT NULL, modifiers varchar(64) NOT NULL, time integer, - is_flaky boolean); + is_flaky boolean, + CONSTRAINT results_test_build_must_be_unique UNIQUE(test, build)); CREATE INDEX results_test ON results(test); CREATE INDEX results_build ON results(build); CREATE INDEX results_is_flaky ON results(is_flaky); diff --git a/Websites/test-results/public/include/test-results.php b/Websites/test-results/public/include/test-results.php index a718c713d2cf..2dd4a02b1c3d 100644 --- a/Websites/test-results/public/include/test-results.php +++ b/Websites/test-results/public/include/test-results.php @@ -182,13 +182,12 @@ class ResultsJSONGenerator { $all_results = $this->db->query( "SELECT results.*, builds.* FROM results - JOIN (SELECT builds.*, array_agg((build_revisions.repository, build_revisions.value, build_revisions.time)) AS revisions, - max(build_revisions.time) AS latest_revision_time + JOIN (SELECT builds.*, array_agg((build_revisions.repository, build_revisions.value, build_revisions.time)) AS revisions FROM builds, build_revisions WHERE build_revisions.build = builds.id AND builds.builder = $1 GROUP BY builds.id LIMIT 500) as builds ON results.build = builds.id WHERE results.test in ($comma_separated_test_ids) - ORDER BY results.test, latest_revision_time DESC", array($this->builder_id)); + ORDER BY results.test DESC", array($this->builder_id)); if (!$all_results) return FALSE; @@ -246,7 +245,8 @@ function update_flakiness_for_build($db, $preceeding_build, $current_build, $suc SET is_flaky = preceeding_results.actual = succeeding_results.actual AND preceeding_results.actual != results.actual FROM results preceeding_results, results succeeding_results WHERE preceeding_results.build = $1 AND results.build = $2 AND succeeding_results.build = $3 - AND preceeding_results.test = results.test AND succeeding_results.test = results.test", + AND preceeding_results.test = results.test AND succeeding_results.test = results.test + AND results.is_flaky != (preceeding_results.actual = succeeding_results.actual AND preceeding_results.actual != results.actual)", array($preceeding_build['id'], $current_build['id'], $succeeding_build['id'])); } -- 2.36.0