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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
/**
* Test that it is not possible to move a chunk from an upgrade featureCompatibilityVersion node to
* a downgrade binary version node.
*
*/
(function() {
"use strict";
// Test is not replSet so cannot clean up migration coordinator docs properly.
// Making it replSet will also make the moveChunk get stuck forever because the migration
// coordinator will retry forever and never succeeds because recipient shard has incompatible
// version.
TestData.skipCheckOrphans = true;
// Because in this test we explicitly leave shard1 in 'downgradeFCV' version, but the rest or the
// cluster has upgraded to 'latestFCV', shard1 won't be able to refresh its catalog cache from the
// upgraded configsvr due to incompatible wire version. This makes the index consistency check fail.
TestData.skipCheckingIndexesConsistentAcrossCluster = true;
// This test creates a sharded cluster with mixed binaries: one shard and all mongos are running an
// old binary whereas the config server and the other shards are running the lastest binary. The
// initial FCV of the sharded cluster is the older one. After some operations we explicitly advance
// the FCV to 'latest' to one of the shards that was running the new binary. Finally, we verify that
// we cannot move a chunk from a latestFCV + new binary shard to a downgraded binary version shard.
function runTest(downgradeVersion) {
jsTestLog("Running test with downgradeVersion: " + downgradeVersion);
let st = new ShardingTest({
shards: [{binVersion: "latest"}, {binVersion: downgradeVersion}],
mongos: 1,
other: {
mongosOptions: {binVersion: downgradeVersion},
configOptions: {binVersion: "latest"},
}
});
const featureFlagMigrationRecipientCriticalSection =
assert.commandWorked(st.configRS.getPrimary().adminCommand(
{getParameter: 1, featureFlagMigrationRecipientCriticalSection: 1}));
const featureFlagMigrationRecipientCriticalSectionEnabled =
featureFlagMigrationRecipientCriticalSection.featureFlagMigrationRecipientCriticalSection
.value;
// SERVER-61072: Reenable this test once 6.0 becomes last LTS.
// We have to skip this test because the initial state with mixed binaries and mixed FCVs
// doesn't honor the upgrade/downgrade procedure and breaks with the setFCV requirements of the
// new migration protocol.
if (featureFlagMigrationRecipientCriticalSectionEnabled) {
jsTest.log('Skipping test because featureFlagMigrationRecipientCriticalSection is enabled');
st.stop();
return;
}
const downgradeFCV = binVersionToFCV(downgradeVersion);
checkFCV(st.configRS.getPrimary().getDB("admin"), downgradeFCV);
checkFCV(st.shard0.getDB("admin"), downgradeFCV);
checkFCV(st.shard1.getDB("admin"), downgradeFCV);
// Create a sharded collection with primary shard 0.
let testDB = st.s.getDB("test");
assert.commandWorked(st.s.adminCommand({enableSharding: testDB.getName()}));
st.ensurePrimaryShard(testDB.getName(), st.shard0.shardName);
assert.commandWorked(
st.s.adminCommand({shardCollection: testDB.coll.getFullName(), key: {a: 1}}));
assert.commandWorked(st.shard0.adminCommand({setFeatureCompatibilityVersion: latestFCV}));
checkFCV(st.configRS.getPrimary().getDB("admin"), downgradeFCV);
checkFCV(st.shard0.getDB("admin"), latestFCV);
checkFCV(st.shard1.getDB("admin"), downgradeFCV);
// Invalid move chunk between shards with different binaries and FCVs. Pass explicit
// writeConcern (which requires secondaryThrottle: true) to avoid problems if the downgraded
// version doesn't automatically include writeConcern when running _recvChunkStart on the newer
// shard.
assert.commandFailedWithCode(st.s.adminCommand({
moveChunk: testDB.coll.getFullName(),
find: {a: 1},
to: st.shard1.shardName,
secondaryThrottle: true,
writeConcern: {w: 1}
}),
ErrorCodes.IncompatibleServerVersion);
st.stop();
}
runTest('last-continuous');
runTest('last-lts');
})();
|