diff options
author | Jason Zhang <jason.zhang@mongodb.com> | 2020-09-21 20:26:47 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-09-23 19:12:28 +0000 |
commit | 6e8989d533886a774700689b46b90542b569c5eb (patch) | |
tree | 79fd4e4315a0851686243cfb5174188879b6727e /jstests | |
parent | 37a2cc5751829912c56c657b1d906a55039a1a29 (diff) | |
download | mongo-6e8989d533886a774700689b46b90542b569c5eb.tar.gz |
SERVER-50972 Make tenant migration donor startup recovery more likely to cover all the 4 possible states
Diffstat (limited to 'jstests')
-rw-r--r-- | jstests/replsets/tenant_migration_donor_startup_recovery.js | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/jstests/replsets/tenant_migration_donor_startup_recovery.js b/jstests/replsets/tenant_migration_donor_startup_recovery.js index 57833cfb6cb..12fc5c8e5ce 100644 --- a/jstests/replsets/tenant_migration_donor_startup_recovery.js +++ b/jstests/replsets/tenant_migration_donor_startup_recovery.js @@ -1,5 +1,6 @@ /** - * Tests startup recovery to tenant migration donor's in memory state. + * Tests startup recovery to tenant migration donor's in memory state. This test randomly selects a + * point during the migration to simulate a failure. * * Tenant migrations are not expected to be run on servers with ephemeralForTest. * @@ -10,6 +11,7 @@ (function() { "use strict"; +load("jstests/libs/fail_point_util.js"); load("jstests/libs/parallelTester.js"); // An object that mirrors the access states for the TenantMigrationAccessBlocker. @@ -68,6 +70,19 @@ function startMigration(host, recipientConnString, dbPrefix) { let migrationThread = new Thread(startMigration, donorPrimary.host, kRecipientConnString, kDBPrefix); + +// Force the migration to pause after entering a randomly selected state to simulate a failure. +Random.setRandomSeed(); +const kMigrationFpNames = [ + "pauseTenantMigrationAfterDataSync", + "pauseTenantMigrationAfterBlockingStarts", + "abortTenantMigrationAfterBlockingStarts" +]; +const index = Random.randInt(kMigrationFpNames.length + 1); +if (index < kMigrationFpNames.length) { + configureFailPoint(donorPrimary, kMigrationFpNames[index]); +} + migrationThread.start(); sleep(Math.random() * kMaxSleepTimeMS); donorRst.stopSet(null /* signal */, true /*forRestart */); |