summaryrefslogtreecommitdiff
path: root/src/mongo/db/index_builds_coordinator.cpp
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-20 13:49:22 +0000
commit152ae38f2295f8f7996430ca119c8b861d55c303 (patch)
tree851bdcc6a81c6f6755a8c215975bf13456629e78 /src/mongo/db/index_builds_coordinator.cpp
parentbdeb7d80139abd91d3db4eaa29df796375096ec4 (diff)
downloadmongo-152ae38f2295f8f7996430ca119c8b861d55c303.tar.gz
SERVER-69530 Skip sharding DB check during index builds
Diffstat (limited to 'src/mongo/db/index_builds_coordinator.cpp')
-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 d4307107cb2..0342d563301 100644
--- a/src/mongo/db/index_builds_coordinator.cpp
+++ b/src/mongo/db/index_builds_coordinator.cpp
@@ -2718,7 +2718,11 @@ IndexBuildsCoordinator::CommitResult IndexBuildsCoordinator::_insertKeysFromSide
hangIndexBuildBeforeCommit.pauseWhileSet();
}
- AutoGetDb autoDb(opCtx, replState->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, replState->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.