diff options
author | Ludovic Courtès <ludo@gnu.org> | 2014-11-04 20:55:48 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2014-11-04 21:13:28 +0100 |
commit | 000c59b6719250ee94a597418765c2f7f0ad3969 (patch) | |
tree | 473f7840522e966cc473d1dd397fb8c574df137f /guix/store.scm | |
parent | 8de16914751966ba45789d619cac5246cbf53cac (diff) | |
download | gnu-guix-000c59b6719250ee94a597418765c2f7f0ad3969.tar gnu-guix-000c59b6719250ee94a597418765c2f7f0ad3969.tar.gz |
store: Invalidate caches once GC has run.
* guix/store.scm (run-gc): Add calls to 'hash-clear!'.
* tests/store.scm ("add-text-to-store vs. delete-paths",
"add-to-store vs. delete-paths"): New tests.
Diffstat (limited to 'guix/store.scm')
-rw-r--r-- | guix/store.scm | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/guix/store.scm b/guix/store.scm index 452a2f1268..bc4c641583 100644 --- a/guix/store.scm +++ b/guix/store.scm @@ -728,6 +728,13 @@ and the number of bytes freed." (let ((paths (read-store-path-list s)) (freed (read-long-long s)) (obsolete (read-long-long s))) + (unless (null? paths) + ;; To be on the safe side, completely invalidate both caches. + ;; Otherwise we could end up returning store paths that are no longer + ;; valid. + (hash-clear! (nix-server-add-to-store-cache server)) + (hash-clear! (nix-server-add-text-to-store-cache server))) + (values paths freed)))) (define-syntax-rule (%long-long-max) |