From 15c60ca1b64a4e5dc874f60c764f0ccc8899d740 Mon Sep 17 00:00:00 2001
From: Eelco Dolstra <e.dolstra@tudelft.nl>
Date: Mon, 21 Jun 2004 07:36:01 +0000
Subject: [PATCH] * Disable calls to fsync() since Berkeley DB's
 DB_TXN_WRITE_NOSYNC   flag doesn't seem to work as advertised.

---
 src/libstore/db.cc | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/libstore/db.cc b/src/libstore/db.cc
index 8c0678d0e..e792a371b 100644
--- a/src/libstore/db.cc
+++ b/src/libstore/db.cc
@@ -146,6 +146,12 @@ void openEnv(DbEnv * env, const string & path, u_int32_t flags)
 }
 
 
+static int my_fsync(int fd)
+{
+    return 0;
+}
+
+
 void Database::open(const string & path)
 {
     if (env) throw Error(format("environment already open"));
@@ -164,6 +170,8 @@ void Database::open(const string & path)
         env->set_lk_detect(DB_LOCK_DEFAULT);
         env->set_flags(DB_TXN_WRITE_NOSYNC | DB_LOG_AUTOREMOVE, 1);
         
+        db_env_set_func_fsync(my_fsync);
+        
 
         /* The following code provides automatic recovery of the
            database environment.  Recovery is necessary when a process
-- 
GitLab