diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2022-12-18 00:35:21 +0100 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2022-12-18 01:17:17 +0100 |
| commit | 495c50008be91429ebea3805e161a1e385a2a572 (patch) | |
| tree | 86700aa10ba9f39726e2d1895e234304531ff234 | |
| parent | 9b6703eabee07068328a5e489deb3d532f242daa (diff) | |
installer: final: Delete SQLite WAL and shm files upon completion.
Previously, db.sqlite-{wal,shm} could be left behind after stopping
guix-daemon. When resuming installation, SQLite could end up behaving
as if transactions visible in the WAL file had been committed, in spite
of having restored SAVED-DATABASE.
Fixes <https://issues.guix.gnu.org/59784>.
Reported by pelzflorian (Florian Pelz) <pelzflorian@pelzflorian.de>.
* gnu/installer/final.scm (install-system): Before restarting
guix-daemon, delete db.sqlite-{wal,shm}.
| -rw-r--r-- | gnu/installer/final.scm | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/gnu/installer/final.scm b/gnu/installer/final.scm index f5601d86497..069426a3b8d 100644 --- a/gnu/installer/final.scm +++ b/gnu/installer/final.scm | |||
| @@ -221,10 +221,18 @@ or #f. Return #t on success and #f on failure." | |||
| 221 | ;; alive. | 221 | ;; alive. |
| 222 | (stop-service 'guix-daemon) | 222 | (stop-service 'guix-daemon) |
| 223 | 223 | ||
| 224 | ;; Restore the database and restart it. | 224 | ;; Restore the database and restart it. As part of restoring the |
| 225 | ;; database, remove the WAL and shm files in case they were left | ||
| 226 | ;; behind after guix-daemon was stopped. Failing to do so, | ||
| 227 | ;; sqlite might behave as if transactions that appear in the WAL | ||
| 228 | ;; file were committed. (See <https://www.sqlite.org/wal.html>.) | ||
| 225 | (installer-log-line "restoring store database from '~a'" | 229 | (installer-log-line "restoring store database from '~a'" |
| 226 | saved-database) | 230 | saved-database) |
| 227 | (copy-file saved-database database-file) | 231 | (copy-file saved-database database-file) |
| 232 | (for-each (lambda (suffix) | ||
| 233 | (false-if-exception | ||
| 234 | (delete-file (string-append database-file suffix)))) | ||
| 235 | '("-wal" "-shm")) | ||
| 228 | (start-service 'guix-daemon) | 236 | (start-service 'guix-daemon) |
| 229 | 237 | ||
| 230 | ;; Finally umount the cow-store and exit the container. | 238 | ;; Finally umount the cow-store and exit the container. |
