summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/tenant_migration_recipient_service.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/repl/tenant_migration_recipient_service.cpp')
-rw-r--r--src/mongo/db/repl/tenant_migration_recipient_service.cpp13
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);