diff --git a/db/client.cpp b/db/client.cpp index c62e5490d0e..8ac5006348f 100644 --- a/db/client.cpp +++ b/db/client.cpp @@ -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(); + } + } diff --git a/db/client.h b/db/client.h index 420293348a7..05cca1b1501 100644 --- a/db/client.h +++ b/db/client.h @@ -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(); }; diff --git a/db/concurrency.h b/db/concurrency.h index 9f256f5a10d..b8d9334895c 100644 --- a/db/concurrency.h +++ b/db/concurrency.h @@ -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();