diff options
author | Daniel Gottlieb <daniel.gottlieb@mongodb.com> | 2022-05-07 20:39:42 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-05-08 01:53:37 +0000 |
commit | 3c3575a38538c73a3bf8a4f23435680031bfdd8b (patch) | |
tree | e20a900c2fbdeb670ac85b7ec89e4d2db83939fc /jstests | |
parent | b69ac06ab6d97d62d35fc8554b7273a1a9372cf7 (diff) | |
download | mongo-3c3575a38538c73a3bf8a4f23435680031bfdd8b.tar.gz |
Revert "SERVER-66027: Speed up tenant migration tests."
This reverts commit b69ac06ab6d97d62d35fc8554b7273a1a9372cf7.
Diffstat (limited to 'jstests')
6 files changed, 30 insertions, 66 deletions
diff --git a/jstests/replsets/libs/tenant_migration_test.js b/jstests/replsets/libs/tenant_migration_test.js index b12512b2b8d..b7b81e3f01d 100644 --- a/jstests/replsets/libs/tenant_migration_test.js +++ b/jstests/replsets/libs/tenant_migration_test.js @@ -38,7 +38,6 @@ function TenantMigrationTest({ initiateRstWithHighElectionTimeout = true, quickGarbageCollection = false, insertDataForTenant, - optimizeMigrations = true, }) { const donorPassedIn = (donorRst !== undefined); const recipientPassedIn = (recipientRst !== undefined); @@ -48,15 +47,9 @@ function TenantMigrationTest({ const nodes = sharedOptions.nodes || 2; const setParameterOpts = sharedOptions.setParameter || {}; - if (optimizeMigrations) { - // A tenant migration recipient's `OplogFetcher` uses aggregation which does not support - // tailable awaitdata cursors. For aggregation commands `OplogFetcher` will default to half - // the election timeout (e.g: 5 seconds) between getMores. That wait is largely unnecessary. - setParameterOpts["failpoint.setSmallOplogGetMoreMaxTimeMS"] = tojson({"mode": "alwaysOn"}); - } if (quickGarbageCollection) { - setParameterOpts.tenantMigrationGarbageCollectionDelayMS = 0; - setParameterOpts.ttlMonitorSleepSecs = 1; + setParameterOpts.tenantMigrationGarbageCollectionDelayMS = 3 * 1000; + setParameterOpts.ttlMonitorSleepSecs = 3; } donorRst = donorPassedIn ? donorRst : performSetUp(true /* isDonor */); diff --git a/jstests/replsets/tenant_migration_commit_transaction_retry.js b/jstests/replsets/tenant_migration_commit_transaction_retry.js index edf72d5a85b..e124868af42 100644 --- a/jstests/replsets/tenant_migration_commit_transaction_retry.js +++ b/jstests/replsets/tenant_migration_commit_transaction_retry.js @@ -18,6 +18,15 @@ load("jstests/replsets/libs/tenant_migration_util.js"); load("jstests/replsets/rslib.js"); load("jstests/libs/uuid_util.js"); +const kGarbageCollectionParams = { + // Set the delay before a donor state doc is garbage collected to be short to speed up + // the test. + tenantMigrationGarbageCollectionDelayMS: 3 * 1000, + + // Set the TTL monitor to run at a smaller interval to speed up the test. + ttlMonitorSleepSecs: 1, +}; + const tenantMigrationTest = new TenantMigrationTest( {name: jsTestName(), sharedOptions: {nodes: 1}, quickGarbageCollection: true}); @@ -86,11 +95,7 @@ pauseTenantMigrationBeforeLeavingDataSyncState.off(); waitInOplogApplier.off(); TenantMigrationTest.assertCommitted(tenantMigrationTest.waitForMigrationToComplete(migrationOpts)); -// With `quickGarbageCollection` it's likely that forgetting the migration will race with its -// natural destruction. -assert.commandWorkedOrFailedWithCode( - tenantMigrationTest.forgetMigration(migrationOpts.migrationIdString), - [ErrorCodes.NoSuchTenantMigration]); +assert.commandWorked(tenantMigrationTest.forgetMigration(migrationOpts.migrationIdString)); tenantMigrationTest.waitForMigrationGarbageCollection(migrationId, kTenantId); // Test the client can retry commitTransaction against the recipient for transactions that committed @@ -109,8 +114,7 @@ jsTestLog("Running a back-to-back migration"); const tenantMigrationTest2 = new TenantMigrationTest({ name: jsTestName() + "2", donorRst: tenantMigrationTest.getRecipientRst(), - sharedOptions: {nodes: 1}, - quickGarbageCollection: true, + sharedOptions: {nodes: 1, setParameter: kGarbageCollectionParams} }); const migrationId2 = UUID(); const migrationOpts2 = { @@ -127,11 +131,7 @@ donorTxnEntries.forEach((txnEntry) => { assert.commandWorked(recipientPrimary2.adminCommand( {commitTransaction: 1, lsid: txnEntry._id, txnNumber: txnEntry.txnNum, autocommit: false})); }); -// With `quickGarbageCollection` it's likely that forgetting the migration will race with its -// natural destruction. -assert.commandWorkedOrFailedWithCode( - tenantMigrationTest2.forgetMigration(migrationOpts2.migrationIdString), - [ErrorCodes.NoSuchTenantMigration]); +assert.commandWorked(tenantMigrationTest2.forgetMigration(migrationOpts2.migrationIdString)); tenantMigrationTest2.waitForMigrationGarbageCollection(migrationId2, kTenantId); tenantMigrationTest2.stop(); diff --git a/jstests/replsets/tenant_migration_concurrent_reads_on_recipient.js b/jstests/replsets/tenant_migration_concurrent_reads_on_recipient.js index 71d12c1f044..2915eebc65f 100644 --- a/jstests/replsets/tenant_migration_concurrent_reads_on_recipient.js +++ b/jstests/replsets/tenant_migration_concurrent_reads_on_recipient.js @@ -90,7 +90,6 @@ function testRejectAllReadsAfterCloningDone({testCase, dbName, collName, tenantM beforeFetchingTransactionsFp.off(); TenantMigrationTest.assertCommitted(runMigrationThread.returnData()); assert.commandWorked(tenantMigrationTest.forgetMigration(migrationOpts.migrationIdString)); - tenantMigrationTest.waitForMigrationGarbageCollection(migrationOpts.migrationIdString); } /** @@ -170,7 +169,6 @@ function testRejectOnlyReadsWithAtClusterTimeLessThanRejectReadsBeforeTimestamp( }); assert.commandWorked(tenantMigrationTest.forgetMigration(migrationOpts.migrationIdString)); - tenantMigrationTest.waitForMigrationGarbageCollection(migrationOpts.migrationIdString); } /** @@ -223,7 +221,6 @@ function testDoNotRejectReadsAfterMigrationAbortedBeforeReachingRejectReadsBefor runCommand(db, testCase.command(collName), null); } }); - tenantMigrationTest.waitForMigrationGarbageCollection(migrationOpts.migrationIdString); } /** @@ -415,34 +412,25 @@ const testFuncs = { testDoNotRejectReadsAfterMigrationAbortedAfterReachingRejectReadsBeforeTimestamp }; -const tenantMigrationTest = new TenantMigrationTest({ - name: jsTestName(), - quickGarbageCollection: true, -}); for (const [testName, testFunc] of Object.entries(testFuncs)) { for (const [testCaseName, testCase] of Object.entries(testCases)) { jsTest.log("Testing " + testName + " with testCase " + testCaseName); let tenantId = `${testCaseName}-${testName}`; - let migrationDb = `${tenantId}_test`; - tenantMigrationTest.insertDonorDB(migrationDb, "test"); let dbName = `${tenantId}_${kTenantDefinedDbName}`; + const tenantMigrationTest = new TenantMigrationTest({ + name: jsTestName(), + quickGarbageCollection: true, + insertDataForTenant: tenantId, + }); - // Force the recipient to preserve all snapshot history to ensure that snapshot reads do - // not fail with SnapshotTooOld due to snapshot being unavailable. + // Force the recipient to preserve all snapshot history to ensure that snapshot reads do not + // fail with SnapshotTooOld due to snapshot being unavailable. tenantMigrationTest.getRecipientRst().nodes.forEach(node => { configureFailPoint(node, "WTPreserveSnapshotHistoryIndefinitely"); }); testFunc({testCase, dbName, collName: kCollName, tenantMigrationTest}); - - // ShardMerge is not robust to migrating the twice in quick succession. We drop the data - // files to ensure a subsequent tenant migration will avoid trying to merge files from the - // previous migration. - assert.commandWorked( - tenantMigrationTest.getDonorRst().getPrimary().getDB(migrationDb).dropDatabase()); - assert.commandWorked( - tenantMigrationTest.getRecipientRst().getPrimary().getDB(migrationDb).dropDatabase()); + tenantMigrationTest.stop(); } } -tenantMigrationTest.stop(); })(); diff --git a/jstests/replsets/tenant_migration_donor_retry.js b/jstests/replsets/tenant_migration_donor_retry.js index 6229c81b153..7ac00d9471e 100644 --- a/jstests/replsets/tenant_migration_donor_retry.js +++ b/jstests/replsets/tenant_migration_donor_retry.js @@ -43,11 +43,8 @@ function setup() { donorRst.startSet(); donorRst.initiate(); - const tenantMigrationTest = new TenantMigrationTest({ - name: jsTestName(), - donorRst: donorRst, - sharedOptions: {setParameter: garbageCollectionOpts}, - }); + const tenantMigrationTest = new TenantMigrationTest( + {name: jsTestName(), donorRst: donorRst, quickGarbageCollection: true}); return { tenantMigrationTest, teardown: function() { diff --git a/jstests/replsets/tenant_migration_recipient_current_op.js b/jstests/replsets/tenant_migration_recipient_current_op.js index 19d1bbdbd6d..a2ce3cb4a2f 100644 --- a/jstests/replsets/tenant_migration_recipient_current_op.js +++ b/jstests/replsets/tenant_migration_recipient_current_op.js @@ -24,12 +24,7 @@ load("jstests/libs/parallelTester.js"); // For the Thread(). load("jstests/replsets/libs/tenant_migration_test.js"); load("jstests/replsets/libs/tenant_migration_util.js"); -const tenantMigrationTest = new TenantMigrationTest({ - name: jsTestName(), - // This test relies on a large awaitData timeout keeping a window open such that failpoints - // configured for hanging are hit. - optimizeMigrations: false, -}); +const tenantMigrationTest = new TenantMigrationTest({name: jsTestName()}); const kMigrationId = UUID(); const kTenantId = 'testTenantId'; @@ -330,4 +325,4 @@ forgetMigrationThread.start(); } tenantMigrationTest.stop(); -})(); +})();
\ No newline at end of file diff --git a/jstests/replsets/tenant_migration_recipient_ttl.js b/jstests/replsets/tenant_migration_recipient_ttl.js index 7112c8f58ed..5ab8658a444 100644 --- a/jstests/replsets/tenant_migration_recipient_ttl.js +++ b/jstests/replsets/tenant_migration_recipient_ttl.js @@ -17,18 +17,8 @@ load("jstests/libs/uuid_util.js"); // For extractUUIDFromObject(). load("jstests/replsets/libs/tenant_migration_test.js"); load("jstests/replsets/libs/tenant_migration_util.js"); -const kGarbageCollectionParams = { - // Set the delay to 20s so that we can see the `expireAt` set prior to the document vanishing. - tenantMigrationGarbageCollectionDelayMS: 20 * 1000, - - // Set the TTL monitor to run at a smaller interval to speed up the test. - ttlMonitorSleepSecs: 1 -}; - -const tenantMigrationTest = new TenantMigrationTest({ - name: jsTestName(), - sharedOptions: {setParameter: kGarbageCollectionParams}, -}); +const tenantMigrationTest = + new TenantMigrationTest({name: jsTestName(), quickGarbageCollection: true}); const kRecipientTTLIndexName = "TenantMigrationRecipientTTLIndex"; @@ -80,7 +70,8 @@ assert(stateDocQuery[0].hasOwnProperty("expireAt"), tojson(stateDocQuery)); // Sleep past the garbage collection delay time, and then make sure the state document for our // migration does not exist. -jsTestLog("Waiting for the state document to have been deleted."); +jsTestLog("Sleeping and then expecting the state document to have been deleted."); +sleep(30000); // The garbage collection delay is 30s. tenantMigrationTest.waitForMigrationGarbageCollection(kMigrationId, kTenantId); tenantMigrationTest.stop(); |