diff options
author | Sergi Mateo Bellido <sergi.mateo-bellido@mongodb.com> | 2022-03-23 06:21:56 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-03-23 06:50:37 +0000 |
commit | e98dc4a89c55c0c391b1a6d1ef6a4be92328cfe9 (patch) | |
tree | e98ab88d0b4845a56356951b014b9b578e7bf7da /jstests/multiVersion | |
parent | 35cfa5f274d054269891697f16c3c84209c0f71a (diff) | |
download | mongo-e98dc4a89c55c0c391b1a6d1ef6a4be92328cfe9.tar.gz |
SERVER-63363 Fixing parsing of ChunkVersion
Diffstat (limited to 'jstests/multiVersion')
-rw-r--r-- | jstests/multiVersion/targetedTestsLastLtsFeatures/sharding_chunkversion_issue_when_upgrading.js | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/jstests/multiVersion/targetedTestsLastLtsFeatures/sharding_chunkversion_issue_when_upgrading.js b/jstests/multiVersion/targetedTestsLastLtsFeatures/sharding_chunkversion_issue_when_upgrading.js new file mode 100644 index 00000000000..3535063305d --- /dev/null +++ b/jstests/multiVersion/targetedTestsLastLtsFeatures/sharding_chunkversion_issue_when_upgrading.js @@ -0,0 +1,57 @@ +/** + * This test verifies that if a router running a 5.0 binary sends a shardVersion without a timestamp + * to a shard running a 5.1 or greater binary, the router will end up refreshing. + */ + +// TODO (SERVER-64813): remove this test once 6.0 becomes lastLTS +(function() { +'use strict'; + +load('jstests/multiVersion/libs/multi_cluster.js'); // For upgradeCluster + +var kDbName = 'db'; +var kShardedNss = kDbName + '.foo'; + +jsTest.log('Deploying cluster version ' + lastLTSFCV); +var st = new ShardingTest({ + mongos: 1, + config: 1, + shards: 2, + other: { + mongosOptions: {binVersion: lastLTSFCV}, + configOptions: {binVersion: lastLTSFCV}, + rsOptions: {binVersion: lastLTSFCV}, + rs: {nodes: 2} + } +}); +st.configRS.awaitReplication(); +assert.commandWorked( + st.s.adminCommand({enableSharding: kDbName, primaryShard: st.shard0.shardName})); + +jsTest.log('Upgrading FCV to 4.4'); +assert.commandWorked(st.s.adminCommand({setFeatureCompatibilityVersion: "4.4"})); + +jsTest.log('Some Workload under FCV 4.4'); +assert.commandWorked(st.s.adminCommand({shardCollection: kShardedNss, key: {i: 1}})); +assert.commandWorked(st.s.getDB(kDbName).foo.insert({i: 5})); + +jsTest.log('Upgrading FCV to ' + lastLTSFCV); +assert.commandWorked(st.s.adminCommand({setFeatureCompatibilityVersion: lastLTSFCV})); + +jsTest.log('Upgrading binaries to ' + latestFCV); +st.upgradeCluster('latest', {upgradeShards: true, upgradeConfigs: true, upgradeMongos: false}); + +jsTest.log('Checking that the router has stale information'); +var collVersion = st.s.getDB(kDbName).foo.getShardVersion(); +assert.commandWorked(collVersion); +assert.eq(collVersion.versionTimestamp, null); + +assert.eq(1, st.s.getDB(kDbName).foo.find({i: 5}).itcount()); + +jsTest.log('Checking that the router refreshed its information'); +collVersion = st.s.getDB(kDbName).foo.getShardVersion(); +assert.commandWorked(collVersion); +assert.neq(collVersion.versionTimestamp, null); + +st.stop(); +})(); |