diff options
Diffstat (limited to 'src/mongo/db')
-rw-r--r-- | src/mongo/db/index_builds_coordinator.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/mongo/db/index_builds_coordinator.cpp b/src/mongo/db/index_builds_coordinator.cpp index dfd59f9f620..9bd1677a4d6 100644 --- a/src/mongo/db/index_builds_coordinator.cpp +++ b/src/mongo/db/index_builds_coordinator.cpp @@ -1132,8 +1132,11 @@ bool IndexBuildsCoordinator::abortIndexBuildByBuildUUID(OperationContext* opCtx, invariant(opCtx->lockState()->isRSTLLocked()); // Override the 'signalAction' as this is an initial syncing node. + // Don't override it if it's a rollback abort which would be explictly requested + // by the initial sync code. auto replCoord = repl::ReplicationCoordinator::get(opCtx); - if (replCoord->getMemberState().startup2()) { + if (replCoord->getMemberState().startup2() && + IndexBuildAction::kRollbackAbort != signalAction) { LOGV2_DEBUG(4665902, 1, "Overriding abort 'signalAction' for initial sync", @@ -1276,7 +1279,10 @@ void IndexBuildsCoordinator::_completeAbort(OperationContext* opCtx, } case IndexBuildAction::kRollbackAbort: { invariant(replState->protocol == IndexBuildProtocol::kTwoPhase); - invariant(replCoord->getMemberState().rollback()); + // File copy based initial sync does a rollback-like operation, so we allow STARTUP2 + // to abort as well as rollback. + invariant(replCoord->getMemberState().rollback() || + replCoord->getMemberState().startup2()); // Defer cleanup until builder thread is joined. break; } |