2022-03-14 21:09:34 +00:00
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* Tests that runs a shard split to completion.
|
|
|
|
|
* @tags: [requires_fcv_52, featureFlagShardSplit]
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
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-06-02 17:56:32 +00:00
|
|
|
const donorPrimary = test.getDonorPrimary();
|
2022-04-12 13:54:25 +00:00
|
|
|
const operation = test.createSplitOperation(tenantIds);
|
|
|
|
|
assert.commandWorked(operation.commit());
|
2022-03-25 22:19:24 +00:00
|
|
|
|
2022-06-02 17:56:32 +00:00
|
|
|
assertMigrationState(donorPrimary, operation.migrationId, "committed");
|
2022-04-12 13:54:25 +00:00
|
|
|
|
|
|
|
|
operation.forget();
|
2022-03-30 12:44:27 +00:00
|
|
|
|
2022-06-02 17:56:32 +00:00
|
|
|
const status = donorPrimary.adminCommand({serverStatus: 1});
|
|
|
|
|
assert.eq(status.shardSplits.totalCommitted, 1);
|
|
|
|
|
assert.eq(status.shardSplits.totalAborted, 0);
|
|
|
|
|
assert.gt(status.shardSplits.totalCommittedDurationMillis, 0);
|
|
|
|
|
assert.gt(status.shardSplits.totalCommittedDurationWithoutCatchupMillis, 0);
|
2022-03-14 21:09:34 +00:00
|
|
|
|
2022-06-02 17:56:32 +00:00
|
|
|
test.cleanupSuccesfulCommitted(operation.migrationId, tenantIds);
|
2022-03-14 21:09:34 +00:00
|
|
|
test.stop();
|
|
|
|
|
})();
|