about summary refs log tree commit diff
path: root/src/libstore/store.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2005-02-09T14·37+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2005-02-09T14·37+0000
commit3a99616968a7ffcc8f51bda7a781d3233aa9b428 (patch)
treee3c0fbc0856d868771b58b333006df670c7e9434 /src/libstore/store.cc
parent98df735b5149bc1e39ce6b0bae13fbf7cebcdc05 (diff)
* Commit more often to prevent out-of-memory errors.
Diffstat (limited to 'src/libstore/store.cc')
-rw-r--r--src/libstore/store.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libstore/store.cc b/src/libstore/store.cc
index 5516dc8016..f73e993b88 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();