about summary refs log tree commit diff
path: root/src/libstore/local-store.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2012-04-23T10·29-0700
committerEelco Dolstra <e.dolstra@tudelft.nl>2012-04-23T10·29-0700
commit6387830c3b12722e5962a99aa81f225ea0830076 (patch)
treeed3e8c6b02f7dc4bb030dbfef35d9a34158015a9 /src/libstore/local-store.cc
parent259c6d3fbb1298488cc9d437ae81f313dba585fd (diff)
parent85799bf89ed2649d7f3e2298de0478c50a71776d (diff)
Merge pull request #2 from viric/master
Again, adding the sync option
Diffstat (limited to 'src/libstore/local-store.cc')
-rw-r--r--src/libstore/local-store.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc
index 1ab9d15eb66b..f04436b7f659 100644
--- a/src/libstore/local-store.cc
+++ b/src/libstore/local-store.cc
@@ -968,6 +968,12 @@ void LocalStore::registerValidPath(const ValidPathInfo & info)
 
 void LocalStore::registerValidPaths(const ValidPathInfos & infos)
 {
+    /* sqlite will fsync by default, but the new valid paths may not be fsync-ed.
+     * So some may want to fsync them before registering the validity, at the
+     * expense of some speed of the path registering operation. */
+    if (queryBoolSetting("sync-before-registering", false))
+        sync();
+
     while (1) {
         try {
             SQLiteTxn txn(db);