guix-commits
[Top][All Lists]
Advanced

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

branch master updated: Move logging cleanup tasks to after the transacti


From: Christopher Baines
Subject: branch master updated: Move logging cleanup tasks to after the transaction commits
Date: Sun, 20 Feb 2022 03:26:24 -0500

This is an automated email from the git hooks/post-receive script.

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

The following commit(s) were added to refs/heads/master by this push:
     new a0a7d66  Move logging cleanup tasks to after the transaction commits
a0a7d66 is described below

commit a0a7d66b1dbcd17c880c3dcfa9929cf8daf8922c
Author: Christopher Baines <mail@cbaines.net>
AuthorDate: Sat Feb 19 09:54:39 2022 +0000

    Move logging cleanup tasks to after the transaction commits
    
    As I think some operations (like the database backup) can block the DROP
    SEQUENCE bit, so at least this approach means that the main transaction 
should
    commit and then the sequence is eventually dropped.
---
 guix-data-service/jobs/load-new-guix-revision.scm | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/guix-data-service/jobs/load-new-guix-revision.scm 
b/guix-data-service/jobs/load-new-guix-revision.scm
index 8a7e5aa..d8f49ca 100644
--- a/guix-data-service/jobs/load-new-guix-revision.scm
+++ b/guix-data-service/jobs/load-new-guix-revision.scm
@@ -303,7 +303,7 @@ WHERE job_id = $1")
   (exec-query
    conn
    (string-append
-    "DROP SEQUENCE "
+    "DROP SEQUENCE IF EXISTS "
     (log-part-sequence-name job-id))))
 
 (define (vacuum-log-parts-table conn)
@@ -1820,13 +1820,15 @@ SKIP LOCKED")
                  (close-port logging-port)
 
                  (combine-log-parts! logging-conn id)
-                 (drop-log-parts-sequence logging-conn id)
-                 (with-time-logging "vacuuming log parts"
-                   (vacuum-log-parts-table logging-conn))
 
                  result))))))
     result))
 
+(define (cleanup-logging id conn)
+  (drop-log-parts-sequence conn id)
+  (with-time-logging "vacuuming log parts"
+    (vacuum-log-parts-table conn)))
+
 (prevent-inlining-for-tests setup-logging)
 
 (define (process-load-new-guix-revision-job id)
@@ -1881,6 +1883,10 @@ SKIP LOCKED")
               (record-job-event conn id "success")
               (exec-query conn "COMMIT")
 
+              (with-time-logging
+                  "cleanup logging"
+                (cleanup-logging id conn))
+
               (with-time-logging
                   "vacuuming package derivations by guix revision range table"
                 (vacuum-package-derivations-table conn))
@@ -1889,6 +1895,11 @@ SKIP LOCKED")
             (begin
               (exec-query conn "ROLLBACK")
               (record-job-event conn id "failure")
+
+              (with-time-logging
+                  "cleanup logging"
+                (cleanup-logging id conn))
+
               #f)))
        (()
         (exec-query conn "ROLLBACK")



reply via email to

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