summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Milkie <milkie@10gen.com>2012-04-30 13:42:02 -0400
committerEric Milkie <milkie@10gen.com>2012-07-27 10:26:05 -0400
commitc88805a6f6447458290719703887fb736692359e (patch)
treeb5edceb74fbc8f34a240526b995713a4589a3c3c
parent7542d7baa9f529a4dcf6bb7a0be162c8e6949607 (diff)
downloadmongo-c88805a6f6447458290719703887fb736692359e.tar.gz
SERVER-5680 fix Windows accvios due to incorrect recursive locking of MongoFiles
Conflicts: db/dur.cpp
-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 )