diff options
author | Jack Mulrow <jack.mulrow@mongodb.com> | 2023-02-27 16:09:26 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2023-02-27 18:12:52 +0000 |
commit | e155e6542b9ceee9575beb670e357146088717b6 (patch) | |
tree | 184d38e25cac224d82b866947ee4ce82ad221079 /jstests/multiVersion | |
parent | db5ca2947f37d6706c01fe24d6294af75b6418c9 (diff) | |
download | mongo-e155e6542b9ceee9575beb670e357146088717b6.tar.gz |
SERVER-74270 Allow changeStreamPreAndPostImages collection option on config server nodes
Diffstat (limited to 'jstests/multiVersion')
-rw-r--r-- | jstests/multiVersion/targetedTestsLastLtsFeatures/cannot_downgrade_config_server_with_change_streams_images_collection_option.js | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/jstests/multiVersion/targetedTestsLastLtsFeatures/cannot_downgrade_config_server_with_change_streams_images_collection_option.js b/jstests/multiVersion/targetedTestsLastLtsFeatures/cannot_downgrade_config_server_with_change_streams_images_collection_option.js new file mode 100644 index 00000000000..4c7e3fda8a9 --- /dev/null +++ b/jstests/multiVersion/targetedTestsLastLtsFeatures/cannot_downgrade_config_server_with_change_streams_images_collection_option.js @@ -0,0 +1,41 @@ +/** + * Verifies a config server cannot downgrade with a collection with changeStreamPreAndPostImages + * enabled. + * + * @tags: [featureFlagCatalogShard] + */ +(function() { +"use strict"; + +const st = new ShardingTest({config: 1, shards: 1}); + +// A collection on a shard with changeStreamPreAndPostImages shouldn't impact downgrade. +const validShardNS = "foo.bar"; +assert.commandWorked(st.s.getCollection(validShardNS).insert({x: 1})); +assert.commandWorked( + st.s.getDB("foo").runCommand({collMod: "bar", changeStreamPreAndPostImages: {enabled: true}})); + +// A collection on the config server with changeStreamPreAndPostImages should prevent downgrade. The +// config server can only downgrade when in dedicated mode and in this mode the only user +// accessible collections on it are in the config and admin databases, which never allow this +// option, so we have to create a collection on a separate db via direct connection. +const directConfigNS = "directDB.onConfig"; +assert.commandWorked(st.configRS.getPrimary().getCollection(directConfigNS).insert({x: 1})); +assert.commandWorked(st.configRS.getPrimary().getDB("directDB").runCommand({ + collMod: "onConfig", + changeStreamPreAndPostImages: {enabled: true} +})); + +assert.commandFailedWithCode(st.s.adminCommand({setFeatureCompatibilityVersion: lastLTSFCV}), + ErrorCodes.CannotDowngrade); + +// Unset the option on the config server collection and now the config server can downgrade. +assert.commandWorked(st.configRS.getPrimary().getDB("directDB").runCommand({ + collMod: "onConfig", + changeStreamPreAndPostImages: {enabled: false} +})); + +assert.commandWorked(st.s.adminCommand({setFeatureCompatibilityVersion: lastLTSFCV})); + +st.stop(); +})(); |