gc: delay throwing error until cleanup is complete
Previously, paths not being deleted by gcDeleteSpecific would result in (a) hardlinks not being cleaned up, and (b) statistics not being reported correctly. By throwing the error later, we fix both of these problems. Change-Id: I8019f3e10d9f22e81ea87bb26b77f04ebc888a19
This commit is contained in:
@@ -16,6 +16,8 @@ let
|
||||
name = "dependencies-input-2";
|
||||
buildCommand = ''
|
||||
mkdir $out
|
||||
# Space-filler to test GC stats reporting
|
||||
head -c 100k /dev/zero > $out/filler
|
||||
echo BAR > $out/bar
|
||||
echo ${input0} > $out/input0
|
||||
'';
|
||||
|
||||
@@ -69,11 +69,14 @@ nix-store --delete --skip-live $(readLink $outPath/reference-to-input-2)
|
||||
|
||||
rm "$NIX_STATE_DIR"/gcroots/foo
|
||||
# with the dependent unrooted, we should be able to remove input2...
|
||||
nix-store --delete --delete-closure $input2
|
||||
nix-store --delete --delete-closure $input2 > delete-output
|
||||
# which should remove input0, since only input2 and top depended on it and we passed --delete-closure
|
||||
! test -e $input0
|
||||
# but fod should be unaffected, since it's not part of input-2's closure
|
||||
test -e $fodOut
|
||||
# and stats should be reported correctly
|
||||
grep "0.10 MiB freed$" delete-output
|
||||
test -z "$(grep "0 paths deleted" delete-output)"
|
||||
|
||||
|
||||
nix-collect-garbage
|
||||
|
||||
Reference in New Issue
Block a user