[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
02/02: Vacuum the log parts table after deleting entries from it
From: |
Christopher Baines |
Subject: |
02/02: Vacuum the log parts table after deleting entries from it |
Date: |
Tue, 17 Nov 2020 16:37:44 -0500 (EST) |
cbaines pushed a commit to branch master
in repository data-service.
commit 276c4ecd71548d64f52ec3a8973f7a15825daf11
Author: Christopher Baines <mail@cbaines.net>
AuthorDate: Tue Nov 17 20:49:47 2020 +0000
Vacuum the log parts table after deleting entries from it
To help keep the number of dead tuples down.
---
guix-data-service/jobs/load-new-guix-revision.scm | 16 ++++++++++++----
1 file changed, 12 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 398f1cb..ab6e2db 100644
--- a/guix-data-service/jobs/load-new-guix-revision.scm
+++ b/guix-data-service/jobs/load-new-guix-revision.scm
@@ -302,6 +302,11 @@ WHERE job_id = $1"
"DROP SEQUENCE "
(log-part-sequence-name job-id))))
+(define (vacuum-log-parts-table conn)
+ (exec-query
+ conn
+ "VACUUM load_new_guix_revision_job_log_parts"))
+
(define inferior-package-id
(@@ (guix inferior) inferior-package-id))
@@ -1691,15 +1696,18 @@ SKIP LOCKED")
(setup-port-for-inferior-error-output
id previous-error-port)))
(thunk))))
- (combine-log-parts! logging-conn id)
- (drop-log-parts-sequence logging-conn id)
+ (set-current-output-port previous-output-port)
+ (set-current-error-port previous-error-port)
;; This can happen with GC, so do it explicitly
(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))))))
- (set-current-output-port previous-output-port)
- (set-current-error-port previous-error-port)
result))
(prevent-inlining-for-tests setup-logging)