mirror of
https://github.com/NixOS/nix
synced 2025-07-03 22:51:47 +02:00
* Added a flag --ignore-liveness' to
nix-store --delete'. It
deletes a path even if it is reachable from a root. However, it won't delete a path that still has referrers (since that would violate store invariants). Don't try this at home. It's a useful hack for recovering from certain situations in a somewhat clean way (e.g., holes in closures due to disk corruption).
This commit is contained in:
parent
4b9e7f59ca
commit
f96d2dea26
3 changed files with 12 additions and 6 deletions
|
@ -304,7 +304,7 @@ static Paths topoSort(const PathSet & paths)
|
|||
|
||||
|
||||
void collectGarbage(GCAction action, const PathSet & pathsToDelete,
|
||||
PathSet & result, unsigned long long & bytesFreed)
|
||||
bool ignoreLiveness, PathSet & result, unsigned long long & bytesFreed)
|
||||
{
|
||||
result.clear();
|
||||
bytesFreed = 0;
|
||||
|
@ -323,7 +323,8 @@ void collectGarbage(GCAction action, const PathSet & pathsToDelete,
|
|||
permanent roots cannot increase now. */
|
||||
Path rootsDir = canonPath((format("%1%/%2%") % nixStateDir % gcRootsDir).str());
|
||||
PathSet roots;
|
||||
findRoots(rootsDir, true, roots);
|
||||
if (!ignoreLiveness)
|
||||
findRoots(rootsDir, true, roots);
|
||||
|
||||
if (action == gcReturnRoots) {
|
||||
result = roots;
|
||||
|
|
|
@ -21,7 +21,7 @@ typedef enum {
|
|||
set of paths not reachable from the roots. If `action' is
|
||||
`gcDeleteDead', actually delete the latter set. */
|
||||
void collectGarbage(GCAction action, const PathSet & pathsToDelete,
|
||||
PathSet & result, unsigned long long & bytesFreed);
|
||||
bool ignoreLiveness, PathSet & result, unsigned long long & bytesFreed);
|
||||
|
||||
/* Register a temporary GC root. This root will automatically
|
||||
disappear when this process exits. WARNING: this function should
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue