2022-03-14 21:09:34 +00:00
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* Tests that runs a shard split to completion.
|
|
|
|
|
* @tags: [requires_fcv_52, featureFlagShardSplit]
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
load("jstests/libs/fail_point_util.js"); // for "configureFailPoint"
|
|
|
|
|
load('jstests/libs/parallel_shell_helpers.js'); // for "startParallelShell"
|
|
|
|
|
load("jstests/serverless/libs/basic_serverless_test.js");
|
|
|
|
|
|
|
|
|
|
(function() {
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
const recipientTagName = "recipientNode";
|
|
|
|
|
const recipientSetName = "recipientSetName";
|
2022-04-12 13:54:25 +00:00
|
|
|
const tenantIds = ["tenant1", "tenant2"];
|
|
|
|
|
|
2022-03-30 12:44:27 +00:00
|
|
|
const test =
|
|
|
|
|
new BasicServerlessTest({recipientTagName, recipientSetName, quickGarbageCollection: true});
|
2022-03-14 21:09:34 +00:00
|
|
|
|
|
|
|
|
test.addRecipientNodes();
|
|
|
|
|
test.donor.awaitSecondaryNodes();
|
|
|
|
|
|
2022-04-12 13:54:25 +00:00
|
|
|
const operation = test.createSplitOperation(tenantIds);
|
2022-03-14 21:09:34 +00:00
|
|
|
|
|
|
|
|
jsTestLog("Running the commitShardSplit operation");
|
2022-04-12 13:54:25 +00:00
|
|
|
assert.commandWorked(operation.commit());
|
2022-03-25 22:19:24 +00:00
|
|
|
|
|
|
|
|
test.removeRecipientNodesFromDonor();
|
2022-03-14 21:09:34 +00:00
|
|
|
|
2022-03-30 12:44:27 +00:00
|
|
|
// getPrimary can only be called once recipient nodes have been remove from test.
|
2022-04-12 13:54:25 +00:00
|
|
|
assertMigrationState(test.donor.getPrimary(), operation.migrationId, "committed");
|
|
|
|
|
|
|
|
|
|
operation.forget();
|
2022-03-30 12:44:27 +00:00
|
|
|
|
2022-04-12 13:54:25 +00:00
|
|
|
test.waitForGarbageCollection(operation.migrationId, tenantIds);
|
2022-03-14 21:09:34 +00:00
|
|
|
|
|
|
|
|
test.stop();
|
|
|
|
|
})();
|