summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorTad Marshall <tad@10gen.com>2012-06-20 13:57:59 -0400
committerTad Marshall <tad@10gen.com>2012-06-20 13:57:59 -0400
commitf9828af52c7e44270c595a26383d146691f28fe0 (patch)
treedc4aeba282e7aff1b1899bd294554fe0c8bb1243 /db
parente3120a3fbdb8c24a5a8b0b595dcfed2ebee97022 (diff)
downloadmongo-f9828af52c7e44270c595a26383d146691f28fe0.tar.gz
SERVER-6132 makeChunkWritable abort on failure (Windows)
Diffstat (limited to 'db')
-rw-r--r--db/mongommf.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/db/mongommf.cpp b/db/mongommf.cpp
index 7c77ef80515..6e8c005335d 100644
--- a/db/mongommf.cpp
+++ b/db/mongommf.cpp
@@ -64,12 +64,21 @@ namespace mongo {
size_t protectSize = protectEnd - protectStart;
dassert(protectSize>0&&protectSize<=MemoryMappedFile::ChunkSize);
- DWORD old;
- bool ok = VirtualProtect((void*)protectStart, protectSize, PAGE_WRITECOPY, &old);
- if( !ok ) {
- DWORD e = GetLastError();
- log() << "VirtualProtect failed (mcw) " << mmf->filename() << ' ' << chunkno << hex << protectStart << ' ' << protectSize << ' ' << errnoWithDescription(e) << endl;
- assert(false);
+ DWORD oldProtection;
+ bool ok = VirtualProtect( reinterpret_cast<void*>( protectStart ),
+ protectSize,
+ PAGE_WRITECOPY,
+ &oldProtection );
+ if ( !ok ) {
+ DWORD dosError = GetLastError();
+ log() << "VirtualProtect for " << mmf->filename()
+ << " chunk " << chunkno
+ << " failed with " << errnoWithDescription( dosError )
+ << " (chunk size is " << protectSize
+ << ", address is " << hex << protectStart << dec << ")"
+ << " in mongo::makeChunkWritable, terminating"
+ << endl;
+ ::abort();
}
}