From 3a99616968a7ffcc8f51bda7a781d3233aa9b428 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 9 Feb 2005 14:37:24 +0000 Subject: * Commit more often to prevent out-of-memory errors. --- src/libstore/store.cc | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/libstore/store.cc') diff --git a/src/libstore/store.cc b/src/libstore/store.cc index 5516dc8016c1..f73e993b880e 100644 --- a/src/libstore/store.cc +++ b/src/libstore/store.cc @@ -824,6 +824,7 @@ static void upgradeStore() PathSet validPaths(validPaths2.begin(), validPaths2.end()); cerr << "hashing paths..."; + int n = 0; for (PathSet::iterator i = validPaths.begin(); i != validPaths.end(); ++i) { checkInterrupt(); string s; @@ -832,10 +833,18 @@ static void upgradeStore() Hash hash = hashPath(htSHA256, *i); setHash(txn, *i, hash); cerr << "."; + if (++n % 1000 == 0) { + txn.commit(); + txn.begin(nixDB); + } } } cerr << "\n"; + txn.commit(); + + txn.begin(nixDB); + cerr << "processing closures..."; for (PathSet::iterator i = validPaths.begin(); i != validPaths.end(); ++i) { checkInterrupt(); -- cgit 1.4.1