summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDidier Nadeau <didier.nadeau@mongodb.com>2022-05-31 20:35:51 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-05-31 21:16:15 +0000
commit7cdbf7f7ddc77ee5ffe13f1c476ba0a1f2592730 (patch)
treef321fbace5820f2cb006ba431bf81e6797d9064b /src
parent0abdf7bc75257ecd6d01dd701fb78208c1eb6d5e (diff)
downloadmongo-7cdbf7f7ddc77ee5ffe13f1c476ba0a1f2592730.tar.gz
SERVER-66862 Fix non-determinism in shard_split_startup_recovery_aborted.js
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/serverless/shard_split_donor_service.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/mongo/db/serverless/shard_split_donor_service.cpp b/src/mongo/db/serverless/shard_split_donor_service.cpp
index 24fa4543626..0b166144d7f 100644
--- a/src/mongo/db/serverless/shard_split_donor_service.cpp
+++ b/src/mongo/db/serverless/shard_split_donor_service.cpp
@@ -428,13 +428,17 @@ SemiFuture<void> ShardSplitDonorService::DonorStateMachine::run(
return DurableState{_stateDoc.getState(), _abortReason};
})
// anchor ensures the instance will still exists even if the primary stepped down
- .onError([this, executor, primaryToken, abortToken, anchor = shared_from_this()](
- StatusWith<DurableState> statusWithState) {
+ .onCompletion([this, executor, primaryToken, abortToken, anchor = shared_from_this()](
+ StatusWith<DurableState> statusWithState) {
// only cancel operations on stepdown from here out
_cancelableOpCtxFactory.emplace(primaryToken, _markKilledExecutor);
- return _handleErrorOrEnterAbortedState(
- statusWithState, executor, primaryToken, abortToken);
+ if (!statusWithState.isOK()) {
+ return _handleErrorOrEnterAbortedState(
+ statusWithState, executor, primaryToken, abortToken);
+ }
+
+ return ExecutorFuture(**executor, statusWithState);
})
.unsafeToInlineFuture();
});