diff options
author | Rui Liu <rui.liu@mongodb.com> | 2022-03-31 10:08:43 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-03-31 10:37:33 +0000 |
commit | e9f726e70620b1471c9a71599cc25919f43d7c31 (patch) | |
tree | 36054107527043d8f6bb7a93797f970462f51cf8 /jstests/multiVersion | |
parent | 515ccf31288d759e1c82c59b789b3f8520622aba (diff) | |
download | mongo-e9f726e70620b1471c9a71599cc25919f43d7c31.tar.gz |
SERVER-64826 Upgrade/downgrade for collMod coordinator
Diffstat (limited to 'jstests/multiVersion')
-rw-r--r-- | jstests/multiVersion/targetedTestsLastLtsFeatures/upgrade_downgrade_timeseries_granularity_update.js | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/jstests/multiVersion/targetedTestsLastLtsFeatures/upgrade_downgrade_timeseries_granularity_update.js b/jstests/multiVersion/targetedTestsLastLtsFeatures/upgrade_downgrade_timeseries_granularity_update.js new file mode 100644 index 00000000000..354dea0f820 --- /dev/null +++ b/jstests/multiVersion/targetedTestsLastLtsFeatures/upgrade_downgrade_timeseries_granularity_update.js @@ -0,0 +1,42 @@ +/** + * Tests that granularity update for sharded time-series collections is disabled for FCV < 6.0 + */ +(function() { +"use strict"; + +load('./jstests/multiVersion/libs/multi_cluster.js'); + +function runTest(downgradeVersion) { + const st = new ShardingTest({shards: 1}); + const dbName = "test"; + const collName = jsTestName(); + const viewNss = `${dbName}.${collName}`; + const timeField = "time"; + const metaField = "meta"; + const mongos = st.s; + const db = mongos.getDB(dbName); + + assert.commandWorked(mongos.adminCommand({enableSharding: dbName})); + assert.commandWorked(db.createCollection( + collName, + {timeseries: {timeField: timeField, metaField: metaField, granularity: 'seconds'}})); + assert.commandWorked(mongos.adminCommand({ + shardCollection: viewNss, + key: {[metaField]: 1}, + })); + + // Granularity updates works in 6.0 + assert.commandWorked(db.runCommand({collMod: collName, timeseries: {granularity: 'minutes'}})); + + // Granularity updates fails after downgrading. + assert.commandWorked(st.s.adminCommand({setFeatureCompatibilityVersion: downgradeVersion})); + assert.commandFailedWithCode( + db.runCommand({collMod: collName, timeseries: {granularity: 'hours'}}), + ErrorCodes.NotImplemented); + + st.stop(); +} + +runTest(lastLTSFCV); +runTest(lastContinuousFCV); +})(); |