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

don't profile if db was closed in interim

This commit is contained in:
Eliot Horowitz 2010-02-09 00:48:02 -05:00
parent eefff3bcc4
commit 76ca6a2887
2 changed files with 19 additions and 3 deletions

13
db/db.h
View File

@ -48,6 +48,17 @@ namespace mongo {
public:
DatabaseHolder() : _size(0){
}
bool isLoaded( const string& ns , const string& path ){
dbMutex.assertAtLeastReadLocked();
map<string,Database*>& m = _paths[path];
string db = _todb( ns );
map<string,Database*>::iterator it = m.find(db);
return it != m.end();
}
Database * get( const string& ns , const string& path ){
dbMutex.assertAtLeastReadLocked();
@ -116,7 +127,7 @@ namespace mongo {
}
}
}
private:
string _todb( const string& ns ){

View File

@ -365,8 +365,13 @@ namespace mongo {
}
else {
mongolock lk(true);
Client::Context c( currentOp.getNS() );
profile(ss.str().c_str(), ms);
if ( dbHolder.isLoaded( nsToDatabase( currentOp.getNS() ) , dbpath ) ){
Client::Context c( currentOp.getNS() );
profile(ss.str().c_str(), ms);
}
else {
mongo::log() << "warning: not profiling because db went away - probably a close on: " << currentOp.getNS() << endl;
}
}
}