summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
Diffstat (limited to 'db')
-rw-r--r--db/dur.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/db/dur.cpp b/db/dur.cpp
index 3e2c3ecea56..b39dea0b5af 100644
--- a/db/dur.cpp
+++ b/db/dur.cpp
@@ -434,7 +434,17 @@ namespace mongo {
fraction = 1;
lastRemap = now;
+#if defined(_WIN32)
+ // Note that this negatively affects performance.
+ // We must grab the exclusive lock here because remapThePrivateView() on Windows needs
+ // to grab it as well, due to the lack of a non-atomic way to remap a memory mapped file.
+ // See SERVER-5723 for performance improvement.
+ // See SERVER-5680 to see why this code is necessary.
+ RWLockRecursive::Exclusive lk(MongoFile::mmmutex);
+#else
RWLockRecursive::Shared lk(MongoFile::mmmutex);
+#endif
+
set<MongoFile*>& files = MongoFile::getAllFiles();
unsigned sz = files.size();
if( sz == 0 )