diff options
-rw-r--r-- | jstests/multiVersion/set_feature_compatibility_version.js | 16 | ||||
-rw-r--r-- | src/mongo/db/s/config/configsvr_set_feature_compatibility_version_command.cpp | 5 |
2 files changed, 17 insertions, 4 deletions
diff --git a/jstests/multiVersion/set_feature_compatibility_version.js b/jstests/multiVersion/set_feature_compatibility_version.js index be6d5f5dfaa..1a116de2a61 100644 --- a/jstests/multiVersion/set_feature_compatibility_version.js +++ b/jstests/multiVersion/set_feature_compatibility_version.js @@ -177,7 +177,10 @@ var shardPrimaryAdminDB; // New 3.4 cluster. - st = new ShardingTest({shards: {rs0: {nodes: [{binVersion: latest}, {binVersion: latest}]}}}); + st = new ShardingTest({ + shards: {rs0: {nodes: [{binVersion: latest}, {binVersion: latest}]}}, + other: {useBridge: true} + }); mongosAdminDB = st.s.getDB("admin"); configPrimaryAdminDB = st.configRS.getPrimary().getDB("admin"); shardPrimaryAdminDB = st.rs0.getPrimary().getDB("admin"); @@ -212,6 +215,17 @@ assert.commandFailed( mongosAdminDB.runCommand({setParameter: 1, featureCompatibilityVersion: "3.2"})); + // Prevent the shard primary from receiving messages from the config server primary. When we try + // to set the featureCompatibilityVersion to "3.2", it should fail because the shard cannot be + // contacted. The config server primary should still report "3.4", since setting the version to + // "3.2" did not succeed. + st.rs0.getPrimary().discardMessagesFrom(st.configRS.getPrimary(), 1.0); + assert.commandFailed(mongosAdminDB.runCommand({setFeatureCompatibilityVersion: "3.2"})); + res = configPrimaryAdminDB.runCommand({getParameter: 1, featureCompatibilityVersion: 1}); + assert.commandWorked(res); + assert.eq(res.featureCompatibilityVersion, "3.4"); + st.rs0.getPrimary().discardMessagesFrom(st.configRS.getPrimary(), 0.0); + // featureCompatibilityVersion can be set to 3.2 on mongos. assert.commandWorked(mongosAdminDB.runCommand({setFeatureCompatibilityVersion: "3.2"})); diff --git a/src/mongo/db/s/config/configsvr_set_feature_compatibility_version_command.cpp b/src/mongo/db/s/config/configsvr_set_feature_compatibility_version_command.cpp index 73d84d3ba43..00fd3b55879 100644 --- a/src/mongo/db/s/config/configsvr_set_feature_compatibility_version_command.cpp +++ b/src/mongo/db/s/config/configsvr_set_feature_compatibility_version_command.cpp @@ -117,13 +117,12 @@ public: version == FeatureCompatibilityVersion::kVersion34 || version == FeatureCompatibilityVersion::kVersion32); - // Set featureCompatibilityVersion on self. - FeatureCompatibilityVersion::set(txn, version); - // Forward to all shards. uassertStatusOK( Grid::get(txn)->catalogManager()->setFeatureCompatibilityVersionOnShards(txn, version)); + // On success, set featureCompatibilityVersion on self. + FeatureCompatibilityVersion::set(txn, version); return true; } } configsvrSetFeatureCompatibilityVersionCmd; |