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

more verbose shutdown logging to try and figure out why shutdown is very slow sometimes

This commit is contained in:
Eliot Horowitz 2009-10-05 15:09:52 -04:00
parent 27fd0a7a9f
commit 727fc307f9
2 changed files with 10 additions and 2 deletions

View File

@ -688,18 +688,22 @@ namespace mongo {
} }
#endif #endif
log() << "\t shutdown: going to flush oplog..." << endl;
stringstream ss2; stringstream ss2;
flushOpLog( ss2 ); flushOpLog( ss2 );
rawOut( ss2.str() ); rawOut( ss2.str() );
/* must do this before unmapping mem or you may get a seg fault */ /* must do this before unmapping mem or you may get a seg fault */
log() << "\t shutdown: going to close sockets..." << endl;
closeAllSockets(); closeAllSockets();
// wait until file preallocation finishes // wait until file preallocation finishes
// we would only hang here if the file_allocator code generates a // we would only hang here if the file_allocator code generates a
// synchronous signal, which we don't expect // synchronous signal, which we don't expect
log() << "\t shutdown: waiting for fs..." << endl;
theFileAllocator().waitUntilFinished(); theFileAllocator().waitUntilFinished();
log() << "\t shutdown: closing all files..." << endl;
stringstream ss3; stringstream ss3;
MemoryMappedFile::closeAllFiles( ss3 ); MemoryMappedFile::closeAllFiles( ss3 );
rawOut( ss3.str() ); rawOut( ss3.str() );
@ -709,6 +713,7 @@ namespace mongo {
#if !defined(_WIN32) && !defined(__sunos__) #if !defined(_WIN32) && !defined(__sunos__)
if ( lockFile ){ if ( lockFile ){
log() << "\t shutdown: removing fs lock..." << endl;
assert( ftruncate( lockFile , 0 ) == 0 ); assert( ftruncate( lockFile , 0 ) == 0 );
flock( lockFile, LOCK_UN ); flock( lockFile, LOCK_UN );
} }

View File

@ -40,8 +40,11 @@ namespace mongo {
return; return;
} }
++closingAllFiles; ++closingAllFiles;
for ( set<MemoryMappedFile*>::iterator i = mmfiles.begin(); i != mmfiles.end(); i++ ) ProgressMeter pm( mmfiles.size() , 2 , 1 );
for ( set<MemoryMappedFile*>::iterator i = mmfiles.begin(); i != mmfiles.end(); i++ ){
(*i)->close(); (*i)->close();
pm.hit();
}
message << " closeAllFiles() finished" << endl; message << " closeAllFiles() finished" << endl;
--closingAllFiles; --closingAllFiles;
} }