diff options
author | Lingzhi Deng <lingzhi.deng@mongodb.com> | 2021-05-10 15:19:25 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-05-10 16:13:24 +0000 |
commit | 084572422d66ed815bddd792af40698eaafa2b7c (patch) | |
tree | 490d91be3a15d13a24c14802ccc60a4cbf736907 | |
parent | c27c5a8633e958bd0b1035ae6c92ca8adba17759 (diff) | |
download | mongo-084572422d66ed815bddd792af40698eaafa2b7c.tar.gz |
SERVER-56767: Check for interrupt before initializing tenant oplog applier and starting tenant cloners
(cherry picked from commit 5e45283c8c6f191dd0f301808942e0f11e307ff5)
-rw-r--r-- | src/mongo/db/repl/tenant_migration_recipient_service.cpp | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/mongo/db/repl/tenant_migration_recipient_service.cpp b/src/mongo/db/repl/tenant_migration_recipient_service.cpp index 8ed98bd4fe8..9c605bedcfb 100644 --- a/src/mongo/db/repl/tenant_migration_recipient_service.cpp +++ b/src/mongo/db/repl/tenant_migration_recipient_service.cpp @@ -1996,17 +1996,6 @@ SemiFuture<void> TenantMigrationRecipientService::Instance::run( stdx::unique_lock lk(_mutex); - { - // Throwing error when cloner is canceled externally via interrupt(), - // makes the instance to skip the remaining task (i.e., starting oplog - // applier) in the sync process. This step is necessary to prevent race - // between interrupt() and starting oplog applier for the failover - // scenarios where we don't start the cloner if the tenant data is - // already in consistent state. - stdx::lock_guard<TenantMigrationSharedData> sharedDatalk(*_sharedData); - uassertStatusOK(_sharedData->getStatus(sharedDatalk)); - } - // Create the oplog applier but do not start it yet. invariant(_stateDoc.getStartApplyingDonorOpTime()); @@ -2044,6 +2033,18 @@ SemiFuture<void> TenantMigrationRecipientService::Instance::run( } else { beginApplyingAfterOpTime = *_stateDoc.getStartApplyingDonorOpTime(); } + + { + // Throwing error when cloner is canceled externally via interrupt(), + // makes the instance to skip the remaining task (i.e., starting oplog + // applier) in the sync process. This step is necessary to prevent race + // between interrupt() and starting oplog applier for the failover + // scenarios where we don't start the cloner if the tenant data is + // already in consistent state. + stdx::lock_guard<TenantMigrationSharedData> sharedDatalk(*_sharedData); + uassertStatusOK(_sharedData->getStatus(sharedDatalk)); + } + LOGV2_DEBUG(4881202, 1, "Recipient migration service creating oplog applier", |