summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Storch <david.storch@10gen.com>2016-09-13 15:01:54 -0400
committerDavid Storch <david.storch@10gen.com>2016-09-14 14:16:43 -0400
commit63582d3c291235d11e7597d659bdfe365bdac158 (patch)
treead958e9a52a8c333bf55233c63995c322f31170b
parent9e47e13caf848485a753ade87c0e9d07712835cb (diff)
downloadmongo-63582d3c291235d11e7597d659bdfe365bdac158.tar.gz
SERVER-26087 make config server only set its own featureCompatibilityVersion if all shards report success
-rw-r--r--jstests/multiVersion/set_feature_compatibility_version.js16
-rw-r--r--src/mongo/db/s/config/configsvr_set_feature_compatibility_version_command.cpp5
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;