summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFausto J Leyva <fausto.leyva@mongodb.com>2022-03-11 15:36:35 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-03-11 16:36:51 +0000
commitdb3d5680e8624326d902c9c1b51ce82e2f0a94d2 (patch)
treeda620856ad99f09447fc0c6b7c650be8d18dcf17
parente146ca34cbec7301ba1be1cc3c10c56a53a107fc (diff)
downloadmongo-db3d5680e8624326d902c9c1b51ce82e2f0a94d2.tar.gz
SERVER-61786 Determine if we can avoid global lock upgrade in IndexBuildsCoordinatorMongod::setCommitQuorum
-rw-r--r--src/mongo/db/index_builds_coordinator_mongod.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/mongo/db/index_builds_coordinator_mongod.cpp b/src/mongo/db/index_builds_coordinator_mongod.cpp
index 4232817b409..233e9df2fa1 100644
--- a/src/mongo/db/index_builds_coordinator_mongod.cpp
+++ b/src/mongo/db/index_builds_coordinator_mongod.cpp
@@ -777,7 +777,9 @@ Status IndexBuildsCoordinatorMongod::setCommitQuorum(OperationContext* opCtx,
<< nss << "' without providing any indexes.");
}
- AutoGetCollectionForRead collection(opCtx, nss);
+ // Take the MODE_IX lock now, so that when we actually persist the value later, we don't need to
+ // upgrade the lock.
+ AutoGetCollection collection(opCtx, nss, MODE_IX);
if (!collection) {
return Status(ErrorCodes::NamespaceNotFound,
str::stream() << "Collection '" << nss << "' was not found.");