summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Chan <jason.chan@mongodb.com>2021-06-16 18:20:33 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-06-21 17:11:04 +0000
commite81c67049da0f4e9bd127522fc15b141d6b9881b (patch)
tree2e0db51874f54655e38e42cfc2046e5c5b09beea
parent4e1d1ad452d5cd461d0af4cc6f977ac52abc195a (diff)
downloadmongo-e81c67049da0f4e9bd127522fc15b141d6b9881b.tar.gz
SERVER-57745 Fix race in inserting oplog entries to be applied before calculating the resumeBatchingTs in tenant migrations unittest
(cherry picked from commit 970f9b4ef4d16954a4d1fddebce6f104dd8e7123)
-rw-r--r--src/mongo/db/repl/tenant_migration_recipient_service_test.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/mongo/db/repl/tenant_migration_recipient_service_test.cpp b/src/mongo/db/repl/tenant_migration_recipient_service_test.cpp
index c16e6b6f2b0..202aeb1a5b7 100644
--- a/src/mongo/db/repl/tenant_migration_recipient_service_test.cpp
+++ b/src/mongo/db/repl/tenant_migration_recipient_service_test.cpp
@@ -2050,7 +2050,14 @@ TEST_F(TenantMigrationRecipientServiceTest,
auto opCtx = makeOperationContext();
std::shared_ptr<TenantMigrationRecipientService::Instance> instance;
- // Hang before starting the oplog applier.
+ // Hang before creating the oplog applier.
+ const auto hangBeforeCreatingOplogApplier =
+ globalFailPointRegistry().find("fpAfterStartingOplogFetcherMigrationRecipientInstance");
+ hangBeforeCreatingOplogApplier->setMode(FailPoint::alwaysOn,
+ 0,
+ BSON("action"
+ << "hang"));
+ // Hang after starting the oplog applier.
const auto hangAfterStartingOplogApplier =
globalFailPointRegistry().find("fpAfterStartingOplogApplierMigrationRecipientInstance");
auto initialTimesEntered = hangAfterStartingOplogApplier->setMode(FailPoint::alwaysOn,
@@ -2145,7 +2152,8 @@ TEST_F(TenantMigrationRecipientServiceTest,
ASSERT_OK(storage->insertDocument(
opCtx.get(), oplogNss, {entry.toBSON(), opTime.getTimestamp()}, opTime.getTerm()));
}
-
+ // Move on to the next failpoint to hang after starting the oplog applier.
+ hangBeforeCreatingOplogApplier->setMode(FailPoint::off);
hangAfterStartingOplogApplier->waitForTimesEntered(initialTimesEntered + 1);
auto dataConsistentOplogEntry = makeOplogEntry(dataConsistentOpTime,