summaryrefslogtreecommitdiff
path: root/src/mongo/db/s/sessions_collection_config_server.cpp
diff options
context:
space:
mode:
authorPaolo Polato <paolo.polato@mongodb.com>2022-12-16 14:17:20 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-12-16 14:47:25 +0000
commitf02a899583eb2502dee04b78c929754041cc834c (patch)
treebcd985223897d50dab6fe844fb18115c4ca543cd /src/mongo/db/s/sessions_collection_config_server.cpp
parentdbfcedabff1c0861fe6ff031b9b99b600abe1e49 (diff)
downloadmongo-f02a899583eb2502dee04b78c929754041cc834c.tar.gz
SERVER-72065 Use GlobalLock to invoke canAcceptWritesFor() in SessionsCollectionConfigServer
Diffstat (limited to 'src/mongo/db/s/sessions_collection_config_server.cpp')
-rw-r--r--src/mongo/db/s/sessions_collection_config_server.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/mongo/db/s/sessions_collection_config_server.cpp b/src/mongo/db/s/sessions_collection_config_server.cpp
index 9269281a5e5..882103b902a 100644
--- a/src/mongo/db/s/sessions_collection_config_server.cpp
+++ b/src/mongo/db/s/sessions_collection_config_server.cpp
@@ -28,7 +28,6 @@
*/
#include "mongo/db/s/sessions_collection_config_server.h"
-#include "mongo/db/catalog_raii.h"
#include "mongo/db/repl/replication_coordinator.h"
#include "mongo/logv2/log.h"
@@ -121,9 +120,9 @@ void SessionsCollectionConfigServer::setupSessionsCollection(OperationContext* o
_shardCollectionIfNeeded(opCtx);
_generateIndexesIfNeeded(opCtx);
- AutoGetCollection autoColl(opCtx, NamespaceString::kLogicalSessionsNamespace, MODE_IX);
+ Lock::GlobalLock lock(opCtx, MODE_IX);
if (const auto replCoord = repl::ReplicationCoordinator::get(opCtx);
- replCoord->canAcceptWritesFor(opCtx, NamespaceString::kLogicalSessionsNamespace)) {
+ replCoord->canAcceptWritesFor(opCtx, CollectionType::ConfigNS)) {
auto filterQuery =
BSON("_id" << NamespaceString::kLogicalSessionsNamespace.ns()
<< CollectionType::kMaxChunkSizeBytesFieldName << BSON("$exists" << false));