guix-commits
[Top][All Lists]
Advanced

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

01/03: Trim derivation source file tables in the small data dump


From: Christopher Baines
Subject: 01/03: Trim derivation source file tables in the small data dump
Date: Fri, 13 Mar 2020 14:42:38 -0400 (EDT)

cbaines pushed a commit to branch master
in repository data-service.

commit b64e6b19c22488b11fa2bd70399aed302988343f
Author: Christopher Baines <address@hidden>
AuthorDate: Fri Mar 13 18:37:46 2020 +0000

    Trim derivation source file tables in the small data dump
---
 scripts/guix-data-service-create-small-backup | 30 +++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/scripts/guix-data-service-create-small-backup 
b/scripts/guix-data-service-create-small-backup
index c5c5678..a5f8cc6 100755
--- a/scripts/guix-data-service-create-small-backup
+++ b/scripts/guix-data-service-create-small-backup
@@ -120,6 +120,28 @@ wait
 
 psql -v ON_ERROR_STOP=1 --echo-queries --no-psqlrc "$URI_FOR_DATABASE" -U 
guix_data_service <<EOF &
 
+CREATE UNLOGGED TABLE tmp_derivation_source_files AS
+SELECT *
+FROM derivation_source_files
+WHERE id IN (
+  SELECT derivation_source_file_id
+  FROM tmp_derivation_sources
+);
+
+CREATE UNLOGGED TABLE tmp_derivation_source_file_nars AS
+SELECT *
+FROM derivation_source_file_nars
+WHERE derivation_source_file_id IN (
+  SELECT id FROM tmp_derivation_source_files
+);
+
+TRUNCATE derivation_source_files CASCADE; -- Cascades to derivation_sources
+TRUNCATE derivation_source_file_nars;
+
+EOF
+
+psql -v ON_ERROR_STOP=1 --echo-queries --no-psqlrc "$URI_FOR_DATABASE" -U 
guix_data_service <<EOF &
+
 DELETE FROM guix_revision_lint_warnings WHERE guix_revision_id NOT IN (
   SELECT id FROM guix_revisions WHERE commit IN (SELECT commit FROM 
git_branches)
 );
@@ -199,8 +221,14 @@ INSERT INTO derivation_outputs OVERRIDING SYSTEM VALUE
 INSERT INTO derivation_inputs
   SELECT * FROM tmp_derivation_inputs;
 
+INSERT INTO derivation_source_files OVERRIDING SYSTEM VALUE
+  SELECT * FROM tmp_derivation_source_files;
+
 INSERT INTO derivation_sources
   SELECT * FROM tmp_derivation_sources;
+
+INSERT INTO derivation_source_file_nars
+  SELECT * FROM tmp_derivation_source_file_nars;
 EOF
 
 psql -v ON_ERROR_STOP=1 --echo-queries --no-psqlrc "$URI_FOR_DATABASE" -U 
guix_data_service <<EOF
@@ -213,6 +241,8 @@ DROP TABLE tmp_build_status;
 DROP TABLE tmp_derivation_outputs;
 DROP TABLE tmp_derivation_inputs;
 DROP TABLE tmp_derivation_sources;
+DROP TABLE tmp_derivation_source_files;
+DROP TABLE tmp_derivation_source_file_nars;
 
 EOF
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]