Browse Source
SERVER-84229 Move LockManager::getLockerToClientMap out of the LockManager
SERVER-84229 Move LockManager::getLockerToClientMap out of the LockManager
GitOrigin-RevId: 1ee5e8a02a
pull/1587/head
committed by
MongoDB Bot
40 changed files with 382 additions and 281 deletions
-
4src/mongo/client/SConscript
-
4src/mongo/crypto/SConscript
-
85src/mongo/db/SConscript
-
31src/mongo/db/auth/SConscript
-
5src/mongo/db/catalog/SConscript
-
2src/mongo/db/commands/SConscript
-
27src/mongo/db/commands/lock_info.cpp
-
2src/mongo/db/concurrency/d_concurrency.cpp
-
3src/mongo/db/concurrency/d_concurrency.h
-
32src/mongo/db/concurrency/lock_manager.cpp
-
26src/mongo/db/concurrency/lock_manager.h
-
2src/mongo/db/concurrency/locker.cpp
-
6src/mongo/db/concurrency/locker.h
-
24src/mongo/db/concurrency/locker_impl.cpp
-
129src/mongo/db/concurrency/locker_impl.h
-
35src/mongo/db/dump_lock_manager_impl.cpp
-
46src/mongo/db/dump_lock_manager_impl.h
-
5src/mongo/db/ftdc/SConscript
-
1src/mongo/db/index/SConscript
-
1src/mongo/db/op_observer/SConscript
-
5src/mongo/db/pipeline/SConscript
-
3src/mongo/db/process_health/SConscript
-
1src/mongo/db/query/SConscript
-
19src/mongo/db/repl/SConscript
-
2src/mongo/db/s/SConscript
-
2src/mongo/db/session/SConscript
-
8src/mongo/db/storage/SConscript
-
1src/mongo/db/storage/wiredtiger/SConscript
-
3src/mongo/db/transaction_resources_init_mongod.cpp
-
3src/mongo/db/transaction_resources_init_non_mongod.cpp
-
8src/mongo/rpc/SConscript
-
5src/mongo/s/SConscript
-
3src/mongo/s/query/SConscript
-
2src/mongo/s/sharding_state.cpp
-
9src/mongo/scripting/SConscript
-
2src/mongo/transport/SConscript
-
82src/mongo/util/SConscript
-
14src/mongo/util/cryptd/SConscript
-
16src/mongo/util/net/SConscript
-
5src/mongo/watchdog/SConscript
@ -29,10 +29,14 @@ |
|||||
|
|
||||
#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kDefault
|
#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kDefault
|
||||
|
|
||||
#include "mongo/db/dump_lock_manager.h"
|
|
||||
|
#include "mongo/db/dump_lock_manager_impl.h"
|
||||
|
|
||||
#include "mongo/base/shim.h"
|
#include "mongo/base/shim.h"
|
||||
|
#include "mongo/db/client.h"
|
||||
#include "mongo/db/concurrency/lock_manager.h"
|
#include "mongo/db/concurrency/lock_manager.h"
|
||||
|
#include "mongo/db/dump_lock_manager.h"
|
||||
|
#include "mongo/db/locker_api.h"
|
||||
|
#include "mongo/db/operation_context.h"
|
||||
#include "mongo/db/service_context.h"
|
#include "mongo/db/service_context.h"
|
||||
#include "mongo/logv2/log.h"
|
#include "mongo/logv2/log.h"
|
||||
|
|
||||
@ -53,7 +57,7 @@ void dumpLockManagerImpl() { |
|||||
auto lockManager = LockManager::get(service); |
auto lockManager = LockManager::get(service); |
||||
|
|
||||
BSONArrayBuilder locks; |
BSONArrayBuilder locks; |
||||
lockManager->getLockInfoArray(LockManager::getLockToClientMap(service), true, nullptr, &locks); |
|
||||
|
lockManager->getLockInfoArray(getLockerIdToClientMap(service), true, nullptr, &locks); |
||||
LOGV2_OPTIONS(20521, |
LOGV2_OPTIONS(20521, |
||||
logv2::LogTruncation::Disabled, |
logv2::LogTruncation::Disabled, |
||||
"lock manager dump", |
"lock manager dump", |
||||
@ -63,5 +67,32 @@ void dumpLockManagerImpl() { |
|||||
|
|
||||
auto dumpLockManagerRegistration = |
auto dumpLockManagerRegistration = |
||||
MONGO_WEAK_FUNCTION_REGISTRATION(dumpLockManager, dumpLockManagerImpl); |
MONGO_WEAK_FUNCTION_REGISTRATION(dumpLockManager, dumpLockManagerImpl); |
||||
|
|
||||
} // namespace
|
} // namespace
|
||||
|
|
||||
|
std::map<LockerId, BSONObj> getLockerIdToClientMap(ServiceContext* serviceContext) { |
||||
|
std::map<LockerId, BSONObj> lockToClientMap; |
||||
|
|
||||
|
for (ServiceContext::LockedClientsCursor cursor(serviceContext); |
||||
|
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(HTTP/1.0 200 OK
Content-Type: text/html; charset=UTF-8
Set-Cookie: i_like_gitea=632b81304220b716; Path=/; HttpOnly; SameSite=Lax
Set-Cookie: _csrf=REOnvs3c9Ce8zEmxJt6Utqn3FAE6MTc4NTkxMjkyMjgwNDkyNzg0Mg; Path=/; Expires=Thu, 06 Aug 2026 06:55:22 GMT; HttpOnly; SameSite=Lax
Set-Cookie: macaron_flash=; Path=/; Max-Age=0; HttpOnly; SameSite=Lax
X-Frame-Options: SAMEORIGIN
Date: Wed, 05 Aug 2026 06:55:42 GMT
| ||||