forked from lix-project/lix
* Make the garbage collector more resilient to certain consistency
errors: in-use paths now cause a warning, not a fatal error.
This commit is contained in:
parent
8659edc098
commit
8f67b35886
src/libstore
|
@ -599,9 +599,13 @@ void LocalStore::collectGarbage(GCAction action, const PathSet & pathsToDelete,
|
||||||
printMsg(lvlInfo, format("deleting `%1%'") % *i);
|
printMsg(lvlInfo, format("deleting `%1%'") % *i);
|
||||||
|
|
||||||
/* Okay, it's safe to delete. */
|
/* Okay, it's safe to delete. */
|
||||||
unsigned long long freed;
|
try {
|
||||||
deleteFromStore(*i, freed);
|
unsigned long long freed;
|
||||||
bytesFreed += freed;
|
deleteFromStore(*i, freed);
|
||||||
|
bytesFreed += freed;
|
||||||
|
} catch (PathInUse & e) {
|
||||||
|
printMsg(lvlError, format("warning: %1%") % e.msg());
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef __CYGWIN__
|
#ifndef __CYGWIN__
|
||||||
if (fdLock != -1)
|
if (fdLock != -1)
|
||||||
|
|
|
@ -709,7 +709,7 @@ void deleteFromStore(const Path & _path, unsigned long long & bytesFreed)
|
||||||
for (PathSet::iterator i = referrers.begin();
|
for (PathSet::iterator i = referrers.begin();
|
||||||
i != referrers.end(); ++i)
|
i != referrers.end(); ++i)
|
||||||
if (*i != path && isValidPathTxn(txn, *i))
|
if (*i != path && isValidPathTxn(txn, *i))
|
||||||
throw Error(format("cannot delete path `%1%' because it is in use by path `%2%'") % path % *i);
|
throw PathInUse(format("cannot delete path `%1%' because it is in use by path `%2%'") % path % *i);
|
||||||
invalidatePath(txn, path);
|
invalidatePath(txn, path);
|
||||||
}
|
}
|
||||||
txn.commit();
|
txn.commit();
|
||||||
|
|
|
@ -138,6 +138,8 @@ Path queryDeriver(const Transaction & txn, const Path & path);
|
||||||
/* Delete a value from the nixStore directory. */
|
/* Delete a value from the nixStore directory. */
|
||||||
void deleteFromStore(const Path & path, unsigned long long & bytesFreed);
|
void deleteFromStore(const Path & path, unsigned long long & bytesFreed);
|
||||||
|
|
||||||
|
MakeError(PathInUse, Error);
|
||||||
|
|
||||||
void verifyStore(bool checkContents);
|
void verifyStore(bool checkContents);
|
||||||
|
|
||||||
/* Whether we are in build users mode. */
|
/* Whether we are in build users mode. */
|
||||||
|
|
Loading…
Reference in a new issue