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

debugging MINOR

This commit is contained in:
Eliot Horowitz 2010-02-04 22:51:57 -05:00
parent de8efe0a2a
commit 52427e60eb
3 changed files with 21 additions and 1 deletions

View File

@ -141,4 +141,18 @@ namespace mongo {
_client->_context = _oldContext; // note: _oldContext may be null
}
string Client::toString() const {
stringstream ss;
if ( _curOp )
ss << _curOp->infoNoauth().jsonString();
return ss.str();
}
string sayClientState(){
Client* c = currentClient.get();
if ( ! c )
return "no client";
return c->toString();
}
}

View File

@ -197,6 +197,8 @@ namespace mongo {
bool isGod() const { return _god; }
friend class CurOp;
string toString() const;
};
inline Client& cc() {
@ -240,6 +242,8 @@ namespace mongo {
cc().getContext()->unlocked();
}
}
string sayClientState();
};

View File

@ -23,6 +23,8 @@
namespace mongo {
string sayClientState();
/* mutex time stats */
class MutexInfo {
unsigned long long start, enter, timeLocked; // all in microseconds
@ -89,7 +91,7 @@ namespace mongo {
_state.set(s+1);
return;
}
massert( 10293 , "internal error: locks are not upgradeable", s == 0 );
massert( 10293 , (string)"internal error: locks are not upgradeable: " + sayClientState() , s == 0 );
_state.set(1);
_m.lock();
_minfo.entered();