0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-30 17:10:48 +01:00

Make periodic data flushing synchronous SERVER-734

This commit is contained in:
Mathias Stearn 2010-03-15 13:50:10 -04:00
parent 93e9383c12
commit d8cbbd959e

View File

@ -427,15 +427,21 @@ namespace mongo {
public:
void run(){
log(1) << "will flush memory every: " << _sleepsecs << " seconds" << endl;
int time_flushing = 0;
while ( ! inShutdown() ){
if ( _sleepsecs == 0 ){
// in case at some point we add an option to change at runtime
sleepsecs(5);
continue;
}
sleepmillis( (int)(_sleepsecs * 1000) );
MemoryMappedFile::flushAll( false );
log(1) << "flushing mmap" << endl;
sleepmillis( (int)(std::max(0.0, (_sleepsecs * 1000) - time_flushing)) );
Date_t start = jsTime();
MemoryMappedFile::flushAll( true );
time_flushing = jsTime() - start;
log(1) << "flushing mmap took " << time_flushing << "ms" << endl;
}
}