mirror of
https://github.com/NixOS/nix
synced 2025-07-05 04:01:47 +02:00
* In normaliseFState(), wrap registration of the output paths and the
normal form in a single transaction to ensure that if we crash, either everything is registered or nothing is. This is for recoverability: unregistered paths in the store can be deleted arbitrarily, while registered paths can only be deleted by running the garbage collector.
This commit is contained in:
parent
d99d04e644
commit
c95b4ad290
6 changed files with 44 additions and 28 deletions
|
@ -239,14 +239,16 @@ static void opSuccessor(Strings opFlags, Strings opArgs)
|
|||
{
|
||||
if (!opFlags.empty()) throw UsageError("unknown flag");
|
||||
if (opArgs.size() % 2) throw UsageError("expecting even number of arguments");
|
||||
|
||||
|
||||
Transaction txn(nixDB); /* !!! this could be a big transaction */
|
||||
for (Strings::iterator i = opArgs.begin();
|
||||
i != opArgs.end(); )
|
||||
{
|
||||
FSId id1 = parseHash(*i++);
|
||||
FSId id2 = parseHash(*i++);
|
||||
registerSuccessor(id1, id2);
|
||||
registerSuccessor(txn, id1, id2);
|
||||
}
|
||||
txn.commit();
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue