diff options
Diffstat (limited to 'src/mongo/db/repl/tenant_migration_donor_service.h')
-rw-r--r-- | src/mongo/db/repl/tenant_migration_donor_service.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/mongo/db/repl/tenant_migration_donor_service.h b/src/mongo/db/repl/tenant_migration_donor_service.h index 30fe3a41461..ddf178121e4 100644 --- a/src/mongo/db/repl/tenant_migration_donor_service.h +++ b/src/mongo/db/repl/tenant_migration_donor_service.h @@ -80,6 +80,17 @@ public: */ Status checkIfOptionsConflict(BSONObj options); + /** + * Returns a Future that will be resolved when the migration has committed or aborted. + */ + SharedSemiFuture<void> getDecisionFuture() const { + return _decisionPromise.getFuture(); + } + + void onReceiveDonorForgetMigration() { + _receivedDonorForgetMigrationPromise.emplaceValue(); + } + private: const NamespaceString _stateDocumentsNS = NamespaceString::kTenantMigrationDonorsNamespace; @@ -98,24 +109,51 @@ public: repl::OpTime _updateStateDocument(const TenantMigrationDonorStateEnum nextState); /** + * Sets the "expireAt" time for the state document to be garbage collected. + */ + repl::OpTime _markStateDocumentAsGarbageCollectable(); + + /** * Waits for given opTime to be majority committed. */ ExecutorFuture<void> _waitForMajorityWriteConcern( const std::shared_ptr<executor::ScopedTaskExecutor>& executor, repl::OpTime opTime); /** + * Sends the given command to the recipient replica set. + */ + ExecutorFuture<void> _sendCommandToRecipient( + OperationContext* opCtx, + const std::shared_ptr<executor::ScopedTaskExecutor>& executor, + RemoteCommandTargeter* recipientTargeter, + const BSONObj& cmdObj); + + /** * Sends the recipientSyncData command to the recipient replica set. */ ExecutorFuture<void> _sendRecipientSyncDataCommand( const std::shared_ptr<executor::ScopedTaskExecutor>& executor, RemoteCommandTargeter* recipientTargeter); + /** + * Sends the recipientForgetMigration command to the recipient replica set. + */ + ExecutorFuture<void> _sendRecipientForgetMigrationCommand( + const std::shared_ptr<executor::ScopedTaskExecutor>& executor, + RemoteCommandTargeter* recipientTargeter); + ServiceContext* _serviceContext; TenantMigrationDonorDocument _stateDoc; std::shared_ptr<TenantMigrationAccessBlocker> _mtab; boost::optional<Status> _abortReason; + + // Promise that is resolved when the donor has majority-committed the migration decision. + SharedPromise<void> _decisionPromise; + + // Promise that is resolved when the donor receives the donorForgetMigration command. + SharedPromise<void> _receivedDonorForgetMigrationPromise; }; private: |