|
max.hirschhorn points out that I've accidentally omitted two more PrimaryOnlyServices (thanks Max!): ReshardingDonorService and ReshardingRecipientService.
Per file, the functions that need to be modified to support cancellation are:
ReshardingDonorService
// These can all be modified in place by plumbing in cancellation tokens at the call site.
|
_awaitAllRecipientsDoneCloningThenTransitionToDonatingOplogEntries
|
_awaitAllRecipientsDoneApplyingThenTransitionToPreparingToBlockWrites
|
_awaitCoordinatorHasDecisionPersistedThenTransitionToDropping
|
ReshardingRecipientService
// These can all be modified in place by plumbing in cancellation tokens at the call site.
|
_awaitAllDonorsPreparedToDonateThenTransitionToCreatingCollection
|
_awaitCoordinatorHasDecisionPersistedThenTransitionToRenaming
|
|
// This requires both in-place modification as above and changes to ReshardOplogApplier, which are outlined in SERVER-53931
|
_awaitAllDonorsBlockingWritesThenTransitionToStrictConsistency
|
|
|
Of the three extant PrimaryOnlyServices (ReshardingCoordinatorService, TenantMigrationDonorService, and TenantMigrationRecipientService), it appears that only TenantMigrationDonorService has been adapted to use its cancellation tokens, though it appears this work is not yet complete. We have a planned mechanism of making cancellable executors in https://jira.mongodb.org/browse/SERVER-53326, and extending this to cover the additional context that a (Scoped)TaskExecutor covers should be pretty straightforward.
Per file, the functions that need to be modified to support cancellation are:
ReshardingCoordinatorService
// The following require plumbing cancellation tokens into sharding_util::sendCommandToShards and ultimately into the AsyncRequestsSender, which needs to be modified to support the cancellable future interface instead of the old callback interface.
|
_tellAllParticipantsToRefresh
|
_tellAllDonorsToRefresh
|
_tellAllRecipientsToRefresh
|
|
// The following can be modified in place to take the cancel token we have access to at their call sites.
|
_awaitAllDonorsReadyToDonate
|
_awaitAllRecipientsFinishedCloning
|
_awaitAllRecipientsFinishedApplying
|
_awaitAllParticipantShardsRenamedOrDroppedOriginalCollection
|
TenantMigrationDonorService
// This function takes an executor but doesn't use it, so it technically doesn't need to be modified. Why does it take an executor?
|
tenant_migration_util::storeExternalClusterTimeKeyDocs
|
// This function needs to be modified, and that work is already planned in SERVER-53389.
|
_waitForMajorityWriteConcern
|
TenantMigrationRecipientService
// The following can be modified in place to take the top level cancellation token we have access to at their call sites.
|
_createAndConnectClients
|
_initializeStateDoc
|
_onCloneSuccess
|
_getDataConsistentFuture
|
_markStateDocAsGarbageCollectable
|
_updateStateDocForMajority
|
|
// This function requires a modification of BaseCloner to accept a cancellation token in its runOnExecutorEvent method.
|
_startTenantAllDatabaseCloner
|
|
// The following require modifications to AbstractAsyncComponent to support taking in a cancellation token.
|
_startOplogFetcher
|
TenantOplogApplier (in run())
|
|