diff options
author | mathisbessamdb <mathis.bessa@mongodb.com> | 2022-09-14 22:45:39 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-09-14 23:17:09 +0000 |
commit | d1da149077ea312efc80f8836bc79f2b1b10c1ad (patch) | |
tree | 6febf424f8182e0a16a2685198c480a621496836 | |
parent | 0cee06e6d10950abef657d89e09d23d849a3fdbc (diff) | |
download | mongo-d1da149077ea312efc80f8836bc79f2b1b10c1ad.tar.gz |
SERVER-69299 Shard Merge to enforce backupCursorCheckpointTimestamp
-rw-r--r-- | src/mongo/db/repl/tenant_migration_recipient_service.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/mongo/db/repl/tenant_migration_recipient_service.cpp b/src/mongo/db/repl/tenant_migration_recipient_service.cpp index 75ebc74f64c..9c9038c3846 100644 --- a/src/mongo/db/repl/tenant_migration_recipient_service.cpp +++ b/src/mongo/db/repl/tenant_migration_recipient_service.cpp @@ -1013,6 +1013,8 @@ SemiFuture<void> TenantMigrationRecipientService::Instance::_openBackupCursor( return aggRequest.toBSON(BSONObj()); }(); + auto startMigrationDonorTimestamp = _stateDoc.getStartMigrationDonorTimestamp(); + auto fetchStatus = std::make_shared<boost::optional<Status>>(); auto uniqueMetadataInfo = std::make_unique<boost::optional<shard_merge_utils::MetadataInfo>>(); auto fetcherCallback = @@ -1021,7 +1023,8 @@ SemiFuture<void> TenantMigrationRecipientService::Instance::_openBackupCursor( self = shared_from_this(), fetchStatus, metadataInfoPtr = uniqueMetadataInfo.get(), - token + token, + startMigrationDonorTimestamp ](const Fetcher::QueryResponseStatus& dataStatus, Fetcher::NextAction* nextAction, BSONObjBuilder* getMoreBob) noexcept { @@ -1045,6 +1048,14 @@ SemiFuture<void> TenantMigrationRecipientService::Instance::_openBackupCursor( "backupCursorId"_attr = data.cursorId, "backupCursorCheckpointTimestamp"_attr = checkpointTimestamp); + // This ensures that the recipient won’t receive any 2 phase index build donor + // oplog entries during the migration. We also have a check in the tenant oplog + // applier to detect such oplog entries. Adding a check here helps us to detect + // the problem earlier. + uassert(6929900, + "backupCursorCheckpointTimestamp should be greater than or equal to " + "startMigrationDonorTimestamp", + checkpointTimestamp >= startMigrationDonorTimestamp); { stdx::lock_guard lk(_mutex); stdx::lock_guard<TenantMigrationSharedData> sharedDatalk(*_sharedData); |