]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#9618 fix Windows WRITEMAP flush
authorKris Zyp <kriszyp@gmail.com>
Wed, 28 Jul 2021 21:03:13 +0000 (15:03 -0600)
committerHoward Chu <hyc@openldap.org>
Wed, 28 Jul 2021 21:56:08 +0000 (22:56 +0100)
Revert back to using standard FlushViewOfFile/FlushFileBuffers
to sync data with WRITEMAP mode on Windows

libraries/liblmdb/mdb.c

index a6cc3ab60f2d25d5a57801d8e2aad2959d9ca43d..72c4c437ffc2076e3bfdffd1ee90a83e3a127b1a 100644 (file)
@@ -3008,9 +3008,9 @@ mdb_env_sync0(MDB_env *env, int force, pgno_t numpgs)
        int rc = 0;
        if (env->me_flags & MDB_RDONLY)
                return EACCES;
-       if (force
-#ifndef _WIN32 /* Sync is normally achieved in Windows by doing WRITE_THROUGH writes */
-               || !(env->me_flags & MDB_NOSYNC)
+       if (force || !(env->me_flags & MDB_NOSYNC)
+#ifdef _WIN32  /* Sync is normally achieved in Windows by doing WRITE_THROUGH writes */
+               && (env->me_flags & MDB_WRITEMAP)
 #endif
                ) {
                if (env->me_flags & MDB_WRITEMAP) {
@@ -3958,13 +3958,7 @@ mdb_page_flush(MDB_txn *txn, int keep)
 
        j = i = keep;
 
-       if (env->me_flags & MDB_WRITEMAP
-#ifdef _WIN32
-               /* In windows, we still do writes to the file (with write-through enabled in sync mode),
-                * as this is faster than FlushViewOfFile/FlushFileBuffers */
-               && (env->me_flags & MDB_NOSYNC)
-#endif
-       ) {
+       if (env->me_flags & MDB_WRITEMAP) {
                goto done;
        }