From 152ae38f2295f8f7996430ca119c8b861d55c303 Mon Sep 17 00:00:00 2001 From: Jordi Olivares Provencio Date: Tue, 20 Sep 2022 13:18:37 +0000 Subject: SERVER-69530 Skip sharding DB check during index builds --- src/mongo/db/index_builds_coordinator.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/mongo/db/index_builds_coordinator.cpp') 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. -- cgit v1.2.1