diff options
author | Gregory Wlodarek <gregory.wlodarek@mongodb.com> | 2021-05-11 18:10:40 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-05-12 00:30:15 +0000 |
commit | 100811c3e5cc533c922e23ede0e5935eabc5da0c (patch) | |
tree | 7735fce749d60385417494e71563dd7783648c67 /src/mongo/db/index_builds_coordinator.cpp | |
parent | 6e34f5094204aaf9bf14b51252ab347b4035b584 (diff) | |
download | mongo-100811c3e5cc533c922e23ede0e5935eabc5da0c.tar.gz |
SERVER-56733 Index builds must set the PrepareConflictBehavior::kIgnoreConflictsAllowWrites flag on the RecoveryUnit on resume in the drain phase
Diffstat (limited to 'src/mongo/db/index_builds_coordinator.cpp')
-rw-r--r-- | src/mongo/db/index_builds_coordinator.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/mongo/db/index_builds_coordinator.cpp b/src/mongo/db/index_builds_coordinator.cpp index 9e3a9a8f059..ba9d2d46a56 100644 --- a/src/mongo/db/index_builds_coordinator.cpp +++ b/src/mongo/db/index_builds_coordinator.cpp @@ -2091,6 +2091,11 @@ void IndexBuildsCoordinator::_runIndexBuildInner( hangAfterInitializingIndexBuild.pauseWhileSet(opCtx); + // Index builds can safely ignore prepare conflicts and perform writes. On secondaries, + // prepare operations wait for index builds to complete. + opCtx->recoveryUnit()->setPrepareConflictBehavior( + PrepareConflictBehavior::kIgnoreConflictsAllowWrites); + if (resumeInfo) { _resumeIndexBuildFromPhase(opCtx, replState, indexBuildOptions, resumeInfo.get()); } else { @@ -2370,11 +2375,6 @@ CollectionPtr IndexBuildsCoordinator::_setUpForScanCollectionAndInsertSortedKeys // Set up the thread's currentOp information to display createIndexes cmd information. updateCurOpOpDescription(opCtx, collection->ns(), replState->indexSpecs); - // Index builds can safely ignore prepare conflicts and perform writes. On secondaries, - // prepare operations wait for index builds to complete. - opCtx->recoveryUnit()->setPrepareConflictBehavior( - PrepareConflictBehavior::kIgnoreConflictsAllowWrites); - return collection; } |