diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2014-11-03 14:53:09 -0500 |
---|---|---|
committer | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2014-11-03 20:13:57 -0500 |
commit | 1ae3facefbfdb05d3369576611eb96fb1a303815 (patch) | |
tree | e2627d416c6e08bdc98b4702181d38b47e0386e1 /src/mongo/db/clientlistplugin.cpp | |
parent | a1cc3274956e0bc1a0fc7b7fb98724eb04423a03 (diff) | |
download | mongo-1ae3facefbfdb05d3369576611eb96fb1a303815.tar.gz |
SERVER-14462 Make db.currentOp report the currently held locks from the Lock Manager
Diffstat (limited to 'src/mongo/db/clientlistplugin.cpp')
-rw-r--r-- | src/mongo/db/clientlistplugin.cpp | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/src/mongo/db/clientlistplugin.cpp b/src/mongo/db/clientlistplugin.cpp index 833b704e07f..31381c87a16 100644 --- a/src/mongo/db/clientlistplugin.cpp +++ b/src/mongo/db/clientlistplugin.cpp @@ -34,6 +34,7 @@ #include "mongo/db/client.h" #include "mongo/db/commands.h" #include "mongo/db/curop.h" +#include "mongo/db/currentop_command.h" #include "mongo/db/global_environment_experiment.h" #include "mongo/db/matcher/expression_parser.h" #include "mongo/db/operation_context.h" @@ -59,7 +60,18 @@ namespace mongo { tablecell(_stringStream, co.opNum()); tablecell(_stringStream, co.active()); - // tablecell(_stringStream, txn->lockState()->reportState()); + + // LockState + { + Locker::LockerInfo lockerInfo; + txn->lockState()->getLockerInfo(&lockerInfo); + + BSONObjBuilder lockerInfoBuilder; + fillLockerInfo(lockerInfo, lockerInfoBuilder); + + tablecell(_stringStream, lockerInfoBuilder.obj()); + } + if (co.active()) { tablecell(_stringStream, co.elapsedSeconds()); } @@ -137,8 +149,18 @@ namespace { if ( txn->lockState() ) { StringBuilder ss; ss << txn->lockState(); - b.append( "lockStatePointer", ss.str() ); - // b.append( "lockState", txn->lockState()->reportState() ); + b.append("lockStatePointer", ss.str()); + + // LockState + { + Locker::LockerInfo lockerInfo; + txn->lockState()->getLockerInfo(&lockerInfo); + + BSONObjBuilder lockerInfoBuilder; + fillLockerInfo(lockerInfo, lockerInfoBuilder); + + b.append("lockState", lockerInfoBuilder.obj()); + } } if ( txn->recoveryUnit() ) txn->recoveryUnit()->reportState( &b ); |