blob: 5de893203ae55d4dd952a89c3f981acbfa27c976 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
/*
* Prove that shard splits are eagerly aborted when the `setFeatureCompatibilityVersion` command is
* received for both upgrade and downgrade paths.
*
* @tags: [requires_fcv_52, featureFlagShardSplit, serverless]
*/
(function() {
"use strict";
load("jstests/libs/fail_point_util.js");
load("jstests/serverless/libs/basic_serverless_test.js");
// Skip db hash check because secondary is left with a different config.
TestData.skipCheckDBHashes = true;
const test = new BasicServerlessTest({
recipientTagName: "recipientNode",
recipientSetName: "recipient",
quickGarbageCollection: true
});
test.addRecipientNodes();
const donorPrimary = test.donor.getPrimary();
const tenantIds = ["tenant1", "tenant2"];
const pauseAfterBlockingFp = configureFailPoint(donorPrimary, "pauseShardSplitAfterBlocking");
jsTestLog("Test FCV Downgrade");
const split = test.createSplitOperation(tenantIds);
const commitThread = split.commitAsync();
pauseAfterBlockingFp.wait();
assert.commandWorked(
donorPrimary.adminCommand({setFeatureCompatibilityVersion: lastContinuousFCV}));
pauseAfterBlockingFp.off();
assert.commandFailedWithCode(commitThread.returnData(), ErrorCodes.TenantMigrationAborted);
jsTestLog("Test FCV Upgrade");
if (lastContinuousFCV == "6.0") {
const secondSplit = test.createSplitOperation(tenantIds);
assert.commandFailedWithCode(secondSplit.commit(), ErrorCodes.IllegalOperation);
} else {
// `forgetShardSplit` will not be available until the downgraded version also supports the
// 'shard split' feature.
split.forget();
test.cleanupSuccesfulAborted(split.migrationId, tenantIds);
const secondSplit = test.createSplitOperation(tenantIds);
const commitThread = secondSplit.commitAsync();
pauseAfterBlockingFp.wait();
assert.commandWorked(donorPrimary.adminCommand({setFeatureCompatibilityVersion: latestFCV}));
pauseAfterBlockingFp.off();
assert.commandFailedWithCode(commitThread.returnData(), ErrorCodes.TenantMigrationAborted);
secondSplit.forget();
test.cleanupSuccesfulAborted(secondSplit.migrationId, tenantIds);
}
test.stop();
})();
|