diff options
author | Haley Connelly <haley.connelly@mongodb.com> | 2021-03-03 23:18:30 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-03-15 17:49:04 +0000 |
commit | 67ff8452c4172dbbfd2199df2dc349eb739b7bf1 (patch) | |
tree | 6ad799027d4c0cf81ff8366685a48da779f2fd97 /src/mongo/db/s/resharding/resharding_recipient_service.h | |
parent | 8f7f06898e9a9d4da95302f5e1ebe12e1a359586 (diff) | |
download | mongo-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.h | 13 |
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 |