From 25de80e2b61208850c4a39d8ee44967ada8f040e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?= Date: Thu, 22 Mar 2012 19:57:42 +0100 Subject: [PATCH 1/2] Adding a nix option to sync before registering a path, for non-ext* filesystems. --- src/libstore/local-store.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc index f3b779dd0..950e6e760 100644 --- a/src/libstore/local-store.cc +++ b/src/libstore/local-store.cc @@ -968,6 +968,8 @@ void LocalStore::registerValidPath(const ValidPathInfo & info) void LocalStore::registerValidPaths(const ValidPathInfos & infos) { + if (queryBoolSetting("sync-before-registering", true)) + sync(); while (1) { try { SQLiteTxn txn(db); From 85799bf89ed2649d7f3e2298de0478c50a71776d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?= Date: Thu, 22 Mar 2012 20:05:54 +0100 Subject: [PATCH 2/2] Fixing the default of sync-before-registering Setting 'false' as default, as suggested by Eelco. I also added a comment about the setting in the code. --- src/libstore/local-store.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc index 950e6e760..ca541e1cc 100644 --- a/src/libstore/local-store.cc +++ b/src/libstore/local-store.cc @@ -968,8 +968,12 @@ void LocalStore::registerValidPath(const ValidPathInfo & info) void LocalStore::registerValidPaths(const ValidPathInfos & infos) { - if (queryBoolSetting("sync-before-registering", true)) + /* 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);