diff options
author | Gregory Noma <gregory.noma@gmail.com> | 2023-01-31 18:15:59 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2023-01-31 19:59:46 +0000 |
commit | 35370b26c155a89a540137fe168da98175a431bf (patch) | |
tree | 152d6914ab298db28e67fe22f1e60c3c2b6b2086 /src/mongo | |
parent | 9afc315f73723d07c434fa738bdde25717bf7708 (diff) | |
download | mongo-35370b26c155a89a540137fe168da98175a431bf.tar.gz |
SERVER-73266 Avoid retaking RSTL without timeout at index build commit
Diffstat (limited to 'src/mongo')
-rw-r--r-- | src/mongo/db/index_builds_coordinator.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/mongo/db/index_builds_coordinator.cpp b/src/mongo/db/index_builds_coordinator.cpp index 9a52e7b8688..a35a9b45aaf 100644 --- a/src/mongo/db/index_builds_coordinator.cpp +++ b/src/mongo/db/index_builds_coordinator.cpp @@ -2829,8 +2829,6 @@ IndexBuildsCoordinator::CommitResult IndexBuildsCoordinator::_insertKeysFromSide // Need to return the collection lock back to exclusive mode to complete the index build. const NamespaceStringOrUUID dbAndUUID(replState->dbName, replState->collectionUUID); CollectionNamespaceOrUUIDLock collLock(opCtx, dbAndUUID, MODE_X); - AutoGetCollection indexBuildEntryColl( - opCtx, NamespaceString::kIndexBuildEntryNamespace, MODE_IX); // If we can't acquire the RSTL within a given time period, there is an active state transition // and we should release our locks and try again. We would otherwise introduce a deadlock with @@ -2852,6 +2850,9 @@ IndexBuildsCoordinator::CommitResult IndexBuildsCoordinator::_insertKeysFromSide return CommitResult::kLockTimeout; } + AutoGetCollection indexBuildEntryColl( + opCtx, NamespaceString::kIndexBuildEntryNamespace, MODE_IX); + // If we are no longer primary after receiving a commit quorum, we must restart and wait for a // new signal from a new primary because we cannot commit. Note that two-phase index builds can // retry because a new signal should be received. Single-phase builds will be unable to commit |