summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/tenant_migration_recipient_service_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/repl/tenant_migration_recipient_service_test.cpp')
-rw-r--r--src/mongo/db/repl/tenant_migration_recipient_service_test.cpp67
1 files changed, 66 insertions, 1 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 55c295b5c3c..8612c951131 100644
--- a/src/mongo/db/repl/tenant_migration_recipient_service_test.cpp
+++ b/src/mongo/db/repl/tenant_migration_recipient_service_test.cpp
@@ -1326,6 +1326,8 @@ TEST_F(TenantMigrationRecipientServiceTest,
TEST_F(TenantMigrationRecipientServiceTest, TenantMigrationRecipientGetStartOpTime_NoTransaction) {
stopFailPointEnableBlock fp("fpAfterRetrievingStartOpTimesMigrationRecipientInstance");
+ // Hang before deleting the state doc so that we can check the state doc was persisted.
+ FailPointEnableBlock fpDeletingStateDoc("pauseTenantMigrationRecipientBeforeDeletingStateDoc");
const UUID migrationUUID = UUID::gen();
const OpTime topOfOplogOpTime(Timestamp(5, 1), 1);
@@ -1360,6 +1362,8 @@ TEST_F(TenantMigrationRecipientServiceTest, TenantMigrationRecipientGetStartOpTi
TEST_F(TenantMigrationRecipientServiceTest, TenantMigrationRecipientGetStartOpTime_Transaction) {
stopFailPointEnableBlock fp("fpAfterRetrievingStartOpTimesMigrationRecipientInstance");
+ // Hang before deleting the state doc so that we can check the state doc was persisted.
+ FailPointEnableBlock fpDeletingStateDoc("pauseTenantMigrationRecipientBeforeDeletingStateDoc");
const UUID migrationUUID = UUID::gen();
const OpTime txnStartOpTime(Timestamp(3, 1), 1);
@@ -1403,6 +1407,8 @@ TEST_F(TenantMigrationRecipientServiceTest, TenantMigrationRecipientGetStartOpTi
TEST_F(TenantMigrationRecipientServiceTest,
TenantMigrationRecipientGetStartOpTimes_RemoteOplogQueryFails) {
stopFailPointEnableBlock fp("fpAfterRetrievingStartOpTimesMigrationRecipientInstance");
+ // Hang before deleting the state doc so that we can check the state doc was persisted.
+ FailPointEnableBlock fpDeletingStateDoc("pauseTenantMigrationRecipientBeforeDeletingStateDoc");
const UUID migrationUUID = UUID::gen();
@@ -1434,6 +1440,8 @@ TEST_F(TenantMigrationRecipientServiceTest,
TEST_F(TenantMigrationRecipientServiceTest, TenantMigrationRecipientStartOplogFetcher) {
stopFailPointEnableBlock fp("fpAfterStartingOplogFetcherMigrationRecipientInstance");
+ // Hang before deleting the state doc so that we can check the state doc was persisted.
+ FailPointEnableBlock fpDeletingStateDoc("pauseTenantMigrationRecipientBeforeDeletingStateDoc");
auto taskFp = globalFailPointRegistry().find("hangBeforeTaskCompletion");
auto initialTimesEntered = taskFp->setMode(FailPoint::alwaysOn);
@@ -1482,6 +1490,8 @@ TEST_F(TenantMigrationRecipientServiceTest, TenantMigrationRecipientStartOplogFe
TEST_F(TenantMigrationRecipientServiceTest, TenantMigrationRecipientStartsCloner) {
stopFailPointEnableBlock fp("fpBeforeFetchingCommittedTransactions");
+ // Hang before deleting the state doc so that we can check the state doc was persisted.
+ FailPointEnableBlock fpDeletingStateDoc("pauseTenantMigrationRecipientBeforeDeletingStateDoc");
auto taskFp = globalFailPointRegistry().find("hangBeforeTaskCompletion");
ScopeGuard taskFpGuard([&taskFp] { taskFp->setMode(FailPoint::off); });
@@ -1550,6 +1560,9 @@ TEST_F(TenantMigrationRecipientServiceTest, TenantMigrationRecipientStartsCloner
}
TEST_F(TenantMigrationRecipientServiceTest, OplogFetcherFailsDuringOplogApplication) {
+ // Hang before deleting the state doc so that we can check the state doc was persisted.
+ FailPointEnableBlock fpDeletingStateDoc("pauseTenantMigrationRecipientBeforeDeletingStateDoc");
+
const UUID migrationUUID = UUID::gen();
const OpTime topOfOplogOpTime(Timestamp(5, 1), 1);
@@ -2385,6 +2398,9 @@ TEST_F(TenantMigrationRecipientServiceTest,
}
TEST_F(TenantMigrationRecipientServiceTest, OplogApplierFails) {
+ // Hang before deleting the state doc so that we can check the state doc was persisted.
+ FailPointEnableBlock fpDeletingStateDoc("pauseTenantMigrationRecipientBeforeDeletingStateDoc");
+
const UUID migrationUUID = UUID::gen();
const OpTime topOfOplogOpTime(Timestamp(5, 1), 1);
const OpTime injectedEntryOpTime(Timestamp(6, 1), 1);
@@ -2453,6 +2469,9 @@ TEST_F(TenantMigrationRecipientServiceTest, OplogApplierFails) {
}
TEST_F(TenantMigrationRecipientServiceTest, StoppingApplierAllowsCompletion) {
+ // Hang before deleting the state doc so that we can check the state doc was persisted.
+ FailPointEnableBlock fpDeletingStateDoc("pauseTenantMigrationRecipientBeforeDeletingStateDoc");
+
const UUID migrationUUID = UUID::gen();
const OpTime topOfOplogOpTime(Timestamp(5, 1), 1);
@@ -2687,6 +2706,8 @@ TEST_F(TenantMigrationRecipientServiceTest, RecipientForgetMigration_WaitUntilSt
// state doc.
auto autoForgetFp = globalFailPointRegistry().find("autoRecipientForgetMigration");
autoForgetFp->setMode(FailPoint::off);
+ // Hang before deleting the state doc so that we can check the state doc was persisted.
+ FailPointEnableBlock fpDeletingStateDoc("pauseTenantMigrationRecipientBeforeDeletingStateDoc");
const UUID migrationUUID = UUID::gen();
const OpTime topOfOplogOpTime(Timestamp(5, 1), 1);
@@ -2772,7 +2793,8 @@ TEST_F(TenantMigrationRecipientServiceTest, RecipientForgetMigration_AfterStartO
0,
BSON("action"
<< "hang"));
-
+ // Hang before deleting the state doc so that we can check the state doc was persisted.
+ FailPointEnableBlock fpDeletingStateDoc("pauseTenantMigrationRecipientBeforeDeletingStateDoc");
const UUID migrationUUID = UUID::gen();
const OpTime topOfOplogOpTime(Timestamp(5, 1), 1);
@@ -2838,6 +2860,9 @@ TEST_F(TenantMigrationRecipientServiceTest, RecipientForgetMigration_AfterConsis
0,
BSON("action"
<< "hang"));
+ // Hang before deleting the state doc so that we can check the state doc was persisted.
+ FailPointEnableBlock fpDeletingStateDoc("pauseTenantMigrationRecipientBeforeDeletingStateDoc");
+
const UUID migrationUUID = UUID::gen();
const OpTime topOfOplogOpTime(Timestamp(5, 1), 1);
@@ -2927,6 +2952,9 @@ TEST_F(TenantMigrationRecipientServiceTest, RecipientForgetMigration_AfterFail)
auto autoForgetFp = globalFailPointRegistry().find("autoRecipientForgetMigration");
autoForgetFp->setMode(FailPoint::off);
+ // Hang before deleting the state doc so that we can check the state doc was persisted.
+ FailPointEnableBlock fpDeletingStateDoc("pauseTenantMigrationRecipientBeforeDeletingStateDoc");
+
stopFailPointEnableBlock fp("fpBeforeFetchingCommittedTransactions");
const UUID migrationUUID = UUID::gen();
const OpTime topOfOplogOpTime(Timestamp(5, 1), 1);
@@ -3015,6 +3043,9 @@ TEST_F(TenantMigrationRecipientServiceTest, RecipientForgetMigration_FailToMarkG
stopFailPointEnableBlock fp("fpAfterPersistingTenantMigrationRecipientInstanceStateDoc");
const UUID migrationUUID = UUID::gen();
+ // Hang before deleting the state doc so that we can check the state doc was persisted.
+ FailPointEnableBlock fpDeletingStateDoc("pauseTenantMigrationRecipientBeforeDeletingStateDoc");
+
MockReplicaSet replSet("donorSet", 3, true /* hasPrimary */, true /* dollarPrefixHosts */);
getTopologyManager()->setTopologyDescription(replSet.getTopologyDescription(clock()));
@@ -3066,6 +3097,8 @@ TEST_F(TenantMigrationRecipientServiceTest, RecipientForgetMigration_FailToMarkG
TEST_F(TenantMigrationRecipientServiceTest, TenantMigrationRecipientServiceRecordsFCVAtStart) {
stopFailPointEnableBlock fp("fpAfterRecordingRecipientPrimaryStartingFCV");
+ // Hang before deleting the state doc so that we can check the state doc was persisted.
+ FailPointEnableBlock fpDeletingStateDoc("pauseTenantMigrationRecipientBeforeDeletingStateDoc");
const UUID migrationUUID = UUID::gen();
MockReplicaSet replSet("donorSet", 3, true /* hasPrimary */, true /* dollarPrefixHosts */);
@@ -3102,6 +3135,9 @@ TEST_F(TenantMigrationRecipientServiceTest, TenantMigrationRecipientServiceRecor
TEST_F(TenantMigrationRecipientServiceTest,
TenantMigrationRecipientServiceAlreadyRecordedFCV_Match) {
stopFailPointEnableBlock fp("fpAfterRecordingRecipientPrimaryStartingFCV");
+ // Hang before deleting the state doc so that we can check the state doc was persisted.
+ FailPointEnableBlock fpDeletingStateDoc("pauseTenantMigrationRecipientBeforeDeletingStateDoc");
+
const UUID migrationUUID = UUID::gen();
MockReplicaSet replSet("donorSet", 3, true /* hasPrimary */, true /* dollarPrefixHosts */);
@@ -3225,6 +3261,9 @@ TEST_F(TenantMigrationRecipientServiceTest,
}
TEST_F(TenantMigrationRecipientServiceTest, WaitUntilMigrationReachesReturnAfterReachingTimestamp) {
+ // Hang before deleting the state doc so that we can check the state doc was persisted.
+ FailPointEnableBlock fpDeletingStateDoc("pauseTenantMigrationRecipientBeforeDeletingStateDoc");
+
const UUID migrationUUID = UUID::gen();
const OpTime topOfOplogOpTime(Timestamp(5, 1), 1);
@@ -3286,6 +3325,9 @@ TEST_F(TenantMigrationRecipientServiceTest, RecipientReceivesRetriableFetcherErr
BSON("action"
<< "hang"));
+ // Hang before deleting the state doc so that we can check the state doc was persisted.
+ FailPointEnableBlock fpDeletingStateDoc("pauseTenantMigrationRecipientBeforeDeletingStateDoc");
+
const UUID migrationUUID = UUID::gen();
const OpTime topOfOplogOpTime(Timestamp(5, 1), 1);
@@ -3351,6 +3393,9 @@ TEST_F(TenantMigrationRecipientServiceTest, RecipientReceivesNonRetriableFetcher
BSON("action"
<< "hang"));
+ // Hang before deleting the state doc so that we can check the state doc was persisted.
+ FailPointEnableBlock fpDeletingStateDoc("pauseTenantMigrationRecipientBeforeDeletingStateDoc");
+
const UUID migrationUUID = UUID::gen();
const OpTime topOfOplogOpTime(Timestamp(5, 1), 1);
@@ -3411,6 +3456,9 @@ TEST_F(TenantMigrationRecipientServiceTest, RecipientWillNotRetryOnExternalInter
BSON("action"
<< "hang"));
+ // Hang before deleting the state doc so that we can check the state doc was persisted.
+ FailPointEnableBlock fpDeletingStateDoc("pauseTenantMigrationRecipientBeforeDeletingStateDoc");
+
const UUID migrationUUID = UUID::gen();
const OpTime topOfOplogOpTime(Timestamp(5, 1), 1);
@@ -3471,6 +3519,9 @@ TEST_F(TenantMigrationRecipientServiceTest, RecipientWillNotRetryOnReceivingForg
BSON("action"
<< "hang"));
+ // Hang before deleting the state doc so that we can check the state doc was persisted.
+ FailPointEnableBlock fpDeletingStateDoc("pauseTenantMigrationRecipientBeforeDeletingStateDoc");
+
const UUID migrationUUID = UUID::gen();
const OpTime topOfOplogOpTime(Timestamp(5, 1), 1);
@@ -3543,6 +3594,10 @@ TEST_F(TenantMigrationRecipientServiceTest, RecipientReceivesRetriableClonerErro
BSON("action"
<< "hang"));
+ // Hang before deleting the state doc so that we can check the state doc was persisted.
+ FailPointEnableBlock fpDeletingStateDoc("pauseTenantMigrationRecipientBeforeDeletingStateDoc");
+
+
const UUID migrationUUID = UUID::gen();
const OpTime topOfOplogOpTime(Timestamp(5, 1), 1);
@@ -3616,6 +3671,10 @@ TEST_F(TenantMigrationRecipientServiceTest, RecipientReceivesNonRetriableClonerE
BSON("action"
<< "hang"));
+ // Hang before deleting the state doc so that we can check the state doc was persisted.
+ FailPointEnableBlock fpDeletingStateDoc("pauseTenantMigrationRecipientBeforeDeletingStateDoc");
+
+
const UUID migrationUUID = UUID::gen();
const OpTime topOfOplogOpTime(Timestamp(5, 1), 1);
@@ -3672,6 +3731,9 @@ TEST_F(TenantMigrationRecipientServiceTest, RecipientReceivesNonRetriableClonerE
TEST_F(TenantMigrationRecipientServiceTest, IncrementNumRestartsDueToRecipientFailureCounter) {
FailPointEnableBlock createIndexesFailpointBlock("skipCreatingIndexDuringRebuildService");
stopFailPointEnableBlock fp("fpAfterPersistingTenantMigrationRecipientInstanceStateDoc");
+ // Hang before deleting the state doc so that we can check the state doc was persisted.
+ FailPointEnableBlock fpDeletingStateDoc("pauseTenantMigrationRecipientBeforeDeletingStateDoc");
+
const UUID migrationUUID = UUID::gen();
const OpTime topOfOplogOpTime(Timestamp(1, 1), 1);
@@ -3725,6 +3787,9 @@ TEST_F(TenantMigrationRecipientServiceTest, IncrementNumRestartsDueToRecipientFa
TEST_F(TenantMigrationRecipientServiceTest,
RecipientFailureCounterNotIncrementedWhenMigrationForgotten) {
FailPointEnableBlock createIndexesFailpointBlock("skipCreatingIndexDuringRebuildService");
+ // Hang before deleting the state doc so that we can check the state doc was persisted.
+ FailPointEnableBlock fpDeletingStateDoc("pauseTenantMigrationRecipientBeforeDeletingStateDoc");
+
const UUID migrationUUID = UUID::gen();
const OpTime topOfOplogOpTime(Timestamp(1, 1), 1);