diff options
author | Mathias Stearn <mathias@10gen.com> | 2010-03-10 13:39:37 -0500 |
---|---|---|
committer | Mathias Stearn <mathias@10gen.com> | 2010-03-10 13:39:37 -0500 |
commit | 639c39189fefbab21580e10695289e44cbb65bc2 (patch) | |
tree | 57195c5909293f04c820aeb0dcb268ebd105b678 | |
parent | 7c4cd36d0a306f5f2a77b8585836d96e356da92b (diff) | |
download | mongo-639c39189fefbab21580e10695289e44cbb65bc2.tar.gz |
fsync shouldn't be a noop on windows SERVER-728 (backport to 1.2)
(cherry picked from commit ae02e6101528a5f748da95ce6abbed5c6499bcaf)
-rw-r--r-- | util/mmap_win.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/util/mmap_win.cpp b/util/mmap_win.cpp index b48bb156c53..bbb7d873986 100644 --- a/util/mmap_win.cpp +++ b/util/mmap_win.cpp @@ -99,7 +99,22 @@ namespace mongo { return view; } - void MemoryMappedFile::flush(bool) { - } + void MemoryMappedFile::flush(bool sync) { + if (!view) return; + + // Note: this is blocking and ignores sync + bool success = FlushViewOfFile(view, 0); // 0 means whole mapping + if (!success){ + int err = GetLastError(); + out() << "FlushViewOfFile failed " << err << " " << endl; + } + if (sync){ + bool success = FlushFileBuffers(fd); + if (!success){ + int err = GetLastError(); + out() << "FlushFileBuffers failed " << err << " " << endl; + } + } + } } |