summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordi Olivares Provencio <jordi.olivares-provencio@mongodb.com>2022-09-20 13:18:37 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-09-28 13:41:46 +0000
commit619c6e89ea3f1e62bded8cda5c6902767aa48c71 (patch)
tree7cdee9b4092404acfde4182e70691ff1daa125c8
parent2af7b4b1a2439308ba4b2fc6596c0cc03ff99b55 (diff)
downloadmongo-619c6e89ea3f1e62bded8cda5c6902767aa48c71.tar.gz
SERVER-69530 Skip sharding DB check during index builds
-rw-r--r--src/mongo/db/index_builds_coordinator.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/mongo/db/index_builds_coordinator.cpp b/src/mongo/db/index_builds_coordinator.cpp
index a8494b8215e..0cf8bf00c6a 100644
--- a/src/mongo/db/index_builds_coordinator.cpp
+++ b/src/mongo/db/index_builds_coordinator.cpp
@@ -2702,7 +2702,11 @@ IndexBuildsCoordinator::CommitResult IndexBuildsCoordinator::_insertKeysFromSide
// TODO SERVER-67437 Once ReplIndexBuildState holds DatabaseName, use dbName directly for
// lock
DatabaseName dbName(boost::none, replState->dbName);
- AutoGetDb autoDb(opCtx, dbName, MODE_IX);
+ // Skip the check for sharding's critical section check as it can only be acquired during a
+ // `movePrimary` or drop database operations. The only operation that would affect the index
+ // build is when the collection's data needs to get modified, but the only modification possible
+ // is to delete the entire collection, which will cause the index to be dropped.
+ Lock::DBLock dbLock(opCtx, dbName, MODE_IX);
// Unlock RSTL to avoid deadlocks with prepare conflicts and state transitions caused by waiting
// for a a strong collection lock. See SERVER-42621.