diff options
author | Christopher Caplinger <christopher.caplinger@mongodb.com> | 2022-03-17 18:40:57 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-03-17 21:06:40 +0000 |
commit | 49d6e94c2363f27bda8cf4838635b443485d1bd9 (patch) | |
tree | daceca4945ada7cb2b07105d8c4498822ec75b06 /jstests/replsets | |
parent | ca7a22da6fb96561f0520c0b5084d32fc2bac67f (diff) | |
download | mongo-49d6e94c2363f27bda8cf4838635b443485d1bd9.tar.gz |
SERVER-62934: Don't require explicit donor fsync before shard merge specific tests.
Diffstat (limited to 'jstests/replsets')
31 files changed, 172 insertions, 180 deletions
diff --git a/jstests/replsets/libs/tenant_migration_test.js b/jstests/replsets/libs/tenant_migration_test.js index 40bb34e9016..607b9d24641 100644 --- a/jstests/replsets/libs/tenant_migration_test.js +++ b/jstests/replsets/libs/tenant_migration_test.js @@ -99,16 +99,21 @@ function TenantMigrationTest({ } /** - * Runs a tenant migration with the given migration options and waits for the migration to be - * committed or aborted. + * Runs a tenant migration with the given migration options and waits for the migration to + * be committed or aborted. * * Returns the result of the initial donorStartMigration if it was unsuccessful. Otherwise, - * returns the command response containing the migration state on the donor after the migration - * has completed. + * returns the command response containing the migration state on the donor after the + * migration has completed. */ - this.runMigration = function( - migrationOpts, retryOnRetryableErrors = false, automaticForgetMigration = true) { - const startRes = this.startMigration(migrationOpts, retryOnRetryableErrors); + this.runMigration = function(migrationOpts, opts = {}) { + const { + retryOnRetryableErrors = false, + automaticForgetMigration = true, + enableDonorStartMigrationFsync = false + } = opts; + + const startRes = this.startMigration(migrationOpts, opts); if (!startRes.ok) { return startRes; } @@ -131,9 +136,13 @@ function TenantMigrationTest({ * * Returns the result of the 'donorStartMigration' command. */ - this.startMigration = function(migrationOpts, retryOnRetryableErrors = false) { - return this.runDonorStartMigration( - migrationOpts, false /* waitForMigrationToComplete */, retryOnRetryableErrors); + this.startMigration = function( + migrationOpts, + {retryOnRetryableErrors = false, enableDonorStartMigrationFsync = false} = {}) { + return this.runDonorStartMigration(migrationOpts, { + retryOnRetryableErrors, + enableDonorStartMigrationFsync, + }); }; /** @@ -152,7 +161,7 @@ function TenantMigrationTest({ .findOne({tenantId})); const donorStartReply = this.runDonorStartMigration( - migrationOpts, true /* waitForMigrationToComplete */, retryOnRetryableErrors); + migrationOpts, {waitForMigrationToComplete: true, retryOnRetryableErrors}); if (!forgetMigration) { return donorStartReply; } @@ -179,8 +188,13 @@ function TenantMigrationTest({ donorCertificateForRecipient = migrationCertificates.donorCertificateForRecipient, recipientCertificateForDonor = migrationCertificates.recipientCertificateForDonor, }, - waitForMigrationToComplete, - retryOnRetryableErrors) { + opts = {}) { + const { + waitForMigrationToComplete = false, + retryOnRetryableErrors = false, + enableDonorStartMigrationFsync = false, + } = opts; + const cmdObj = { donorStartMigration: 1, tenantId, @@ -191,12 +205,12 @@ function TenantMigrationTest({ recipientCertificateForDonor }; - const stateRes = TenantMigrationUtil.runTenantMigrationCommand( - cmdObj, - this.getDonorRst(), + const stateRes = TenantMigrationUtil.runTenantMigrationCommand(cmdObj, this.getDonorRst(), { + enableDonorStartMigrationFsync, retryOnRetryableErrors, - stateRes => (!waitForMigrationToComplete || - TenantMigrationUtil.isMigrationCompleted(stateRes))); + shouldStopFunc: stateRes => + (!waitForMigrationToComplete || TenantMigrationUtil.isMigrationCompleted(stateRes)) + }); // If the migration has been successfully committed, check the db hashes for the tenantId // between the donor and recipient. @@ -217,7 +231,7 @@ function TenantMigrationTest({ this.forgetMigration = function(migrationIdString, retryOnRetryableErrors = false) { const cmdObj = {donorForgetMigration: 1, migrationId: UUID(migrationIdString)}; const res = TenantMigrationUtil.runTenantMigrationCommand( - cmdObj, this.getDonorRst(), retryOnRetryableErrors); + cmdObj, this.getDonorRst(), {retryOnRetryableErrors}); // If the command succeeded, we expect that the migration is marked garbage collectable on // the donor and the recipient. Check the state docs for expireAt, check that the oplog @@ -280,7 +294,7 @@ function TenantMigrationTest({ migrationId: UUID(migrationOpts.migrationIdString), }; return TenantMigrationUtil.runTenantMigrationCommand( - cmdObj, this.getDonorRst(), retryOnRetryableErrors); + cmdObj, this.getDonorRst(), {retryOnRetryableErrors}); }; /** diff --git a/jstests/replsets/libs/tenant_migration_util.js b/jstests/replsets/libs/tenant_migration_util.js index 180786b395b..5af7d1a83aa 100644 --- a/jstests/replsets/libs/tenant_migration_util.js +++ b/jstests/replsets/libs/tenant_migration_util.js @@ -125,7 +125,11 @@ var TenantMigrationUtil = (function() { * all other use cases, please consider the runMigration() function in the TenantMigrationTest * fixture. */ - function runMigrationAsync(migrationOpts, donorRstArgs, retryOnRetryableErrors = false) { + function runMigrationAsync(migrationOpts, donorRstArgs, opts = {}) { + const { + retryOnRetryableErrors = false, + enableDonorStartMigrationFsync = false, + } = opts; load("jstests/replsets/libs/tenant_migration_util.js"); const donorRst = TenantMigrationUtil.createRst(donorRstArgs, retryOnRetryableErrors); @@ -142,8 +146,11 @@ var TenantMigrationUtil = (function() { migrationCertificates.recipientCertificateForDonor }; - return TenantMigrationUtil.runTenantMigrationCommand( - cmdObj, donorRst, retryOnRetryableErrors, TenantMigrationUtil.isMigrationCompleted); + return TenantMigrationUtil.runTenantMigrationCommand(cmdObj, donorRst, { + retryOnRetryableErrors, + enableDonorStartMigrationFsync, + shouldStopFunc: TenantMigrationUtil.isMigrationCompleted + }); } /** @@ -161,7 +168,7 @@ var TenantMigrationUtil = (function() { const donorRst = TenantMigrationUtil.createRst(donorRstArgs, retryOnRetryableErrors); const cmdObj = {donorForgetMigration: 1, migrationId: UUID(migrationIdString)}; return TenantMigrationUtil.runTenantMigrationCommand( - cmdObj, donorRst, retryOnRetryableErrors); + cmdObj, donorRst, {retryOnRetryableErrors}); } /** @@ -183,24 +190,37 @@ var TenantMigrationUtil = (function() { migrationId: UUID(migrationOpts.migrationIdString), }; return TenantMigrationUtil.runTenantMigrationCommand( - cmdObj, donorRst, retryOnRetryableErrors); + cmdObj, donorRst, {retryOnRetryableErrors}); } /** * Runs the given tenant migration command against the primary of the given replica set until * the command succeeds or fails with a non-retryable error (if 'retryOnRetryableErrors' is - * true) or until 'shouldStopFunc' returns true (if it is given). Returns the last response. + * true) or until 'shouldStopFunc' returns true. Returns the last response. */ - function runTenantMigrationCommand(cmdObj, rst, retryOnRetryableErrors, shouldStopFunc) { + function runTenantMigrationCommand(cmdObj, rst, { + retryOnRetryableErrors = false, + shouldStopFunc = () => true, + enableDonorStartMigrationFsync = false + } = {}) { let primary = rst.getPrimary(); let localCmdObj = cmdObj; + let run = () => primary.adminCommand(localCmdObj); if (Object.keys(cmdObj)[0] === "donorStartMigration") { - localCmdObj = donorStartMigrationWithProtocol(cmdObj, primary.getDB("admin")); + run = () => { + const adminDB = primary.getDB("admin"); + localCmdObj = donorStartMigrationWithProtocol(cmdObj, adminDB); + if (enableDonorStartMigrationFsync) { + rst.awaitLastOpCommitted(); + assert.commandWorked(primary.adminCommand({fsync: 1})); + } + return primary.adminCommand(localCmdObj); + }; } let res; assert.soon(() => { try { - res = primary.adminCommand(localCmdObj); + res = run(); if (!res.ok) { // If retry is enabled and the command failed with a NotPrimary error, continue @@ -214,10 +234,7 @@ var TenantMigrationUtil = (function() { return true; } - if (shouldStopFunc) { - return shouldStopFunc(res); - } - return true; + return shouldStopFunc(res); } catch (e) { if (retryOnRetryableErrors && isNetworkError(e)) { jsTestLog(`runTenantMigrationCommand retryable error. Command: ${ diff --git a/jstests/replsets/tenant_migration_abort_forget_retry.js b/jstests/replsets/tenant_migration_abort_forget_retry.js index d8fd3259e91..21913140ba6 100644 --- a/jstests/replsets/tenant_migration_abort_forget_retry.js +++ b/jstests/replsets/tenant_migration_abort_forget_retry.js @@ -46,10 +46,8 @@ const tenantMigrationTest = const donorPrimary = tenantMigrationTest.getDonorPrimary(); const abortFp = configureFailPoint(donorPrimary, "abortTenantMigrationBeforeLeavingBlockingState"); - TenantMigrationTest.assertAborted( - tenantMigrationTest.runMigration({migrationIdString: migrationId1, tenantId: tenantId}, - false /* retryOnRetryableErrors */, - false /* automaticForgetMigration */)); + TenantMigrationTest.assertAborted(tenantMigrationTest.runMigration( + {migrationIdString: migrationId1, tenantId: tenantId}, {automaticForgetMigration: false})); abortFp.off(); // Forget the aborted migration. diff --git a/jstests/replsets/tenant_migration_advance_stable_ts_after_clone.js b/jstests/replsets/tenant_migration_advance_stable_ts_after_clone.js index 01e903dd52d..9ea5473a4b5 100644 --- a/jstests/replsets/tenant_migration_advance_stable_ts_after_clone.js +++ b/jstests/replsets/tenant_migration_advance_stable_ts_after_clone.js @@ -56,7 +56,7 @@ const recipientHoldStablefp = configureFailPoint( recipientPrimary, "holdStableTimestampAtSpecificTimestamp", {timestamp: recipientHoldStableTs}); // Advance the stable timestamp on the donor so that it's greater than the timestamp of the -// recipient. Then, force the checkpoint timestamp to advance by calling fsync. +// recipient. let donorAdvancedStableTs; assert.soon(function() { donorAdvancedStableTs = @@ -70,7 +70,6 @@ assert.soon(function() { return bsonWoCompare(donorAdvancedStableTs, recipientHoldStableTs) > 0; }); -assert.commandWorked(donorPrimary.adminCommand({fsync: 1})); // Force the tenant migration to hang just before we attempt to advance the stable timestamp on the // recipient. @@ -78,7 +77,7 @@ const hangBeforeAdvanceStableTsFp = configureFailPoint(recipientPrimary, "fpBeforeAdvancingStableTimestamp", {action: "hang"}); // Start the migration. -assert.commandWorked(tmt.startMigration(migrationOpts)); +assert.commandWorked(tmt.startMigration(migrationOpts, {enableDonorStartMigrationFsync: true})); // The recipient's stable timestamp should be less than the timestamp it receives from the donor to // use as the startApplyingDonorOpTime, so the recipient should advance its stable timestamp. Wait diff --git a/jstests/replsets/tenant_migration_cluster_time_keys_cloning.js b/jstests/replsets/tenant_migration_cluster_time_keys_cloning.js index 8aebcea3260..822c6203895 100644 --- a/jstests/replsets/tenant_migration_cluster_time_keys_cloning.js +++ b/jstests/replsets/tenant_migration_cluster_time_keys_cloning.js @@ -255,8 +255,7 @@ const migrationX509Options = TenantMigrationUtil.makeX509OptionsForTest(); const barrierBeforeWaitingForKeyWC = configureFailPoint( donorRst.getPrimary(), "pauseTenantMigrationDonorBeforeWaitingForKeysToReplicate"); - assert.commandWorked( - tenantMigrationTest.startMigration(migrationOpts, false /* retryOnRetryableErrors */)); + assert.commandWorked(tenantMigrationTest.startMigration(migrationOpts)); // Wait for the donor to begin waiting for replication of the copied keys. barrierBeforeWaitingForKeyWC.wait(); @@ -265,10 +264,7 @@ const migrationX509Options = TenantMigrationUtil.makeX509OptionsForTest(); // The migration should be unable to progress past the aborting index builds state because // it cannot replicate the copied keys to every donor node. - let res = assert.commandWorked( - tenantMigrationTest.runDonorStartMigration(migrationOpts, - false /* waitForMigrationToComplete */, - false /* retryOnRetryableErrors */)); + let res = assert.commandWorked(tenantMigrationTest.runDonorStartMigration(migrationOpts)); assert.eq("aborting index builds", res.state, tojson(res)); if (withFailover) { @@ -287,10 +283,8 @@ const migrationX509Options = TenantMigrationUtil.makeX509OptionsForTest(); // The migration should still be stuck because it cannot replicate the keysto all donor // nodes. - res = assert.commandWorked( - tenantMigrationTest.runDonorStartMigration(migrationOpts, - false /* waitForMigrationToComplete */, - true /* retryOnRetryableErrors */)); + res = assert.commandWorked(tenantMigrationTest.runDonorStartMigration( + migrationOpts, {retryOnRetryableErrors: true})); assert.eq("aborting index builds", res.state, tojson(res)); } diff --git a/jstests/replsets/tenant_migration_concurrent_reads_on_donor.js b/jstests/replsets/tenant_migration_concurrent_reads_on_donor.js index 7ddaef805d9..c6de7da65e2 100644 --- a/jstests/replsets/tenant_migration_concurrent_reads_on_donor.js +++ b/jstests/replsets/tenant_migration_concurrent_reads_on_donor.js @@ -117,8 +117,8 @@ function testRejectReadsAfterMigrationCommitted(testCase, dbName, collName) { const donorRst = tenantMigrationTest.getDonorRst(); const donorPrimary = donorRst.getPrimary(); - TenantMigrationTest.assertCommitted(tenantMigrationTest.runMigration( - migrationOpts, false /* retryOnRetryableErrors */, false /* automaticForgetMigration */)); + TenantMigrationTest.assertCommitted( + tenantMigrationTest.runMigration(migrationOpts, {automaticForgetMigration: false})); // Wait for the last oplog entry on the primary to be visible in the committed snapshot view of // the oplog on all the secondaries. This is to ensure that snapshot reads on secondaries with @@ -172,8 +172,8 @@ function testDoNotRejectReadsAfterMigrationAborted(testCase, dbName, collName) { let abortFp = configureFailPoint(donorPrimary, "abortTenantMigrationBeforeLeavingBlockingState"); - TenantMigrationTest.assertAborted(tenantMigrationTest.runMigration( - migrationOpts, false /* retryOnRetryableErrors */, false /* automaticForgetMigration */)); + TenantMigrationTest.assertAborted( + tenantMigrationTest.runMigration(migrationOpts, {automaticForgetMigration: false})); abortFp.off(); // Wait for the last oplog entry on the primary to be visible in the committed snapshot view of diff --git a/jstests/replsets/tenant_migration_concurrent_reads_on_recipient.js b/jstests/replsets/tenant_migration_concurrent_reads_on_recipient.js index 024dff041ec..2bb5dca4d4a 100644 --- a/jstests/replsets/tenant_migration_concurrent_reads_on_recipient.js +++ b/jstests/replsets/tenant_migration_concurrent_reads_on_recipient.js @@ -193,8 +193,8 @@ function testDoNotRejectReadsAfterMigrationAbortedBeforeReachingRejectReadsBefor let abortFp = configureFailPoint(recipientPrimary, "fpBeforeFulfillingDataConsistentPromise", {action: "stop", stopErrorCode: ErrorCodes.InternalError}); - TenantMigrationTest.assertAborted(tenantMigrationTest.runMigration( - migrationOpts, false /* retryOnRetryableErrors */, false /* automaticForgetMigration */)); + TenantMigrationTest.assertAborted( + tenantMigrationTest.runMigration(migrationOpts, {automaticForgetMigration: false})); abortFp.off(); const nodes = testCase.isSupportedOnSecondaries ? recipientRst.nodes : [recipientPrimary]; @@ -263,8 +263,8 @@ function testDoNotRejectReadsAfterMigrationAbortedAfterReachingRejectReadsBefore // recipientSyncData (i.e. after it has reached the returnAfterReachingTimestamp). let abortFp = configureFailPoint(donorPrimary, "abortTenantMigrationBeforeLeavingBlockingState"); - TenantMigrationTest.assertAborted(tenantMigrationTest.runMigration( - migrationOpts, false /* retryOnRetryableErrors */, false /* automaticForgetMigration */)); + TenantMigrationTest.assertAborted( + tenantMigrationTest.runMigration(migrationOpts, {automaticForgetMigration: false})); abortFp.off(); // Wait for the last oplog entry on the primary to be visible in the committed snapshot view of diff --git a/jstests/replsets/tenant_migration_concurrent_state_doc_removal_and_stepdown.js b/jstests/replsets/tenant_migration_concurrent_state_doc_removal_and_stepdown.js index cbb9dd1a0f2..e1617812eab 100644 --- a/jstests/replsets/tenant_migration_concurrent_state_doc_removal_and_stepdown.js +++ b/jstests/replsets/tenant_migration_concurrent_state_doc_removal_and_stepdown.js @@ -36,8 +36,8 @@ const migrationOpts = { tenantId: kTenantId, }; -TenantMigrationTest.assertCommitted(tenantMigrationTest.runMigration( - migrationOpts, false /* retryOnRetryableErrors */, false /* automaticForgetMigration */)); +TenantMigrationTest.assertCommitted( + tenantMigrationTest.runMigration(migrationOpts, {automaticForgetMigration: false})); let fp = configureFailPoint(donorPrimary, "pauseTenantMigrationDonorAfterMarkingStateGarbageCollectable"); diff --git a/jstests/replsets/tenant_migration_concurrent_writes_on_donor.js b/jstests/replsets/tenant_migration_concurrent_writes_on_donor.js index ed23b7fcc23..bda2513e908 100644 --- a/jstests/replsets/tenant_migration_concurrent_writes_on_donor.js +++ b/jstests/replsets/tenant_migration_concurrent_writes_on_donor.js @@ -206,13 +206,10 @@ function makeTestOptions( } function cleanUp(dbName) { + // To avoid disk space errors, ensure a new snapshot after dropping the DB, + // so subsequent 'Shard Merge' migrations don't copy it again. const donorDB = donorPrimary.getDB(dbName); - assert.commandWorked(donorDB.dropDatabase()); - donorRst.awaitLastOpCommitted(); - // TODO SERVER-62934: Remove this fsync once we run fsync command before the migration - // start for shard merge protocol. - assert.commandWorked(donorPrimary.adminCommand({fsync: 1})); } function runTest( @@ -324,8 +321,11 @@ function testRejectWritesAfterMigrationCommitted(testCase, testOpts) { tenantId, }; - TenantMigrationTest.assertCommitted(tenantMigrationTest.runMigration( - migrationOpts, false /* retryOnRetryableErrors */, false /* automaticForgetMigration */)); + TenantMigrationTest.assertCommitted(tenantMigrationTest.runMigration(migrationOpts, { + retryOnRetryableErrors: false, + automaticForgetMigration: false, + enableDonorStartMigrationFsync: true + })); runCommand(testOpts, ErrorCodes.TenantMigrationCommitted); testCase.assertCommandFailed(testOpts.primaryDB, testOpts.dbName, testOpts.collName); @@ -348,8 +348,11 @@ function testDoNotRejectWritesAfterMigrationAborted(testCase, testOpts) { let abortFp = configureFailPoint(testOpts.primaryDB, "abortTenantMigrationBeforeLeavingBlockingState"); - TenantMigrationTest.assertAborted(tenantMigrationTest.runMigration( - migrationOpts, false /* retryOnRetryableErrors */, false /* automaticForgetMigration */)); + TenantMigrationTest.assertAborted(tenantMigrationTest.runMigration(migrationOpts, { + retryOnRetryableErrors: false, + automaticForgetMigration: false, + enableDonorStartMigrationFsync: true + })); abortFp.off(); // Wait until the in-memory migration state is updated after the migration has majority @@ -383,7 +386,8 @@ function testBlockWritesAfterMigrationEnteredBlocking(testCase, testOpts) { let blockingFp = configureFailPoint(testOpts.primaryDB, "pauseTenantMigrationBeforeLeavingBlockingState"); - assert.commandWorked(tenantMigrationTest.startMigration(migrationOpts)); + assert.commandWorked( + tenantMigrationTest.startMigration(migrationOpts, {enableDonorStartMigrationFsync: true})); // Run the command after the migration enters the blocking state. blockingFp.wait(); @@ -421,7 +425,8 @@ function testRejectBlockedWritesAfterMigrationCommitted(testCase, testOpts) { // Run the command after the migration enters the blocking state. resumeMigrationThread.start(); - assert.commandWorked(tenantMigrationTest.startMigration(migrationOpts)); + assert.commandWorked( + tenantMigrationTest.startMigration(migrationOpts, {enableDonorStartMigrationFsync: true})); blockingFp.wait(); // The migration should unpause and commit after the write is blocked. Verify that the write is @@ -461,7 +466,8 @@ function testRejectBlockedWritesAfterMigrationAborted(testCase, testOpts) { new Thread(resumeMigrationAfterBlockingWrite, testOpts.primaryHost, tenantId, 1); // Run the command after the migration enters the blocking state. - assert.commandWorked(tenantMigrationTest.startMigration(migrationOpts)); + assert.commandWorked( + tenantMigrationTest.startMigration(migrationOpts, {enableDonorStartMigrationFsync: true})); resumeMigrationThread.start(); blockingFp.wait(); diff --git a/jstests/replsets/tenant_migration_concurrent_writes_on_recipient.js b/jstests/replsets/tenant_migration_concurrent_writes_on_recipient.js index ac8b2d0ee32..d357f9d85a7 100644 --- a/jstests/replsets/tenant_migration_concurrent_writes_on_recipient.js +++ b/jstests/replsets/tenant_migration_concurrent_writes_on_recipient.js @@ -109,8 +109,8 @@ const kTenantId = "testTenantId"; let abortFp = configureFailPoint(recipientPrimary, "fpBeforeFulfillingDataConsistentPromise", {action: "stop", stopErrorCode: ErrorCodes.InternalError}); - TenantMigrationTest.assertAborted(tenantMigrationTest.runMigration( - migrationOpts, false /* retryOnRetryableErrors */, false /* automaticForgetMigration */)); + TenantMigrationTest.assertAborted( + tenantMigrationTest.runMigration(migrationOpts, {automaticForgetMigration: false})); abortFp.off(); // Write after the migration aborted. @@ -143,8 +143,8 @@ const kTenantId = "testTenantId"; // recipientSyncData. let abortFp = configureFailPoint(donorPrimary, "abortTenantMigrationBeforeLeavingBlockingState"); - TenantMigrationTest.assertAborted(tenantMigrationTest.runMigration( - migrationOpts, false /* retryOnRetryableErrors */, false /* automaticForgetMigration */)); + TenantMigrationTest.assertAborted( + tenantMigrationTest.runMigration(migrationOpts, {automaticForgetMigration: false})); abortFp.off(); // Write after the migration aborted. diff --git a/jstests/replsets/tenant_migration_conflicting_donor_start_migration_cmds.js b/jstests/replsets/tenant_migration_conflicting_donor_start_migration_cmds.js index 1d388d90c8c..08a29d39fe2 100644 --- a/jstests/replsets/tenant_migration_conflicting_donor_start_migration_cmds.js +++ b/jstests/replsets/tenant_migration_conflicting_donor_start_migration_cmds.js @@ -100,10 +100,10 @@ function setup() { const {tenantMigrationTest, recipientPrimary, teardown} = setup(); - TenantMigrationTest.assertCommitted(tenantMigrationTest.runMigration( - migrationOpts, false /* retryOnRetryableErrors */, false /* automaticForgetMigration */)); - TenantMigrationTest.assertCommitted(tenantMigrationTest.runMigration( - migrationOpts, false /* retryOnRetryableErrors */, false /* automaticForgetMigration */)); + TenantMigrationTest.assertCommitted( + tenantMigrationTest.runMigration(migrationOpts, {automaticForgetMigration: false})); + TenantMigrationTest.assertCommitted( + tenantMigrationTest.runMigration(migrationOpts, {automaticForgetMigration: false})); // If the second donorStartMigration had started a duplicate migration, the recipient would have // received four recipientSyncData commands instead of two. @@ -151,8 +151,8 @@ function testStartingConflictingMigrationAfterInitialMigrationCommitted({ migrationOpts1, donorPrimary, }) { - TenantMigrationTest.assertCommitted(tenantMigrationTest0.runMigration( - migrationOpts0, false /* retryOnRetryableErrors */, false /* automaticForgetMigration */)); + TenantMigrationTest.assertCommitted( + tenantMigrationTest0.runMigration(migrationOpts0, {automaticForgetMigration: false})); const res1 = assert.commandFailedWithCode(tenantMigrationTest1.runMigration(migrationOpts1), ErrorCodes.ConflictingOperationInProgress); assertNoCertificateOrPrivateKey(res1.errmsg); diff --git a/jstests/replsets/tenant_migration_donor_current_op.js b/jstests/replsets/tenant_migration_donor_current_op.js index 2f68cb43b2b..471a7d331bd 100644 --- a/jstests/replsets/tenant_migration_donor_current_op.js +++ b/jstests/replsets/tenant_migration_donor_current_op.js @@ -168,8 +168,8 @@ function checkStandardFieldsOK(ops, { readPreference: kReadPreference }; configureFailPoint(donorPrimary, "abortTenantMigrationBeforeLeavingBlockingState"); - TenantMigrationTest.assertAborted(tenantMigrationTest.runMigration( - migrationOpts, false /* retryOnRetryableErrors */, false /* automaticForgetMigration */)); + TenantMigrationTest.assertAborted( + tenantMigrationTest.runMigration(migrationOpts, {automaticForgetMigration: false})); const res = assert.commandWorked( donorPrimary.adminCommand({currentOp: true, desc: "tenant donor migration"})); @@ -203,8 +203,8 @@ function checkStandardFieldsOK(ops, { tenantId: kTenantId, readPreference: kReadPreference }; - assert.commandWorked(tenantMigrationTest.runMigration( - migrationOpts, false /* retryOnRetryableErrors */, false /* automaticForgetMigration */)); + assert.commandWorked( + tenantMigrationTest.runMigration(migrationOpts, {automaticForgetMigration: false})); let res = donorPrimary.adminCommand({currentOp: true, desc: "tenant donor migration"}); diff --git a/jstests/replsets/tenant_migration_donor_interrupt_on_stepdown_and_shutdown.js b/jstests/replsets/tenant_migration_donor_interrupt_on_stepdown_and_shutdown.js index f1e0874bd74..6650b991c89 100644 --- a/jstests/replsets/tenant_migration_donor_interrupt_on_stepdown_and_shutdown.js +++ b/jstests/replsets/tenant_migration_donor_interrupt_on_stepdown_and_shutdown.js @@ -100,8 +100,8 @@ function testDonorForgetMigrationInterrupt(interruptFunc, verifyCmdResponseFunc) const donorRstArgs = TenantMigrationUtil.createRstArgs(donorRst); - TenantMigrationTest.assertCommitted(tenantMigrationTest.runMigration( - migrationOpts, false /* retryOnRetryableErrors */, false /* automaticForgetMigration */)); + TenantMigrationTest.assertCommitted( + tenantMigrationTest.runMigration(migrationOpts, {automaticForgetMigration: false})); const forgetMigrationThread = new Thread( TenantMigrationUtil.forgetMigrationAsync, migrationOpts.migrationIdString, donorRstArgs); forgetMigrationThread.start(); diff --git a/jstests/replsets/tenant_migration_donor_kill_op_retry.js b/jstests/replsets/tenant_migration_donor_kill_op_retry.js index 4d20c7abb25..1c9ef35fc98 100644 --- a/jstests/replsets/tenant_migration_donor_kill_op_retry.js +++ b/jstests/replsets/tenant_migration_donor_kill_op_retry.js @@ -181,9 +181,7 @@ function makeTenantId() { let fp = configureFailPoint(tenantMigrationTest.getDonorPrimary(), fpName); TenantMigrationTest.assertCommitted( - tenantMigrationTest.runMigration(migrationOpts, - false /* retry on retriable errors */, - false /* Automatically forget migration */)); + tenantMigrationTest.runMigration(migrationOpts, {automaticForgetMigration: false})); const donorPrimary = tenantMigrationTest.getDonorPrimary(); const donorRstArgs = TenantMigrationUtil.createRstArgs(tenantMigrationTest.getDonorRst()); diff --git a/jstests/replsets/tenant_migration_donor_resume_on_stepup_and_restart.js b/jstests/replsets/tenant_migration_donor_resume_on_stepup_and_restart.js index 9845891b69c..ffa0698b07d 100644 --- a/jstests/replsets/tenant_migration_donor_resume_on_stepup_and_restart.js +++ b/jstests/replsets/tenant_migration_donor_resume_on_stepup_and_restart.js @@ -77,7 +77,7 @@ function testDonorStartMigrationInterrupt(interruptFunc, const runMigrationThread = new Thread(TenantMigrationUtil.runMigrationAsync, migrationOpts, donorRstArgs, - true /* retryOnRetryableErrors */); + {retryOnRetryableErrors: true}); runMigrationThread.start(); // Wait for donorStartMigration command to start. @@ -161,8 +161,8 @@ function testDonorForgetMigrationInterrupt(interruptFunc) { }; const donorRstArgs = TenantMigrationUtil.createRstArgs(donorRst); - TenantMigrationTest.assertCommitted(tenantMigrationTest.runMigration( - migrationOpts, false /* retryOnRetryableErrors */, false /* automaticForgetMigration */)); + TenantMigrationTest.assertCommitted( + tenantMigrationTest.runMigration(migrationOpts, {automaticForgetMigration: false})); const forgetMigrationThread = new Thread(TenantMigrationUtil.forgetMigrationAsync, migrationOpts.migrationIdString, donorRstArgs, diff --git a/jstests/replsets/tenant_migration_donor_rollback_recovery.js b/jstests/replsets/tenant_migration_donor_rollback_recovery.js index c1bbe26ec79..bccd2cd0c5f 100644 --- a/jstests/replsets/tenant_migration_donor_rollback_recovery.js +++ b/jstests/replsets/tenant_migration_donor_rollback_recovery.js @@ -133,7 +133,7 @@ function testRollbackInitialState() { migrationThread = new Thread(TenantMigrationUtil.runMigrationAsync, migrationOpts, donorRstArgs, - true /* retryOnRetryableErrors */); + {retryOnRetryableErrors: true}); migrationThread.start(); assert.soon(() => { return 1 === donorPrimary.getCollection(TenantMigrationTest.kConfigDonorsNS).count({ @@ -179,7 +179,7 @@ function testRollBackStateTransition(pauseFailPoint, setUpFailPoints, nextState) migrationThread = new Thread(TenantMigrationUtil.runMigrationAsync, migrationOpts, donorRstArgs, - true /* retryOnRetryableErrors */); + {retryOnRetryableErrors: true}); migrationThread.start(); pauseFp.wait(); }; @@ -222,10 +222,8 @@ function testRollBackMarkingStateGarbageCollectable() { let forgetMigrationThread; let setUpFunc = (tenantMigrationTest, donorRstArgs) => { - TenantMigrationTest.assertCommitted( - tenantMigrationTest.runMigration(migrationOpts, - true /* retryOnRetryableErrors */, - false /* automaticForgetMigration */)); + TenantMigrationTest.assertCommitted(tenantMigrationTest.runMigration( + migrationOpts, {retryOnRetryableErrors: true, automaticForgetMigration: false})); }; let rollbackOpsFunc = (tenantMigrationTest, donorRstArgs) => { @@ -269,7 +267,7 @@ function testRollBackRandom() { migrationThread = new Thread((donorRstArgs, migrationOpts) => { load("jstests/replsets/libs/tenant_migration_util.js"); assert.commandWorked(TenantMigrationUtil.runMigrationAsync( - migrationOpts, donorRstArgs, true /* retryOnRetryableErrors */)); + migrationOpts, donorRstArgs, {retryOnRetryableErrors: true})); assert.commandWorked(TenantMigrationUtil.forgetMigrationAsync( migrationOpts.migrationIdString, donorRstArgs, true /* retryOnRetryableErrors */)); }, donorRstArgs, migrationOpts); diff --git a/jstests/replsets/tenant_migration_donor_shutdown_while_blocking_reads.js b/jstests/replsets/tenant_migration_donor_shutdown_while_blocking_reads.js index fafbc195c07..9e9ab5f80a5 100644 --- a/jstests/replsets/tenant_migration_donor_shutdown_while_blocking_reads.js +++ b/jstests/replsets/tenant_migration_donor_shutdown_while_blocking_reads.js @@ -40,8 +40,7 @@ const migrationOpts = { }; let fp = configureFailPoint(donorPrimary, "pauseTenantMigrationBeforeLeavingBlockingState"); -assert.commandWorked( - tenantMigrationTest.startMigration(migrationOpts, false /* retryOnRetryableErrors */)); +assert.commandWorked(tenantMigrationTest.startMigration(migrationOpts)); fp.wait(); const donorDoc = diff --git a/jstests/replsets/tenant_migration_donor_state_machine.js b/jstests/replsets/tenant_migration_donor_state_machine.js index f4dfa147737..7c1c0211efd 100644 --- a/jstests/replsets/tenant_migration_donor_state_machine.js +++ b/jstests/replsets/tenant_migration_donor_state_machine.js @@ -220,8 +220,8 @@ function testStats(node, { configureFailPoint(recipientPrimary, "fpBeforeFulfillingDataConsistentPromise", {action: "stop", stopErrorCode: ErrorCodes.InternalError}); - TenantMigrationTest.assertAborted(tenantMigrationTest.runMigration( - migrationOpts, false /* retryOnRetryableErrors */, false /* automaticForgetMigration */)); + TenantMigrationTest.assertAborted( + tenantMigrationTest.runMigration(migrationOpts, {automaticForgetMigration: false})); abortRecipientFp.off(); const donorDoc = configDonorsColl.findOne({tenantId: kTenantId}); @@ -263,8 +263,8 @@ function testStats(node, { let abortDonorFp = configureFailPoint(donorPrimary, "abortTenantMigrationBeforeLeavingBlockingState"); - TenantMigrationTest.assertAborted(tenantMigrationTest.runMigration( - migrationOpts, false /* retryOnRetryableErrors */, false /* automaticForgetMigration */)); + TenantMigrationTest.assertAborted( + tenantMigrationTest.runMigration(migrationOpts, {automaticForgetMigration: false})); abortDonorFp.off(); const donorDoc = configDonorsColl.findOne({tenantId: kTenantId}); @@ -313,8 +313,8 @@ configDonorsColl.dropIndex({expireAt: 1}); donorPrimary.adminCommand({donorForgetMigration: 1, migrationId: migrationId}), ErrorCodes.NoSuchTenantMigration); - TenantMigrationTest.assertCommitted(tenantMigrationTest.runMigration( - migrationOpts, false /* retryOnRetryableErrors */, false /* automaticForgetMigration */)); + TenantMigrationTest.assertCommitted( + tenantMigrationTest.runMigration(migrationOpts, {automaticForgetMigration: false})); assert.commandWorked( donorPrimary.adminCommand({donorForgetMigration: 1, migrationId: migrationId})); diff --git a/jstests/replsets/tenant_migration_donor_try_abort.js b/jstests/replsets/tenant_migration_donor_try_abort.js index 78f41c4ac50..718db4df7ec 100644 --- a/jstests/replsets/tenant_migration_donor_try_abort.js +++ b/jstests/replsets/tenant_migration_donor_try_abort.js @@ -330,8 +330,7 @@ const migrationX509Options = TenantMigrationUtil.makeX509OptionsForTest(); const barrierBeforeWaitingForKeyWC = configureFailPoint( donorRst.getPrimary(), "pauseTenantMigrationDonorBeforeWaitingForKeysToReplicate"); - assert.commandWorked( - tenantMigrationTest.startMigration(migrationOpts, false /* retryOnRetryableErrors */)); + assert.commandWorked(tenantMigrationTest.startMigration(migrationOpts)); // Wait for the donor to begin waiting for replication of the copied keys. barrierBeforeWaitingForKeyWC.wait(); @@ -340,8 +339,7 @@ const migrationX509Options = TenantMigrationUtil.makeX509OptionsForTest(); // The migration should be unable to progress past the aborting index builds state because // it cannot replicate the copied keys to every donor node. - let res = assert.commandWorked(tenantMigrationTest.runDonorStartMigration( - migrationOpts, false /* waitForMigrationToComplete */, false /* retryOnRetryableErrors */)); + let res = assert.commandWorked(tenantMigrationTest.runDonorStartMigration(migrationOpts)); assert.eq("aborting index builds", res.state, tojson(res)); // Abort the migration and the donor should stop waiting for key replication, despite the write diff --git a/jstests/replsets/tenant_migration_donor_unblock_reads_and_writes_on_completion.js b/jstests/replsets/tenant_migration_donor_unblock_reads_and_writes_on_completion.js index 5d10580382f..e9f56b09935 100644 --- a/jstests/replsets/tenant_migration_donor_unblock_reads_and_writes_on_completion.js +++ b/jstests/replsets/tenant_migration_donor_unblock_reads_and_writes_on_completion.js @@ -91,8 +91,7 @@ const kCollName = "testColl"; configureFailPoint(donorPrimary, "pauseTenantMigrationBeforeLeavingBlockingState"); let abortFp = configureFailPoint(donorPrimary, "abortTenantMigrationBeforeLeavingBlockingState"); - assert.commandWorked( - tenantMigrationTest.startMigration(migrationOpts, false /* retryOnRetryableErrors */)); + assert.commandWorked(tenantMigrationTest.startMigration(migrationOpts)); blockingFp.wait(); donorRst.awaitReplication(); @@ -135,8 +134,7 @@ const kCollName = "testColl"; let blockingFp = configureFailPoint(donorPrimary, "pauseTenantMigrationBeforeLeavingBlockingState"); - assert.commandWorked( - tenantMigrationTest.startMigration(migrationOpts, false /* retryOnRetryableErrors */)); + assert.commandWorked(tenantMigrationTest.startMigration(migrationOpts)); blockingFp.wait(); donorRst.awaitReplication(); @@ -178,8 +176,7 @@ const kCollName = "testColl"; let blockingFp = configureFailPoint(donorPrimary, "pauseTenantMigrationBeforeLeavingBlockingState"); - assert.commandWorked( - tenantMigrationTest.startMigration(migrationOpts, false /* retryOnRetryableErrors */)); + assert.commandWorked(tenantMigrationTest.startMigration(migrationOpts)); blockingFp.wait(); // Run a read command and a write command against the primary, and wait for them to block. diff --git a/jstests/replsets/tenant_migration_donor_wont_retry_recipientsyncdata_on_non_retriable_interruption_errors.js b/jstests/replsets/tenant_migration_donor_wont_retry_recipientsyncdata_on_non_retriable_interruption_errors.js index 332004e5952..eff4e53facb 100644 --- a/jstests/replsets/tenant_migration_donor_wont_retry_recipientsyncdata_on_non_retriable_interruption_errors.js +++ b/jstests/replsets/tenant_migration_donor_wont_retry_recipientsyncdata_on_non_retriable_interruption_errors.js @@ -48,7 +48,7 @@ const donorRstArgs = TenantMigrationUtil.createRstArgs(donorRst); const runMigrationThread = new Thread(TenantMigrationUtil.runMigrationAsync, migrationOpts, donorRstArgs, - true /* retryOnRetryableErrors */); + {retryOnRetryableErrors: true}); runMigrationThread.start(); TenantMigrationTest.assertAborted(runMigrationThread.returnData()); diff --git a/jstests/replsets/tenant_migration_drop_state_doc_collection.js b/jstests/replsets/tenant_migration_drop_state_doc_collection.js index 71ee84afef1..70a5517af4c 100644 --- a/jstests/replsets/tenant_migration_drop_state_doc_collection.js +++ b/jstests/replsets/tenant_migration_drop_state_doc_collection.js @@ -71,16 +71,11 @@ function testDroppingStateDocCollections(tenantMigrationTest, fpName, { let fp; if (fpName) { fp = configureFailPoint(donorPrimary, fpName, {tenantId: tenantId}); - assert.commandWorked( - tenantMigrationTest.startMigration(migrationOptsBeforeDrop, - false /* retryOnRetryableErrors */, - false /* automaticForgetMigration */)); + assert.commandWorked(tenantMigrationTest.startMigration(migrationOptsBeforeDrop)); fp.wait(); } else { - TenantMigrationTest.assertCommitted( - tenantMigrationTest.runMigration(migrationOptsBeforeDrop, - false /* retryOnRetryableErrors */, - false /* automaticForgetMigration */)); + TenantMigrationTest.assertCommitted(tenantMigrationTest.runMigration( + migrationOptsBeforeDrop, {automaticForgetMigration: false})); } if (dropDonorsCollection) { @@ -123,9 +118,8 @@ function testDroppingStateDocCollections(tenantMigrationTest, fpName, { const migrationOptsAfterDrop = retryWithDifferentMigrationId ? makeMigrationOpts(tenantMigrationTest, tenantId) : migrationOptsBeforeDrop; - const runMigrationRes = tenantMigrationTest.runMigration(migrationOptsAfterDrop, - false /* retryOnRetryableErrors */, - false /* automaticForgetMigration */); + const runMigrationRes = + tenantMigrationTest.runMigration(migrationOptsAfterDrop, {automaticForgetMigration: false}); if (expectedRunMigrationError) { assert.commandFailedWithCode(runMigrationRes, expectedRunMigrationError); } else { diff --git a/jstests/replsets/tenant_migration_external_keys_ttl.js b/jstests/replsets/tenant_migration_external_keys_ttl.js index 145296badc1..cc7fd46cb6d 100644 --- a/jstests/replsets/tenant_migration_external_keys_ttl.js +++ b/jstests/replsets/tenant_migration_external_keys_ttl.js @@ -128,9 +128,8 @@ function makeTestParams() { } const [tenantId, migrationId, migrationOpts] = makeTestParams(); - TenantMigrationTest.assertCommitted(tmt.runMigration(migrationOpts, - false /* retryOnRetryableErrors */, - false /* automaticForgetMigration */)); + TenantMigrationTest.assertCommitted( + tmt.runMigration(migrationOpts, {automaticForgetMigration: false})); // The keys should have been created without a TTL deadline. verifyExternalKeys(tmt.getDonorPrimary(), {migrationId, expectTTLValue: false}); @@ -144,9 +143,8 @@ function makeTestParams() { tenantId: makeTenantId(), }; - TenantMigrationTest.assertCommitted(tmt.runMigration(otherMigrationOpts, - false /* retryOnRetryableErrors */, - false /* automaticForgetMigration */)); + TenantMigrationTest.assertCommitted( + tmt.runMigration(otherMigrationOpts, {automaticForgetMigration: false})); // The keys should have been created without a TTL deadline. verifyExternalKeys(tmt.getDonorPrimary(), @@ -187,9 +185,8 @@ function makeTestParams() { assert.eq(origDonorKeysExpirationParam, 60 * 60 * 24); // 1 day. assert.eq(origRecipientKeysExpirationParam, 60 * 60 * 24); // 1 day. - TenantMigrationTest.assertCommitted(tmt.runMigration(migrationOpts, - false /* retryOnRetryableErrors */, - false /* automaticForgetMigration */)); + TenantMigrationTest.assertCommitted( + tmt.runMigration(migrationOpts, {automaticForgetMigration: false})); // The keys should have been created without a TTL deadline. verifyExternalKeys(tmt.getDonorPrimary(), {migrationId, expectTTLValue: false}); diff --git a/jstests/replsets/tenant_migration_recipient_resume_on_stepup_and_restart.js b/jstests/replsets/tenant_migration_recipient_resume_on_stepup_and_restart.js index 8fc9df97729..5f1f1db7c1f 100644 --- a/jstests/replsets/tenant_migration_recipient_resume_on_stepup_and_restart.js +++ b/jstests/replsets/tenant_migration_recipient_resume_on_stepup_and_restart.js @@ -59,10 +59,8 @@ function testRecipientSyncDataInterrupt(interruptFunc, recipientRestarted) { }; const donorRstArgs = TenantMigrationUtil.createRstArgs(donorRst); - const runMigrationThread = new Thread(TenantMigrationUtil.runMigrationAsync, - migrationOpts, - donorRstArgs, - false /* retryOnRetryableErrors */); + const runMigrationThread = + new Thread(TenantMigrationUtil.runMigrationAsync, migrationOpts, donorRstArgs); runMigrationThread.start(); // Wait for recipientSyncData command to start. @@ -142,8 +140,8 @@ function testRecipientForgetMigrationInterrupt(interruptFunc) { }; const donorRstArgs = TenantMigrationUtil.createRstArgs(donorRst); - TenantMigrationTest.assertCommitted(tenantMigrationTest.runMigration( - migrationOpts, false /* retryOnRetryableErrors */, false /* automaticForgetMigration */)); + TenantMigrationTest.assertCommitted( + tenantMigrationTest.runMigration(migrationOpts, {automaticForgetMigration: false})); const forgetMigrationThread = new Thread(TenantMigrationUtil.forgetMigrationAsync, migrationOpts.migrationIdString, donorRstArgs, diff --git a/jstests/replsets/tenant_migration_recipient_rollback_recovery.js b/jstests/replsets/tenant_migration_recipient_rollback_recovery.js index 5a03ca88d46..60344d7910c 100644 --- a/jstests/replsets/tenant_migration_recipient_rollback_recovery.js +++ b/jstests/replsets/tenant_migration_recipient_rollback_recovery.js @@ -130,10 +130,8 @@ function testRollbackInitialState() { // Start the migration asynchronously and wait for the primary to insert the state doc. migrationOpts = makeMigrationOpts(tenantMigrationTest, migrationId, kTenantId + "-initial"); - migrationThread = new Thread(TenantMigrationUtil.runMigrationAsync, - migrationOpts, - donorRstArgs, - false /* retryOnRetryableErrors */); + migrationThread = + new Thread(TenantMigrationUtil.runMigrationAsync, migrationOpts, donorRstArgs); migrationThread.start(); assert.soon(() => { return 1 === @@ -181,10 +179,8 @@ function testRollBackStateTransition(pauseFailPoint, setUpFailPoints, nextState, migrationOpts = makeMigrationOpts(tenantMigrationTest, migrationId, kTenantId + "-" + nextState); - migrationThread = new Thread(TenantMigrationUtil.runMigrationAsync, - migrationOpts, - donorRstArgs, - false /* retryOnRetryableErrors */); + migrationThread = + new Thread(TenantMigrationUtil.runMigrationAsync, migrationOpts, donorRstArgs); migrationThread.start(); pauseFp.wait(); }; @@ -230,9 +226,7 @@ function testRollBackMarkingStateGarbageCollectable() { migrationOpts = makeMigrationOpts( tenantMigrationTest, migrationId, kTenantId + "-markGarbageCollectable"); TenantMigrationTest.assertCommitted( - tenantMigrationTest.runMigration(migrationOpts, - false /* retryOnRetryableErrors */, - false /* automaticForgetMigration */)); + tenantMigrationTest.runMigration(migrationOpts, {automaticForgetMigration: false})); }; let rollbackOpsFunc = (tenantMigrationTest, donorRstArgs) => { @@ -278,8 +272,8 @@ function testRollBackRandom() { migrationOpts = makeMigrationOpts(tenantMigrationTest, migrationId, kTenantId + "-random"); migrationThread = new Thread((donorRstArgs, migrationOpts) => { load("jstests/replsets/libs/tenant_migration_util.js"); - assert.commandWorked(TenantMigrationUtil.runMigrationAsync( - migrationOpts, donorRstArgs, false /* retryOnRetryableErrors */)); + assert.commandWorked( + TenantMigrationUtil.runMigrationAsync(migrationOpts, donorRstArgs)); assert.commandWorked(TenantMigrationUtil.forgetMigrationAsync( migrationOpts.migrationIdString, donorRstArgs, false /* retryOnRetryableErrors */)); }, donorRstArgs, migrationOpts); diff --git a/jstests/replsets/tenant_migration_recipient_shard_merge_learn_files.js b/jstests/replsets/tenant_migration_recipient_shard_merge_learn_files.js index 5f3de570897..2f3856cb0b6 100644 --- a/jstests/replsets/tenant_migration_recipient_shard_merge_learn_files.js +++ b/jstests/replsets/tenant_migration_recipient_shard_merge_learn_files.js @@ -42,9 +42,6 @@ const donorPrimary = tenantMigrationTest.getDonorPrimary(); // Do a majority write. tenantMigrationTest.insertDonorDB(tenantDB, collName); -// Ensure our new collections appear in the backup cursor's checkpoint. -assert.commandWorked(donorPrimary.adminCommand({fsync: 1})); - const failpoint = "fpAfterStartingOplogApplierMigrationRecipientInstance"; const waitInFailPoint = configureFailPoint(recipientPrimary, failpoint, {action: "hang"}); @@ -59,7 +56,8 @@ const migrationOpts = { }; jsTestLog(`Starting the tenant migration to wait in failpoint: ${failpoint}`); -assert.commandWorked(tenantMigrationTest.startMigration(migrationOpts)); +assert.commandWorked( + tenantMigrationTest.startMigration(migrationOpts, {enableDonorStartMigrationFsync: true})); waitInFailPoint.wait(); diff --git a/jstests/replsets/tenant_migration_recipient_stepdown_after_forget.js b/jstests/replsets/tenant_migration_recipient_stepdown_after_forget.js index 4fca93ee534..7e2ca21b321 100644 --- a/jstests/replsets/tenant_migration_recipient_stepdown_after_forget.js +++ b/jstests/replsets/tenant_migration_recipient_stepdown_after_forget.js @@ -37,7 +37,7 @@ const migrationOpts = { }; TenantMigrationTest.assertCommitted(tenantMigrationTest.runMigration( - migrationOpts, true /* retryOnRetryableErrors */, false /* automaticForgetMigration */)); + migrationOpts, {retryOnRetryableErrors: true, automaticForgetMigration: false})); const fpBeforeDroppingOplogBufferCollection = configureFailPoint(tenantMigrationTest.getRecipientPrimary(), diff --git a/jstests/replsets/tenant_migration_shard_merge_import_write_conflict_retry.js b/jstests/replsets/tenant_migration_shard_merge_import_write_conflict_retry.js index 35c3d125ff6..76b20f3bd3a 100644 --- a/jstests/replsets/tenant_migration_shard_merge_import_write_conflict_retry.js +++ b/jstests/replsets/tenant_migration_shard_merge_import_write_conflict_retry.js @@ -62,9 +62,6 @@ assert.commandWorked(db.runCommand({ indexes: [{key: {a: 1}, name: "a_1"}], writeConcern: {w: "majority"} })); - -// Ensure our new collections appear in the backup cursor's checkpoint. -assert.commandWorked(db.adminCommand({fsync: 1})); })(); // Enable Failpoints to simulate WriteConflict exception while importing donor files. @@ -82,7 +79,8 @@ const migrationOpts = { migrationIdString: extractUUIDFromObject(migrationId), tenantId: kTenantId, }; -TenantMigrationTest.assertCommitted(tenantMigrationTest.runMigration(migrationOpts)); +TenantMigrationTest.assertCommitted( + tenantMigrationTest.runMigration(migrationOpts, {enableDonorStartMigrationFsync: true})); tenantMigrationTest.getRecipientRst().nodes.forEach(node => { for (let collectionName of ["myCollection", "myCappedCollection"]) { diff --git a/jstests/replsets/tenant_migration_ssl_configuration.js b/jstests/replsets/tenant_migration_ssl_configuration.js index d86bed5fa46..70dcfdc19a7 100644 --- a/jstests/replsets/tenant_migration_ssl_configuration.js +++ b/jstests/replsets/tenant_migration_ssl_configuration.js @@ -252,8 +252,7 @@ const kExpiredMigrationCertificates = { const stateRes = assert.commandWorked(TenantMigrationUtil.runTenantMigrationCommand( donorStartMigrationCmdObj, donorRst, - false /* retryOnRetryableErrors */, - TenantMigrationUtil.isMigrationCompleted /* shouldStopFunc */)); + {retryOnRetryableErrors: false, shouldStopFunc: TenantMigrationUtil.isMigrationCompleted})); assert.eq(stateRes.state, TenantMigrationTest.DonorState.kCommitted); assert.commandWorked( donorRst.getPrimary().adminCommand({donorForgetMigration: 1, migrationId: migrationId})); @@ -298,8 +297,7 @@ const kExpiredMigrationCertificates = { const stateRes = assert.commandWorked(TenantMigrationUtil.runTenantMigrationCommand( donorStartMigrationCmdObj, donorRst, - false /* retryOnRetryableErrors */, - TenantMigrationUtil.isMigrationCompleted /* shouldStopFunc */)); + {retryOnRetryableErrors: false, shouldStopFunc: TenantMigrationUtil.isMigrationCompleted})); assert.eq(stateRes.state, TenantMigrationTest.DonorState.kCommitted); donorRst.stopSet(); @@ -345,8 +343,7 @@ const kExpiredMigrationCertificates = { const stateRes = assert.commandWorked(TenantMigrationUtil.runTenantMigrationCommand( donorStartMigrationCmdObj, donorRst, - false /* retryOnRetryableErrors */, - TenantMigrationUtil.isMigrationCompleted /* shouldStopFunc */)); + {retryOnRetryableErrors: false, shouldStopFunc: TenantMigrationUtil.isMigrationCompleted})); assert.eq(stateRes.state, TenantMigrationTest.DonorState.kCommitted); donorRst.stopSet(); diff --git a/jstests/replsets/tenant_migration_stepup_recovery_after_abort.js b/jstests/replsets/tenant_migration_stepup_recovery_after_abort.js index 6d54e1d9e6c..4e3bddbf9ab 100644 --- a/jstests/replsets/tenant_migration_stepup_recovery_after_abort.js +++ b/jstests/replsets/tenant_migration_stepup_recovery_after_abort.js @@ -51,8 +51,7 @@ assert.commandWorked(donorPrimary.getCollection(tenantId + "_testDb.testColl").i const donorFp = configureFailPoint(donorPrimary, "abortTenantMigrationBeforeLeavingBlockingState"); TenantMigrationTest.assertAborted( - tenantMigrationTest.runMigration( - migrationOpts, false /* retryOnRetryableErrors */, false /* automaticForgetMigration */), + tenantMigrationTest.runMigration(migrationOpts, {automaticForgetMigration: false}), ErrorCodes.InternalError); donorFp.off(); @@ -61,8 +60,7 @@ assert.commandWorked( assert.commandWorked(donorPrimary.adminCommand({replSetFreeze: 0})); TenantMigrationTest.assertAborted( - tenantMigrationTest.runMigration( - migrationOpts, false /* retryOnRetryableErrors */, false /* automaticForgetMigration */), + tenantMigrationTest.runMigration(migrationOpts, {automaticForgetMigration: false}), ErrorCodes.InternalError); assert.commandWorked(tenantMigrationTest.forgetMigration(migrationOpts.migrationIdString)); diff --git a/jstests/replsets/tenant_migration_timeseries_retryable_write_oplog_cloning.js b/jstests/replsets/tenant_migration_timeseries_retryable_write_oplog_cloning.js index 2b24f7a4dfa..21da165b67c 100644 --- a/jstests/replsets/tenant_migration_timeseries_retryable_write_oplog_cloning.js +++ b/jstests/replsets/tenant_migration_timeseries_retryable_write_oplog_cloning.js @@ -116,8 +116,8 @@ function testOplogCloning(ordered) { tenantId: kTenantId, }; - TenantMigrationTest.assertCommitted(tenantMigrationTest.runMigration( - migrationOpts, false /* retryOnRetryableErrors */, false /* automaticForgetMigration */)); + TenantMigrationTest.assertCommitted( + tenantMigrationTest.runMigration(migrationOpts, {automaticForgetMigration: false})); const donorDoc = donorPrimary.getCollection(TenantMigrationTest.kConfigDonorsNS).findOne({ tenantId: kTenantId |