Attempt to avoid issues with the guix-daemon WAL

This commit is contained in:
Christopher Baines 2024-03-08 10:31:26 +00:00
parent 5f80856ad1
commit 7d1cc4d325
2 changed files with 30 additions and 0 deletions

View file

@ -38,6 +38,8 @@
check-test-database!
lock-advisory-session-lock
unlock-advisory-session-lock
with-advisory-session-lock
with-advisory-session-lock/log-time
obtain-advisory-transaction-lock
@ -282,6 +284,23 @@
(unless (string=? name "guix_data_service_test")
(error "tests being run against non test database")))))
(define (lock-advisory-session-lock conn lock)
(let ((lock-number (symbol-hash lock)))
(exec-query conn
"SELECT pg_advisory_lock($1)"
(list (number->string lock-number)))
lock-number))
(define (unlock-advisory-session-lock conn lock)
(let ((lock-number
(if (number? lock)
lock
(symbol-hash lock))))
(exec-query conn
"SELECT pg_advisory_lock($1)"
(list (number->string lock-number))))
#t)
(define (with-advisory-session-lock conn lock f)
(let ((lock-number (number->string (symbol-hash lock))))
(exec-query conn

View file

@ -1445,6 +1445,16 @@
(lambda (filename)
(put-message channel filename))))
(define lock-num
;; I'm seeing problems with the guix-dameon WAL growing excessively, which
;; I think is happening when processing revivions involving lots of new
;; derivations. So limit the concurrency here in the hope that this'll
;; help.
(with-time-logging "getting 'inferior-package-derivations lock"
(lock-advisory-session-lock
conn
'inferior-package-derivations)))
(simple-format #t "debug: extract-information-from: ~A\n" store-path)
(letpar& ((inferior-lint-checkers-and-warnings-data
@ -1524,6 +1534,7 @@
pkg-to-replacement-hash-table))))))))
(destroy-resource-pool inf-and-store-pool)
(unlock-advisory-session-lock conn lock-num)
(simple-format
#t "debug: finished loading information from inferior\n")