aboutsummaryrefslogtreecommitdiff
path: root/sqitch
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2020-02-08 11:16:08 +0000
committerChristopher Baines <mail@cbaines.net>2020-02-08 11:16:08 +0000
commitf1989e8758b89b2750f7a546871c0721ab9f9839 (patch)
treea762d9a8be4ba668d8f823f410134b43303eab3c /sqitch
parent77beb5949511db7fc5236567b8b1d25d98f82bbb (diff)
downloaddata-service-f1989e8758b89b2750f7a546871c0721ab9f9839.tar
data-service-f1989e8758b89b2750f7a546871c0721ab9f9839.tar.gz
Rework cross derivations support
Stop using the system values as targets, and remove package derivation entries where this is the case. Switch the non-cross derivation case to have a target of "", rather than matching the system, as this makes more sense, and is more consistent now that the target values no longer match the system values. Hardcode some more correct target values, and use these instead. Hopefully this can be better integrated with Guix in the future. This commit also includes a migration attempting to shrink some indexes.
Diffstat (limited to 'sqitch')
-rw-r--r--sqitch/deploy/change_package_derivations_by_guix_revision_range_target.sql15
-rw-r--r--sqitch/deploy/change_package_derivations_target.sql7
-rw-r--r--sqitch/deploy/increase_fillfactor_for_some_indexes.sql29
-rw-r--r--sqitch/deploy/remove_old_cross_derivations.sql30
-rw-r--r--sqitch/revert/change_package_derivations_by_guix_revision_range_target.sql7
-rw-r--r--sqitch/revert/change_package_derivations_target.sql7
-rw-r--r--sqitch/revert/increase_fillfactor_for_some_indexes.sql7
-rw-r--r--sqitch/revert/remove_old_cross_derivations.sql7
-rw-r--r--sqitch/sqitch.plan4
-rw-r--r--sqitch/verify/change_package_derivations_by_guix_revision_range_target.sql7
-rw-r--r--sqitch/verify/change_package_derivations_target.sql7
-rw-r--r--sqitch/verify/increase_fillfactor_for_some_indexes.sql7
-rw-r--r--sqitch/verify/remove_old_cross_derivations.sql7
13 files changed, 141 insertions, 0 deletions
diff --git a/sqitch/deploy/change_package_derivations_by_guix_revision_range_target.sql b/sqitch/deploy/change_package_derivations_by_guix_revision_range_target.sql
new file mode 100644
index 0000000..7ba90c7
--- /dev/null
+++ b/sqitch/deploy/change_package_derivations_by_guix_revision_range_target.sql
@@ -0,0 +1,15 @@
+-- Deploy guix-data-service:change_package_derivations_by_guix_revision_range_target to pg
+
+BEGIN;
+
+UPDATE package_derivations_by_guix_revision_range SET target = '' WHERE system = target;
+
+DELETE FROM package_derivations_by_guix_revision_range WHERE target IN (
+ 'aarch64-linux',
+ 'armhf-linux',
+ 'i686-linux',
+ 'mips64el-linux',
+ 'x86_64-linux'
+);
+
+COMMIT;
diff --git a/sqitch/deploy/change_package_derivations_target.sql b/sqitch/deploy/change_package_derivations_target.sql
new file mode 100644
index 0000000..9a9f3c3
--- /dev/null
+++ b/sqitch/deploy/change_package_derivations_target.sql
@@ -0,0 +1,7 @@
+-- Deploy guix-data-service:change_package_derivations_target to pg
+
+BEGIN;
+
+UPDATE package_derivations SET target = '' WHERE system = target;
+
+COMMIT;
diff --git a/sqitch/deploy/increase_fillfactor_for_some_indexes.sql b/sqitch/deploy/increase_fillfactor_for_some_indexes.sql
new file mode 100644
index 0000000..93f8209
--- /dev/null
+++ b/sqitch/deploy/increase_fillfactor_for_some_indexes.sql
@@ -0,0 +1,29 @@
+-- Deploy guix-data-service:increase_fillfactor_for_some_indexes to pg
+
+BEGIN;
+
+ALTER INDEX derivation_inputs_pkey SET (fillfactor = 100);
+ALTER INDEX derivation_inputs_derivation_output_id_idx SET (fillfactor = 100);
+ALTER INDEX guix_revision_package_derivations_pkey SET (fillfactor = 100);
+ALTER INDEX derivations_pkey SET (fillfactor = 100);
+ALTER INDEX file_name_unique SET (fillfactor = 100);
+ALTER INDEX id_unique SET (fillfactor = 100);
+ALTER INDEX derivations_hash SET (fillfactor = 100);
+ALTER INDEX package_derivations_pkey SET (fillfactor = 100);
+ALTER INDEX package_derivations_id_key SET (fillfactor = 100);
+ALTER INDEX package_derivations_derivation_id SET (fillfactor = 100);
+ALTER INDEX package_derivations_package_id_idx SET (fillfactor = 100);
+
+REINDEX INDEX derivation_inputs_pkey;
+REINDEX INDEX derivation_inputs_derivation_output_id_idx;
+REINDEX INDEX guix_revision_package_derivations_pkey;
+REINDEX INDEX derivations_pkey;
+REINDEX INDEX file_name_unique;
+REINDEX INDEX id_unique;
+REINDEX INDEX derivations_hash;
+REINDEX INDEX package_derivations_pkey;
+REINDEX INDEX package_derivations_id_key;
+REINDEX INDEX package_derivations_derivation_id;
+REINDEX INDEX package_derivations_package_id_idx;
+
+COMMIT;
diff --git a/sqitch/deploy/remove_old_cross_derivations.sql b/sqitch/deploy/remove_old_cross_derivations.sql
new file mode 100644
index 0000000..b035673
--- /dev/null
+++ b/sqitch/deploy/remove_old_cross_derivations.sql
@@ -0,0 +1,30 @@
+-- Deploy guix-data-service:remove_old_cross_derivations to pg
+
+BEGIN;
+
+DELETE FROM guix_revision_package_derivations WHERE package_derivation_id IN (
+ SELECT id
+ FROM package_derivations
+ WHERE target IN (
+ 'aarch64-linux',
+ 'armhf-linux',
+ 'i686-linux',
+ 'mips64el-linux',
+ 'x86_64-linux'
+ )
+);
+
+-- Checking this constraint is expensive, so drop it, then re-create it
+ALTER TABLE guix_revision_package_derivations DROP CONSTRAINT guix_revision_package_derivations_package_derivation_id_fkey;
+
+DELETE FROM package_derivations WHERE target IN (
+ 'aarch64-linux',
+ 'armhf-linux',
+ 'i686-linux',
+ 'mips64el-linux',
+ 'x86_64-linux'
+);
+
+ALTER TABLE guix_revision_package_derivations ADD CONSTRAINT "guix_revision_package_derivations_package_derivation_id_fkey" FOREIGN KEY (package_derivation_id) REFERENCES package_derivations(id);
+
+COMMIT;
diff --git a/sqitch/revert/change_package_derivations_by_guix_revision_range_target.sql b/sqitch/revert/change_package_derivations_by_guix_revision_range_target.sql
new file mode 100644
index 0000000..3742e92
--- /dev/null
+++ b/sqitch/revert/change_package_derivations_by_guix_revision_range_target.sql
@@ -0,0 +1,7 @@
+-- Revert guix-data-service:change_package_derivations_by_guix_revision_range_target from pg
+
+BEGIN;
+
+-- XXX Add DDLs here.
+
+COMMIT;
diff --git a/sqitch/revert/change_package_derivations_target.sql b/sqitch/revert/change_package_derivations_target.sql
new file mode 100644
index 0000000..febb75b
--- /dev/null
+++ b/sqitch/revert/change_package_derivations_target.sql
@@ -0,0 +1,7 @@
+-- Revert guix-data-service:change_package_derivations_target from pg
+
+BEGIN;
+
+-- XXX Add DDLs here.
+
+COMMIT;
diff --git a/sqitch/revert/increase_fillfactor_for_some_indexes.sql b/sqitch/revert/increase_fillfactor_for_some_indexes.sql
new file mode 100644
index 0000000..a87f3f3
--- /dev/null
+++ b/sqitch/revert/increase_fillfactor_for_some_indexes.sql
@@ -0,0 +1,7 @@
+-- Revert guix-data-service:increase_fillfactor_for_some_indexes from pg
+
+BEGIN;
+
+-- XXX Add DDLs here.
+
+COMMIT;
diff --git a/sqitch/revert/remove_old_cross_derivations.sql b/sqitch/revert/remove_old_cross_derivations.sql
new file mode 100644
index 0000000..7577a08
--- /dev/null
+++ b/sqitch/revert/remove_old_cross_derivations.sql
@@ -0,0 +1,7 @@
+-- Revert guix-data-service:remove_old_cross_derivations from pg
+
+BEGIN;
+
+-- XXX Add DDLs here.
+
+COMMIT;
diff --git a/sqitch/sqitch.plan b/sqitch/sqitch.plan
index b4e99fd..2d04104 100644
--- a/sqitch/sqitch.plan
+++ b/sqitch/sqitch.plan
@@ -44,3 +44,7 @@ derivation_source_files_store_path_hash_index 2019-12-29T17:53:08Z Christopher B
build_servers_build_config 2020-01-05T12:06:13Z Christopher Baines <mail@cbaines.net> # Add build_servers_build_config table
git-repositories-x-git-repo-header 2020-01-11T16:39:32Z Christopher Baines <mail@cbaines.net> # Add x_git_repo_header to git_repositories
system_test_tables 2020-02-02T11:36:20Z Christopher Baines <mail@cbaines.net> # Add tables for storing system tests
+change_package_derivations_target 2020-02-07T19:29:50Z Christopher Baines <mail@cbaines.net> # Change package_derivations target
+remove_old_cross_derivations 2020-02-07T19:42:54Z Christopher Baines <mail@cbaines.net> # Remove old cross derivations
+increase_fillfactor_for_some_indexes 2020-02-07T20:49:17Z Christopher Baines <mail@cbaines.net> # Increase the fillfactor for some btree indexes
+change_package_derivations_by_guix_revision_range_target 2020-02-08T10:13:07Z Christopher Baines <mail@cbaines.net> # Change the values for package_derivations_by_guix_revision_range target
diff --git a/sqitch/verify/change_package_derivations_by_guix_revision_range_target.sql b/sqitch/verify/change_package_derivations_by_guix_revision_range_target.sql
new file mode 100644
index 0000000..c6a756f
--- /dev/null
+++ b/sqitch/verify/change_package_derivations_by_guix_revision_range_target.sql
@@ -0,0 +1,7 @@
+-- Verify guix-data-service:change_package_derivations_by_guix_revision_range_target on pg
+
+BEGIN;
+
+-- XXX Add verifications here.
+
+ROLLBACK;
diff --git a/sqitch/verify/change_package_derivations_target.sql b/sqitch/verify/change_package_derivations_target.sql
new file mode 100644
index 0000000..de6cf7a
--- /dev/null
+++ b/sqitch/verify/change_package_derivations_target.sql
@@ -0,0 +1,7 @@
+-- Verify guix-data-service:change_package_derivations_target on pg
+
+BEGIN;
+
+-- XXX Add verifications here.
+
+ROLLBACK;
diff --git a/sqitch/verify/increase_fillfactor_for_some_indexes.sql b/sqitch/verify/increase_fillfactor_for_some_indexes.sql
new file mode 100644
index 0000000..44269dc
--- /dev/null
+++ b/sqitch/verify/increase_fillfactor_for_some_indexes.sql
@@ -0,0 +1,7 @@
+-- Verify guix-data-service:increase_fillfactor_for_some_indexes on pg
+
+BEGIN;
+
+-- XXX Add verifications here.
+
+ROLLBACK;
diff --git a/sqitch/verify/remove_old_cross_derivations.sql b/sqitch/verify/remove_old_cross_derivations.sql
new file mode 100644
index 0000000..8f6768e
--- /dev/null
+++ b/sqitch/verify/remove_old_cross_derivations.sql
@@ -0,0 +1,7 @@
+-- Verify guix-data-service:remove_old_cross_derivations on pg
+
+BEGIN;
+
+-- XXX Add verifications here.
+
+ROLLBACK;