diff options
Diffstat (limited to 'src/mongo/db/serverless/shard_split_donor_service.cpp')
-rw-r--r-- | src/mongo/db/serverless/shard_split_donor_service.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/mongo/db/serverless/shard_split_donor_service.cpp b/src/mongo/db/serverless/shard_split_donor_service.cpp index 4c3fdabb39f..97eecdae6d1 100644 --- a/src/mongo/db/serverless/shard_split_donor_service.cpp +++ b/src/mongo/db/serverless/shard_split_donor_service.cpp @@ -1005,7 +1005,14 @@ ExecutorFuture<repl::OpTime> ShardSplitDonorService::DonorStateMachine::_updateS return repl::ReplClientInfo::forClient(opCtx->getClient()).getLastOp(); }) - .until([](StatusWith<repl::OpTime> swOpTime) { return swOpTime.getStatus().isOK(); }) + .until([&](StatusWith<repl::OpTime> swOpTime) { + if (swOpTime.getStatus().code() == ErrorCodes::ConflictingServerlessOperation) { + stdx::lock_guard<Latch> lg(_mutex); + + uassertStatusOK(swOpTime); + } + return swOpTime.getStatus().isOK(); + }) .withBackoffBetweenIterations(kExponentialBackoff) .on(**executor, token); } @@ -1094,6 +1101,11 @@ ShardSplitDonorService::DonorStateMachine::_handleErrorOrEnterAbortedState( "Entering 'aborted' state.", "id"_attr = _migrationId, "abortReason"_attr = _abortReason.value()); + + if (_abortReason->code() == ErrorCodes::ConflictingServerlessOperation) { + return ExecutorFuture(**executor, + DurableState{ShardSplitDonorStateEnum::kAborted, _abortReason}); + } } return ExecutorFuture<void>(**executor) @@ -1113,7 +1125,8 @@ ExecutorFuture<void> ShardSplitDonorService::DonorStateMachine::_waitForForgetCmdThenMarkGarbageCollectable( const ScopedTaskExecutorPtr& executor, const CancellationToken& primaryToken) { stdx::lock_guard<Latch> lg(_mutex); - if (_stateDoc.getExpireAt()) { + if (_stateDoc.getExpireAt() || + (_abortReason && _abortReason->code() == ErrorCodes::ConflictingServerlessOperation)) { return ExecutorFuture(**executor); } |