From f0424a2bc67090aa6ede8d342ce9642c664a2125 Mon Sep 17 00:00:00 2001 From: Stefan Kaufmann Date: Mon, 11 Nov 2024 14:05:30 +0100 Subject: [PATCH 1/3] Speed up long-running migrations (#2552) Boost performance for migrations scripts --------- Co-authored-by: William Allen <16820599+williamjallen@users.noreply.github.com> --- database/migrations/2024_04_17_183212_remove_test_table.php | 5 +++-- .../2024_07_09_025240_find_test_measurements_by_testid.php | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/database/migrations/2024_04_17_183212_remove_test_table.php b/database/migrations/2024_04_17_183212_remove_test_table.php index d473ef09e..1161f19c6 100644 --- a/database/migrations/2024_04_17_183212_remove_test_table.php +++ b/database/migrations/2024_04_17_183212_remove_test_table.php @@ -81,9 +81,10 @@ public function up(): void // Take care of any invalid rows which do not have an output ID before we add a foreign key $num_b2t_rows_deleted = DB::delete(' DELETE FROM build2test - WHERE outputid NOT IN ( - SELECT id + WHERE NOT EXISTS ( + SELECT 1 FROM testoutput + WHERE testoutput.id = build2test.outputid ) '); if ($num_b2t_rows_deleted > 0) { diff --git a/database/migrations/2024_07_09_025240_find_test_measurements_by_testid.php b/database/migrations/2024_07_09_025240_find_test_measurements_by_testid.php index 0d24bf246..2cc6465ba 100644 --- a/database/migrations/2024_07_09_025240_find_test_measurements_by_testid.php +++ b/database/migrations/2024_07_09_025240_find_test_measurements_by_testid.php @@ -39,8 +39,10 @@ public function up(): void DELETE FROM testmeasurement WHERE testid IS NULL OR - testid NOT IN ( - SELECT id from build2test + NOT EXISTS ( + SELECT 1 + FROM build2test + WHERE build2test.id = testmeasurement.testid ) '); From 7d23f0e07f808816fab07203ab896d5649d1e000 Mon Sep 17 00:00:00 2001 From: William Allen <16820599+williamjallen@users.noreply.github.com> Date: Mon, 11 Nov 2024 08:06:14 -0500 Subject: [PATCH 2/3] Fix divide-by-zero error in label2test migration (#2555) As reported in https://github.com/Kitware/CDash/pull/2552#issuecomment-2461877218, #2496 introduced a divide-by-zero error in the migration `2024_08_24_160326_label2test_relationship_refactor`. This PR fixes the issue. --- .../2024_08_24_160326_label2test_relationship_refactor.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/database/migrations/2024_08_24_160326_label2test_relationship_refactor.php b/database/migrations/2024_08_24_160326_label2test_relationship_refactor.php index 67994ad43..c3aec9a59 100644 --- a/database/migrations/2024_08_24_160326_label2test_relationship_refactor.php +++ b/database/migrations/2024_08_24_160326_label2test_relationship_refactor.php @@ -22,7 +22,7 @@ public function up(): void // Execute at most 10k batches of buildwise updates if (config('database.default') === 'pgsql') { - for ($i = 0; $i < ceil($count / 10000); $i++) { + for ($i = 1; $i <= ceil($count / 10000); $i++) { DB::update(' UPDATE label2test SET testid = build2test.id @@ -35,7 +35,7 @@ public function up(): void ', [$i]); } } else { - for ($i = 0; $i < ceil($count / 10000); $i++) { + for ($i = 1; $i <= ceil($count / 10000); $i++) { DB::update(' UPDATE label2test, build2test SET label2test.testid = build2test.id From 4c66d891df3ab08340f2779bd92d28eabe517b2d Mon Sep 17 00:00:00 2001 From: William Allen <16820599+williamjallen@users.noreply.github.com> Date: Tue, 12 Nov 2024 09:51:58 -0500 Subject: [PATCH 3/3] Bump version to 3.6.1 (#2556) --- config/cdash.php | 2 +- package-lock.json | 6 +++--- package.json | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/config/cdash.php b/config/cdash.php index b5b8b76fc..3866a3c4a 100755 --- a/config/cdash.php +++ b/config/cdash.php @@ -22,7 +22,7 @@ 'expires' => env('PASSWORD_EXPIRATION', 0), 'unique' => env('UNIQUE_PASSWORD_COUNT', 0), ], - 'version' => '3.6.0', + 'version' => '3.6.1', 'registration' => [ 'email' => [ 'verify' => env('REGISTRATION_EMAIL_VERIFY', true), diff --git a/package-lock.json b/package-lock.json index d8b51c5df..ae7bbd1e5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "cdash", - "version": "3.6.0", + "version": "3.6.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "cdash", - "version": "3.6.0", + "version": "3.6.1", "license": "BSD-3-Clause", "dependencies": { "@apollo/client": "^3.11.8", @@ -13434,7 +13434,7 @@ } }, "node_modules/readdirp": { - "version": "3.6.0", + "version": "3.6.1", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", "dependencies": { diff --git a/package.json b/package.json index a85cab993..9ef242fa4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cdash", - "version": "3.6.0", + "version": "3.6.1", "description": "Continuous integration dashboard.", "repository": "https://github.com/Kitware/CDash", "license": "BSD-3-Clause",