0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

fsync shouldn't be a noop on windows SERVER-728

This commit is contained in:
Mathias Stearn 2010-03-09 21:46:47 -05:00
parent 9172d692cd
commit ae02e61015

View File

@ -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;
}
}
}
}