Make the WAL threshold more flexible
So that the WAL can grow more when there's sufficient space. When the inferiors are closed it takes time to restart them, so doing this less should speed up processing revisions.
This commit is contained in:
parent
bb5b3731c8
commit
c04ea067c2
1 changed files with 8 additions and 3 deletions
|
|
@ -50,7 +50,7 @@
|
||||||
#:use-module (guix serialization)
|
#:use-module (guix serialization)
|
||||||
#:use-module (guix build utils)
|
#:use-module (guix build utils)
|
||||||
#:use-module ((guix build syscalls)
|
#:use-module ((guix build syscalls)
|
||||||
#:select (set-thread-name))
|
#:select (set-thread-name free-disk-space))
|
||||||
#:use-module (guix-data-service config)
|
#:use-module (guix-data-service config)
|
||||||
#:use-module (guix-data-service database)
|
#:use-module (guix-data-service database)
|
||||||
#:use-module (guix-data-service utils)
|
#:use-module (guix-data-service utils)
|
||||||
|
|
@ -1761,14 +1761,19 @@ SELECT 1 FROM derivation_source_file_nars WHERE derivation_source_file_id = $1"
|
||||||
|
|
||||||
(define (call-with-inferior proc)
|
(define (call-with-inferior proc)
|
||||||
(define (check-wal-size)
|
(define (check-wal-size)
|
||||||
(define threshold (* 4096 (expt 2 20)))
|
|
||||||
|
|
||||||
(define (get-wal-bytes)
|
(define (get-wal-bytes)
|
||||||
(catch #t
|
(catch #t
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(stat:size (stat "/var/guix/db/db.sqlite-wal")))
|
(stat:size (stat "/var/guix/db/db.sqlite-wal")))
|
||||||
(lambda _ 0)))
|
(lambda _ 0)))
|
||||||
|
|
||||||
|
(define threshold
|
||||||
|
(max
|
||||||
|
(* 4096 (expt 2 20))
|
||||||
|
(* 0.8
|
||||||
|
(- (free-disk-space "/var/guix/db/db.sqlite-wal")
|
||||||
|
(get-wal-bytes)))))
|
||||||
|
|
||||||
(if (< (get-wal-bytes) threshold)
|
(if (< (get-wal-bytes) threshold)
|
||||||
#t
|
#t
|
||||||
(let loop ((wal-bytes (get-wal-bytes)))
|
(let loop ((wal-bytes (get-wal-bytes)))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue