diff options
Diffstat (limited to 'src/mongo/db/repl/tenant_migration_recipient_op_observer.cpp')
-rw-r--r-- | src/mongo/db/repl/tenant_migration_recipient_op_observer.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/mongo/db/repl/tenant_migration_recipient_op_observer.cpp b/src/mongo/db/repl/tenant_migration_recipient_op_observer.cpp index e57ba2aa7e2..6c01ec62935 100644 --- a/src/mongo/db/repl/tenant_migration_recipient_op_observer.cpp +++ b/src/mongo/db/repl/tenant_migration_recipient_op_observer.cpp @@ -49,11 +49,8 @@ const auto tenantIdToDeleteDecoration = * Initializes the TenantMigrationRecipientAccessBlocker for the tenant migration denoted by the * given state doc. */ -void onFinishCloning(OperationContext* opCtx, - const TenantMigrationRecipientDocument& recipientStateDoc) { - invariant(recipientStateDoc.getState() == TenantMigrationRecipientStateEnum::kStarted); - invariant(recipientStateDoc.getDataConsistentStopDonorOpTime()); - +void createAccessBlockerIfNeeded(OperationContext* opCtx, + const TenantMigrationRecipientDocument& recipientStateDoc) { if (tenant_migration_access_blocker::getTenantMigrationRecipientAccessBlocker( opCtx->getServiceContext(), recipientStateDoc.getTenantId())) { // The migration failed part-way on the recipient with a retryable error, and got retried @@ -117,9 +114,7 @@ void TenantMigrationRecipientOpObserver::onUpdate(OperationContext* opCtx, case TenantMigrationRecipientStateEnum::kDone: break; case TenantMigrationRecipientStateEnum::kStarted: - if (recipientStateDoc.getDataConsistentStopDonorOpTime()) { - onFinishCloning(opCtx, recipientStateDoc); - } + createAccessBlockerIfNeeded(opCtx, recipientStateDoc); break; case TenantMigrationRecipientStateEnum::kConsistent: if (recipientStateDoc.getRejectReadsBeforeTimestamp()) { |