1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2024-09-19 10:50:24 -04:00

* Ouch. A store upgrade could cause a substituter to be triggered,

causing a deadlock.
This commit is contained in:
Eelco Dolstra 2011-09-12 09:07:43 +00:00
parent 281e3ed059
commit 13114daa3e
3 changed files with 6 additions and 5 deletions

View file

@ -239,7 +239,8 @@ Hash hashDerivationModulo(StoreAPI & store, Derivation drv)
foreach (DerivationInputs::const_iterator, i, drv.inputDrvs) { foreach (DerivationInputs::const_iterator, i, drv.inputDrvs) {
Hash h = drvHashes[i->first]; Hash h = drvHashes[i->first];
if (h.type == htUnknown) { if (h.type == htUnknown) {
Derivation drv2 = derivationFromPath(store, i->first); assert(store.isValidPath(i->first));
Derivation drv2 = parseDerivation(readFile(i->first));
h = hashDerivationModulo(store, drv2); h = hashDerivationModulo(store, drv2);
drvHashes[i->first] = h; drvHashes[i->first] = h;
} }

View file

@ -510,7 +510,7 @@ void LocalStore::checkDerivationOutputs(const Path & drvPath, const Derivation &
} }
unsigned long long LocalStore::addValidPath(const ValidPathInfo & info) unsigned long long LocalStore::addValidPath(const ValidPathInfo & info, bool checkOutputs)
{ {
SQLiteStmtUse use(stmtRegisterValidPath); SQLiteStmtUse use(stmtRegisterValidPath);
stmtRegisterValidPath.bind(info.path); stmtRegisterValidPath.bind(info.path);
@ -540,7 +540,7 @@ unsigned long long LocalStore::addValidPath(const ValidPathInfo & info)
derivations). Note that if this throws an error, then the derivations). Note that if this throws an error, then the
DB transaction is rolled back, so the path validity DB transaction is rolled back, so the path validity
registration above is undone. */ registration above is undone. */
checkDerivationOutputs(info.path, drv); if (checkOutputs) checkDerivationOutputs(info.path, drv);
foreach (DerivationOutputs::iterator, i, drv.outputs) { foreach (DerivationOutputs::iterator, i, drv.outputs) {
SQLiteStmtUse use(stmtAddDerivationOutput); SQLiteStmtUse use(stmtAddDerivationOutput);
@ -1521,7 +1521,7 @@ void LocalStore::upgradeStore6()
SQLiteTxn txn(db); SQLiteTxn txn(db);
foreach (PathSet::iterator, i, validPaths) { foreach (PathSet::iterator, i, validPaths) {
addValidPath(queryPathInfoOld(*i)); addValidPath(queryPathInfoOld(*i), false);
std::cerr << "."; std::cerr << ".";
} }

View file

@ -226,7 +226,7 @@ private:
unsigned long long queryValidPathId(const Path & path); unsigned long long queryValidPathId(const Path & path);
unsigned long long addValidPath(const ValidPathInfo & info); unsigned long long addValidPath(const ValidPathInfo & info, bool checkOutputs = true);
void addReference(unsigned long long referrer, unsigned long long reference); void addReference(unsigned long long referrer, unsigned long long reference);