0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

SERVER-55407 Tenant migration initial sync tests should prevent TenantMigrationAccessBlocker from transitioning to the next state while the check is being done

This commit is contained in:
Cheahuychou Mao 2021-03-19 22:02:45 +00:00 committed by Evergreen Agent
parent c2a96ca05d
commit 0634ca5d6e
2 changed files with 16 additions and 0 deletions

View File

@ -14,6 +14,7 @@
load("jstests/libs/fail_point_util.js");
load("jstests/libs/uuid_util.js");
load("jstests/libs/parallelTester.js");
load("jstests/libs/write_concern_util.js");
load("jstests/replsets/libs/tenant_migration_test.js");
const tenantMigrationTest = new TenantMigrationTest({name: jsTestName()});
@ -73,6 +74,11 @@ jsTestLog("Waiting for initial sync to finish: " + initialSyncNode.port);
initialSyncNode.getDB('admin').adminCommand(
{configureFailPoint: 'initialSyncHangBeforeChoosingSyncSource', mode: "off"});
donorRst.awaitSecondaryNodes();
donorRst.awaitReplication();
// Stop replication on the node so that the TenantMigrationAccessBlocker cannot transition its state
// past what is reflected in the state doc read below.
stopServerReplication(initialSyncNode);
let configDonorsColl = initialSyncNode.getCollection(TenantMigrationTest.kConfigDonorsNS);
let donorDoc = configDonorsColl.findOne({tenantId: kTenantId});
@ -135,6 +141,8 @@ if (fp) {
fp.off();
}
restartServerReplication(initialSyncNode);
assert.commandWorked(tenantMigrationTest.waitForMigrationToComplete(migrationOpts));
assert.commandWorked(tenantMigrationTest.forgetMigration(migrationOpts.migrationIdString));
tenantMigrationTest.stop();

View File

@ -13,6 +13,7 @@
load("jstests/libs/fail_point_util.js");
load("jstests/libs/uuid_util.js");
load("jstests/libs/write_concern_util.js");
load("jstests/replsets/libs/tenant_migration_test.js");
const tenantMigrationTest = new TenantMigrationTest({name: jsTestName()});
@ -51,6 +52,11 @@ const initialSyncNode = recipientRst.add({rsConfig: {priority: 0, votes: 0}});
recipientRst.reInitiate();
jsTestLog("Waiting for initial sync to finish.");
recipientRst.awaitSecondaryNodes();
recipientRst.awaitReplication();
// Stop replication on the node so that the TenantMigrationAccessBlocker cannot transition its state
// past what is reflected in the state doc read below.
stopServerReplication(initialSyncNode);
const configRecipientsColl = initialSyncNode.getCollection(TenantMigrationTest.kConfigRecipientsNS);
const recipientDoc = configRecipientsColl.findOne({tenantId: kTenantId});
@ -85,5 +91,7 @@ if (recipientDoc) {
}
}
restartServerReplication(initialSyncNode);
tenantMigrationTest.stop();
})();