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:
parent
eefff3bcc4
commit
76ca6a2887
13
db/db.h
13
db/db.h
@ -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 ){
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user