summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands/lock_info.cpp
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2019-10-11 19:19:38 +0000
committerevergreen <evergreen@mongodb.com>2019-10-11 19:19:38 +0000
commitcf4c944977a348494d81eeaf7eddb96ef0457876 (patch)
tree2f038795f6dcd631a6391de6cc1bbb12c7b40f85 /src/mongo/db/commands/lock_info.cpp
parent6b345cce214efb1b3f9dcffc2f25a833d1caa100 (diff)
downloadmongo-cf4c944977a348494d81eeaf7eddb96ef0457876.tar.gz
SERVER-43910 lockInfo command obtains lock to client info mapping from LockManager
Diffstat (limited to 'src/mongo/db/commands/lock_info.cpp')
-rw-r--r--src/mongo/db/commands/lock_info.cpp22
1 files changed, 1 insertions, 21 deletions
diff --git a/src/mongo/db/commands/lock_info.cpp b/src/mongo/db/commands/lock_info.cpp
index cb820b02fe8..344d31faaaa 100644
--- a/src/mongo/db/commands/lock_info.cpp
+++ b/src/mongo/db/commands/lock_info.cpp
@@ -80,27 +80,7 @@ public:
const string& dbname,
const BSONObj& jsobj,
BSONObjBuilder& result) {
- std::map<LockerId, BSONObj> lockToClientMap;
-
- for (ServiceContext::LockedClientsCursor cursor(opCtx->getClient()->getServiceContext());
- Client* client = cursor.next();) {
- invariant(client);
-
- stdx::lock_guard<Client> lk(*client);
- const OperationContext* clientOpCtx = client->getOperationContext();
-
- // Operation context specific information
- if (clientOpCtx) {
- BSONObjBuilder infoBuilder;
- // The client information
- client->reportState(infoBuilder);
-
- infoBuilder.append("opid", static_cast<int>(clientOpCtx->getOpID()));
- LockerId lockerId = clientOpCtx->lockState()->getId();
- lockToClientMap.insert({lockerId, infoBuilder.obj()});
- }
- }
-
+ auto lockToClientMap = LockManager::getLockToClientMap(opCtx->getServiceContext());
getGlobalLockManager()->getLockInfoBSON(lockToClientMap, &result);
return true;
}