summaryrefslogtreecommitdiff
path: root/src/mongo/util/mmap_win.cpp
diff options
context:
space:
mode:
authorEric Milkie <milkie@10gen.com>2012-07-09 16:28:24 -0400
committerEric Milkie <milkie@10gen.com>2012-07-09 16:29:35 -0400
commit1cd140e61ce33f0fb46f54332d62accaa587c67c (patch)
tree0d601c05c73b7f25212ebb2638d7babb15726b05 /src/mongo/util/mmap_win.cpp
parent39cb2b8ca7c931496840eafad3c36bc12472e99d (diff)
downloadmongo-1cd140e61ce33f0fb46f54332d62accaa587c67c.tar.gz
SERVER-6311 abort if FlushViewOfFile takes longer than 15 minutes
This avoids data corruption on Windows; the previous behavior gave up after 60 seconds and then blindly continued.
Diffstat (limited to 'src/mongo/util/mmap_win.cpp')
-rw-r--r--src/mongo/util/mmap_win.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/mongo/util/mmap_win.cpp b/src/mongo/util/mmap_win.cpp
index 2a334254e3f..784ab1d524f 100644
--- a/src/mongo/util/mmap_win.cpp
+++ b/src/mongo/util/mmap_win.cpp
@@ -356,10 +356,9 @@ namespace mongo {
bool success = false;
bool timeout = false;
int dosError = ERROR_SUCCESS;
- const int maximumLoopCount = 1000 * 1000;
- const int maximumTimeInSeconds = 60;
+ const int maximumTimeInSeconds = 60 * 15;
Timer t;
- while ( !success && !timeout && loopCount < maximumLoopCount ) {
+ while ( !success && !timeout ) {
++loopCount;
success = FALSE != FlushViewOfFile( _view, 0 );
if ( !success ) {
@@ -382,12 +381,15 @@ namespace mongo {
<< " after " << loopCount
<< " attempts taking " << t.millis()
<< " ms" << endl;
+ // Abort here to avoid data corruption
+ fassert(16387, false);
}
success = FALSE != FlushFileBuffers(_fd);
if (!success) {
int err = GetLastError();
out() << "FlushFileBuffers failed " << err << " file: " << _filename << endl;
+ fassert(16388, false);
}
}