SERVER-123576: Update invariants when aborting index builds (#51311)
GitOrigin-RevId: 6cfd78603116a68cfc3fcf507fba0f204f222507
This commit is contained in:
parent
63030c789e
commit
41aa505fe8
@ -1770,7 +1770,8 @@ void IndexBuildsCoordinator::_completeAbort(OperationContext* opCtx,
|
||||
}
|
||||
// Deletes the index from the durable catalog.
|
||||
case IndexBuildAction::kInitialSyncAbort: {
|
||||
invariant(replState->protocol == IndexBuildProtocol::kTwoPhase);
|
||||
invariant(replState->protocol == IndexBuildProtocol::kTwoPhase ||
|
||||
replState->protocol == IndexBuildProtocol::kPrimaryDriven);
|
||||
invariant(replCoord->getMemberState().startup2());
|
||||
|
||||
bool isPrimary = replCoord->canAcceptWritesFor(opCtx, nss);
|
||||
@ -1788,14 +1789,16 @@ void IndexBuildsCoordinator::_completeAbort(OperationContext* opCtx,
|
||||
}
|
||||
// Deletes the index from the durable catalog.
|
||||
case IndexBuildAction::kOplogAbort: {
|
||||
invariant(IndexBuildProtocol::kTwoPhase == replState->protocol);
|
||||
invariant(IndexBuildProtocol::kTwoPhase == replState->protocol ||
|
||||
IndexBuildProtocol::kPrimaryDriven == replState->protocol);
|
||||
replState->onOplogAbort(opCtx, nss);
|
||||
_indexBuildsManager.abortIndexBuild(
|
||||
opCtx, coll, replState->buildUUID, MultiIndexBlock::kNoopOnCleanUpFn);
|
||||
break;
|
||||
}
|
||||
case IndexBuildAction::kRollbackAbort: {
|
||||
invariant(replState->protocol == IndexBuildProtocol::kTwoPhase);
|
||||
invariant(replState->protocol == IndexBuildProtocol::kTwoPhase ||
|
||||
replState->protocol == IndexBuildProtocol::kPrimaryDriven);
|
||||
// File copy based initial sync does a rollback-like operation, so we allow STARTUP2
|
||||
// to abort as well as rollback.
|
||||
invariant(replCoord->getMemberState().rollback() ||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user