mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-24 21:38:07 -05:00
image: Do not set journal_model=WAL for the Hurd.
This fixes <https://bugs.gnu.org/42151>. * gnu/system/images/hurd.scm (hurd-initialize-root-partition): Use #:wal-mode #f in call to ... * gnu/build/image.scm (initialize-root-partition): ... this, add #:wal-mode? parameter, pass it to ... (register-closure): ... this, add #:wal-mode? parameter, pass it to ... * guix/store/database.scm (with-database): ... this, add #:wal-mode? parameter, pass it to ... (call-with-database): ... this, add #:wal-mode? parameter; when set to #f, do not set journal_model=WAL.
This commit is contained in:
parent
1649c7d69a
commit
4b9eecd322
3 changed files with 42 additions and 21 deletions
|
@ -131,20 +131,23 @@ (define* (genimage config target)
|
||||||
(define* (register-closure prefix closure
|
(define* (register-closure prefix closure
|
||||||
#:key
|
#:key
|
||||||
(deduplicate? #t) (reset-timestamps? #t)
|
(deduplicate? #t) (reset-timestamps? #t)
|
||||||
(schema (sql-schema)))
|
(schema (sql-schema))
|
||||||
|
(wal-mode? #t))
|
||||||
"Register CLOSURE in PREFIX, where PREFIX is the directory name of the
|
"Register CLOSURE in PREFIX, where PREFIX is the directory name of the
|
||||||
target store and CLOSURE is the name of a file containing a reference graph as
|
target store and CLOSURE is the name of a file containing a reference graph as
|
||||||
produced by #:references-graphs.. As a side effect, if RESET-TIMESTAMPS? is
|
produced by #:references-graphs.. As a side effect, if RESET-TIMESTAMPS? is
|
||||||
true, reset timestamps on store files and, if DEDUPLICATE? is true,
|
true, reset timestamps on store files and, if DEDUPLICATE? is true,
|
||||||
deduplicates files common to CLOSURE and the rest of PREFIX."
|
deduplicates files common to CLOSURE and the rest of PREFIX. Pass WAL-MODE?
|
||||||
|
to call-with-database."
|
||||||
(let ((items (call-with-input-file closure read-reference-graph)))
|
(let ((items (call-with-input-file closure read-reference-graph)))
|
||||||
(parameterize ((sql-schema schema))
|
(parameterize ((sql-schema schema))
|
||||||
(with-database (store-database-file #:prefix prefix) db
|
(with-database (store-database-file #:prefix prefix) db
|
||||||
(register-items db items
|
#:wal-mode? wal-mode?
|
||||||
#:prefix prefix
|
(register-items db items
|
||||||
#:deduplicate? deduplicate?
|
#:prefix prefix
|
||||||
#:reset-timestamps? reset-timestamps?
|
#:deduplicate? deduplicate?
|
||||||
#:registration-time %epoch)))))
|
#:reset-timestamps? reset-timestamps?
|
||||||
|
#:registration-time %epoch)))))
|
||||||
|
|
||||||
(define* (initialize-efi-partition root
|
(define* (initialize-efi-partition root
|
||||||
#:key
|
#:key
|
||||||
|
@ -164,14 +167,16 @@ (define* (initialize-root-partition root
|
||||||
(register-closures? #t)
|
(register-closures? #t)
|
||||||
system-directory
|
system-directory
|
||||||
make-device-nodes
|
make-device-nodes
|
||||||
|
(wal-mode? #t)
|
||||||
#:allow-other-keys)
|
#:allow-other-keys)
|
||||||
"Initialize the given ROOT directory. Use BOOTCFG and BOOTCFG-LOCATION to
|
"Initialize the given ROOT directory. Use BOOTCFG and BOOTCFG-LOCATION to
|
||||||
install the bootloader configuration.
|
install the bootloader configuration.
|
||||||
|
|
||||||
If REGISTER-CLOSURES? is true, register REFERENCES-GRAPHS in the store. If
|
If REGISTER-CLOSURES? is true, register REFERENCES-GRAPHS in the store. If
|
||||||
DEDUPLICATE? is true, then also deduplicate files common to CLOSURES and the
|
DEDUPLICATE? is true, then also deduplicate files common to CLOSURES and the
|
||||||
rest of the store when registering the closures. SYSTEM-DIRECTORY is the name
|
rest of the store when registering the closures. SYSTEM-DIRECTORY is the name
|
||||||
of the directory of the 'system' derivation."
|
of the directory of the 'system' derivation. Pass WAL-MODE? to
|
||||||
|
register-closure."
|
||||||
(populate-root-file-system system-directory root)
|
(populate-root-file-system system-directory root)
|
||||||
(populate-store references-graphs root)
|
(populate-store references-graphs root)
|
||||||
|
|
||||||
|
@ -184,7 +189,8 @@ (define* (initialize-root-partition root
|
||||||
(register-closure root
|
(register-closure root
|
||||||
closure
|
closure
|
||||||
#:reset-timestamps? #t
|
#:reset-timestamps? #t
|
||||||
#:deduplicate? deduplicate?))
|
#:deduplicate? deduplicate?
|
||||||
|
#:wal-mode? wal-mode?))
|
||||||
references-graphs))
|
references-graphs))
|
||||||
|
|
||||||
(when bootloader-installer
|
(when bootloader-installer
|
||||||
|
|
|
@ -61,8 +61,12 @@ (define hurd-initialize-root-partition
|
||||||
#~(lambda* (#:rest args)
|
#~(lambda* (#:rest args)
|
||||||
(apply initialize-root-partition
|
(apply initialize-root-partition
|
||||||
(append args
|
(append args
|
||||||
(list #:make-device-nodes
|
(list #:make-device-nodes make-hurd-device-nodes
|
||||||
make-hurd-device-nodes)))))
|
;; XXX Creating a db.sqlite with journal_mode=WAL
|
||||||
|
;; yields "unable to open database file" on GNU/Hurd
|
||||||
|
;; for an sqlite with the hurd-locking-mode.patch;
|
||||||
|
;; see <https://bugs.gnu.org/42151>.
|
||||||
|
#:wal-mode? #f)))))
|
||||||
|
|
||||||
(define hurd-disk-image
|
(define hurd-disk-image
|
||||||
(image
|
(image
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
;;; GNU Guix --- Functional package management for GNU
|
;;; GNU Guix --- Functional package management for GNU
|
||||||
;;; Copyright © 2017, 2019 Caleb Ristvedt <caleb.ristvedt@cune.org>
|
;;; Copyright © 2017, 2019 Caleb Ristvedt <caleb.ristvedt@cune.org>
|
||||||
;;; Copyright © 2018, 2020 Ludovic Courtès <ludo@gnu.org>
|
;;; Copyright © 2018, 2020 Ludovic Courtès <ludo@gnu.org>
|
||||||
|
;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
;;;
|
;;;
|
||||||
|
@ -20,6 +21,7 @@
|
||||||
(define-module (guix store database)
|
(define-module (guix store database)
|
||||||
#:use-module (sqlite3)
|
#:use-module (sqlite3)
|
||||||
#:use-module (guix config)
|
#:use-module (guix config)
|
||||||
|
#:use-module (guix gexp)
|
||||||
#:use-module (guix serialization)
|
#:use-module (guix serialization)
|
||||||
#:use-module (guix store deduplication)
|
#:use-module (guix store deduplication)
|
||||||
#:use-module (guix base16)
|
#:use-module (guix base16)
|
||||||
|
@ -27,6 +29,7 @@ (define-module (guix store database)
|
||||||
#:use-module (guix build syscalls)
|
#:use-module (guix build syscalls)
|
||||||
#:use-module ((guix build utils)
|
#:use-module ((guix build utils)
|
||||||
#:select (mkdir-p executable-file?))
|
#:select (mkdir-p executable-file?))
|
||||||
|
#:use-module (guix utils)
|
||||||
#:use-module (guix build store-copy)
|
#:use-module (guix build store-copy)
|
||||||
#:use-module (srfi srfi-1)
|
#:use-module (srfi srfi-1)
|
||||||
#:use-module (srfi srfi-11)
|
#:use-module (srfi srfi-11)
|
||||||
|
@ -97,17 +100,20 @@ (define schema
|
||||||
|
|
||||||
(sqlite-exec db (call-with-input-file schema get-string-all)))
|
(sqlite-exec db (call-with-input-file schema get-string-all)))
|
||||||
|
|
||||||
(define (call-with-database file proc)
|
(define* (call-with-database file proc #:key (wal-mode? #t))
|
||||||
"Pass PROC a database record corresponding to FILE. If FILE doesn't exist,
|
"Pass PROC a database record corresponding to FILE. If FILE doesn't exist,
|
||||||
create it and initialize it as a new database."
|
create it and initialize it as a new database. Unless WAL-MODE? is set to #f,
|
||||||
|
set journal_mode=WAL."
|
||||||
(let ((new? (and (not (file-exists? file))
|
(let ((new? (and (not (file-exists? file))
|
||||||
(begin
|
(begin
|
||||||
(mkdir-p (dirname file))
|
(mkdir-p (dirname file))
|
||||||
#t)))
|
#t)))
|
||||||
(db (sqlite-open file)))
|
(db (sqlite-open file)))
|
||||||
;; Turn DB in "write-ahead log" mode, which should avoid SQLITE_LOCKED
|
;; Using WAL breaks for the Hurd <https://bugs.gnu.org/42151>.
|
||||||
;; errors when we have several readers: <https://www.sqlite.org/wal.html>.
|
(when wal-mode?
|
||||||
(sqlite-exec db "PRAGMA journal_mode=WAL;")
|
;; Turn DB in "write-ahead log" mode, which should avoid SQLITE_LOCKED
|
||||||
|
;; errors when we have several readers: <https://www.sqlite.org/wal.html>.
|
||||||
|
(sqlite-exec db "PRAGMA journal_mode=WAL;"))
|
||||||
|
|
||||||
;; Install a busy handler such that, when the database is locked, sqlite
|
;; Install a busy handler such that, when the database is locked, sqlite
|
||||||
;; retries until 30 seconds have passed, at which point it gives up and
|
;; retries until 30 seconds have passed, at which point it gives up and
|
||||||
|
@ -200,10 +206,15 @@ (define %default-database-file
|
||||||
;; Default location of the store database.
|
;; Default location of the store database.
|
||||||
(string-append %store-database-directory "/db.sqlite"))
|
(string-append %store-database-directory "/db.sqlite"))
|
||||||
|
|
||||||
(define-syntax-rule (with-database file db exp ...)
|
(define-syntax with-database
|
||||||
"Open DB from FILE and close it when the dynamic extent of EXP... is left.
|
(syntax-rules ()
|
||||||
If FILE doesn't exist, create it and initialize it as a new database."
|
"Open DB from FILE and close it when the dynamic extent of EXP... is left.
|
||||||
(call-with-database file (lambda (db) exp ...)))
|
If FILE doesn't exist, create it and initialize it as a new database. Pass
|
||||||
|
#:wal-mode? to call-with-database."
|
||||||
|
((_ file db #:wal-mode? wal-mode? exp ...)
|
||||||
|
(call-with-database file (lambda (db) exp ...) #:wal-mode? wal-mode?))
|
||||||
|
((_ file db exp ...)
|
||||||
|
(call-with-database file (lambda (db) exp ...)))))
|
||||||
|
|
||||||
(define (sqlite-finalize stmt)
|
(define (sqlite-finalize stmt)
|
||||||
;; As of guile-sqlite3 0.1.0, cached statements aren't reset when
|
;; As of guile-sqlite3 0.1.0, cached statements aren't reset when
|
||||||
|
|
Loading…
Reference in a new issue