about summary refs log tree commit diff
path: root/src/libstore/store.cc
diff options
context:
space:
mode:
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 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();