summaryrefslogtreecommitdiff
path: root/src/mongo/db/s/resharding/resharding_recipient_service.h
diff options
context:
space:
mode:
authorHaley Connelly <haley.connelly@mongodb.com>2021-03-03 23:18:30 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-03-15 17:49:04 +0000
commit67ff8452c4172dbbfd2199df2dc349eb739b7bf1 (patch)
tree6ad799027d4c0cf81ff8366685a48da779f2fd97 /src/mongo/db/s/resharding/resharding_recipient_service.h
parent8f7f06898e9a9d4da95302f5e1ebe12e1a359586 (diff)
downloadmongo-67ff8452c4172dbbfd2199df2dc349eb739b7bf1.tar.gz
SERVER-53931 Use cancelationTokens for resharding recipient replication components
Diffstat (limited to 'src/mongo/db/s/resharding/resharding_recipient_service.h')
-rw-r--r--src/mongo/db/s/resharding/resharding_recipient_service.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/mongo/db/s/resharding/resharding_recipient_service.h b/src/mongo/db/s/resharding/resharding_recipient_service.h
index 12411127e6c..1e667da7195 100644
--- a/src/mongo/db/s/resharding/resharding_recipient_service.h
+++ b/src/mongo/db/s/resharding/resharding_recipient_service.h
@@ -143,13 +143,14 @@ private:
ExecutorFuture<void> _cloneThenTransitionToApplying(
const std::shared_ptr<executor::ScopedTaskExecutor>& executor,
- const CancelationToken& cancelToken);
+ const CancelationToken& abortToken);
ExecutorFuture<void> _applyThenTransitionToSteadyState(
const std::shared_ptr<executor::ScopedTaskExecutor>& executor);
ExecutorFuture<void> _awaitAllDonorsBlockingWritesThenTransitionToStrictConsistency(
- const std::shared_ptr<executor::ScopedTaskExecutor>& executor);
+ const std::shared_ptr<executor::ScopedTaskExecutor>& executor,
+ const CancelationToken& abortToken);
ExecutorFuture<void> _awaitCoordinatorHasDecisionPersistedThenTransitionToRenaming(
const std::shared_ptr<executor::ScopedTaskExecutor>& executor);
@@ -195,6 +196,11 @@ private:
// (abort resharding).
void _onAbortOrStepdown(WithLock, Status status);
+ // Initializes the _abortSource and generates a token from it to return back the caller.
+ //
+ // Should only be called once per lifetime.
+ CancelationToken _initAbortSource(const CancelationToken& stepdownToken);
+
// The in-memory representation of the immutable portion of the document in
// config.localReshardingOperations.recipient.
const CommonReshardingMetadata _metadata;
@@ -220,6 +226,9 @@ private:
// Protects the promises below
Mutex _mutex = MONGO_MAKE_LATCH("RecipientStateMachine::_mutex");
+ // Canceled when there is an unrecoverable error or stepdown.
+ boost::optional<CancelationSource> _abortSource;
+
boost::optional<ReshardingCriticalSection> _critSec;
// Each promise below corresponds to a state on the recipient state machine. They are listed in