diff options
-rw-r--r-- | jstests/libs/config_files/set_shardingrole.json (renamed from jstests/libs/config_files/set_shardingrole_configsvr.json) | 3 | ||||
-rw-r--r-- | jstests/libs/config_files/set_shardingrole_shardsvr.json | 8 | ||||
-rw-r--r-- | jstests/sharding/require_shardsvrs_and_configsvrs_to_be_replica_sets.js | 62 | ||||
-rw-r--r-- | jstests/sharding/shard_config_db_collections.js | 2 | ||||
-rw-r--r-- | jstests/sharding/sharding_options.js | 18 | ||||
-rw-r--r-- | src/mongo/db/SConscript | 1 | ||||
-rw-r--r-- | src/mongo/db/mongod_options.cpp | 26 |
7 files changed, 10 insertions, 110 deletions
diff --git a/jstests/libs/config_files/set_shardingrole_configsvr.json b/jstests/libs/config_files/set_shardingrole.json index f6121cfd52b..71f92f122db 100644 --- a/jstests/libs/config_files/set_shardingrole_configsvr.json +++ b/jstests/libs/config_files/set_shardingrole.json @@ -1,8 +1,5 @@ { "sharding" : { "clusterRole" : "configsvr" - }, - "replication": { - "replSetName" : "dummy" } } diff --git a/jstests/libs/config_files/set_shardingrole_shardsvr.json b/jstests/libs/config_files/set_shardingrole_shardsvr.json deleted file mode 100644 index 333a33528b9..00000000000 --- a/jstests/libs/config_files/set_shardingrole_shardsvr.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "sharding" : { - "clusterRole" : "shardsvr" - }, - "replication" : { - "replSetName" : "dummy" - } -} diff --git a/jstests/sharding/require_shardsvrs_and_configsvrs_to_be_replica_sets.js b/jstests/sharding/require_shardsvrs_and_configsvrs_to_be_replica_sets.js deleted file mode 100644 index 5157a8ac12d..00000000000 --- a/jstests/sharding/require_shardsvrs_and_configsvrs_to_be_replica_sets.js +++ /dev/null @@ -1,62 +0,0 @@ -/** - * Ensures that a server started with --shardsvr or --configsvr must also be started as a replica - * set, unless it is started with enableTestCommands=1. - */ -(function() { - var testAllPermutations = function(enableTestCommands) { - jsTest.setOption('enableTestCommands', enableTestCommands); - var mongod; - - // Standalone tests. - - jsTest.log("Starting shardsvr with enableTestCommands=" + enableTestCommands); - mongod = MongoRunner.runMongod({shardsvr: ''}); - if (enableTestCommands) { - assert.neq(null, mongod); - MongoRunner.stopMongod(mongod); - } else { - assert.eq(null, mongod); - } - - jsTest.log("Starting configsvr with enableTestCommands=" + enableTestCommands); - mongod = MongoRunner.runMongod({configsvr: ''}); - if (enableTestCommands) { - assert.neq(null, mongod); - MongoRunner.stopMongod(mongod); - } else { - assert.eq(null, mongod); - } - - // Replica set tests using the command line 'replSet' option. - - jsTest.log("Starting shardsvr with --replSet and enableTestCommands=" + enableTestCommands); - mongod = MongoRunner.runMongod({shardsvr: '', replSet: 'dummy'}); - assert.neq(null, mongod); - MongoRunner.stopMongod(mongod); - - jsTest.log("Starting configsvr with --replSet and enableTestCommands=" + - enableTestCommands); - mongod = MongoRunner.runMongod({configsvr: '', replSet: 'dummy'}); - assert.neq(null, mongod); - MongoRunner.stopMongod(mongod); - - // Replica set tests using the config file 'replSetName' option. - - jsTest.log("Starting shardsvr with 'replication.replSetName' and enableTestCommands=" + - enableTestCommands); - mongod = MongoRunner.runMongod( - {config: "jstests/libs/config_files/set_shardingrole_shardsvr.json"}); - assert.neq(null, mongod); - MongoRunner.stopMongod(mongod); - - jsTest.log("Starting configsvr with 'replication.replSetName' and enableTestCommands=" + - enableTestCommands); - mongod = MongoRunner.runMongod( - {config: "jstests/libs/config_files/set_shardingrole_configsvr.json"}); - assert.neq(null, mongod); - MongoRunner.stopMongod(mongod); - }; - - testAllPermutations(true /* enableTestCommands */); - testAllPermutations(false /* enableTestCommands */); -})(); diff --git a/jstests/sharding/shard_config_db_collections.js b/jstests/sharding/shard_config_db_collections.js index 68f78f6bf94..d666f3c8d43 100644 --- a/jstests/sharding/shard_config_db_collections.js +++ b/jstests/sharding/shard_config_db_collections.js @@ -148,7 +148,7 @@ { jsTest.setOption('enableTestCommands', false); - var st = new ShardingTest({shards: 2, rs: true}); + var st = new ShardingTest({shards: 2}); var admin = st.s.getDB('admin'); assert.commandWorked( diff --git a/jstests/sharding/sharding_options.js b/jstests/sharding/sharding_options.js index 8d6c63335b7..8af7bf01c53 100644 --- a/jstests/sharding/sharding_options.js +++ b/jstests/sharding/sharding_options.js @@ -37,26 +37,14 @@ expectedResult = { }; testGetCmdLineOptsMongod({shardsvr: ""}, expectedResult); -jsTest.log("Testing \"sharding.clusterRole\" config file option with 'configsvr'"); +jsTest.log("Testing \"sharding.clusterRole\" config file option"); expectedResult = { "parsed": { - "config": "jstests/libs/config_files/set_shardingrole_configsvr.json", - "replication": {"replSetName": "dummy"}, + "config": "jstests/libs/config_files/set_shardingrole.json", "sharding": {"clusterRole": "configsvr"} } }; -testGetCmdLineOptsMongod({config: "jstests/libs/config_files/set_shardingrole_configsvr.json"}, - expectedResult); - -jsTest.log("Testing \"sharding.clusterRole\" config file option with 'shardsvr'"); -expectedResult = { - "parsed": { - "config": "jstests/libs/config_files/set_shardingrole_shardsvr.json", - "replication": {"replSetName": "dummy"}, - "sharding": {"clusterRole": "shardsvr"} - } -}; -testGetCmdLineOptsMongod({config: "jstests/libs/config_files/set_shardingrole_shardsvr.json"}, +testGetCmdLineOptsMongod({config: "jstests/libs/config_files/set_shardingrole.json"}, expectedResult); // Test that we preserve switches explicitly set to false in config files. See SERVER-13439. diff --git a/src/mongo/db/SConscript b/src/mongo/db/SConscript index 76140c06b03..40664d264e3 100644 --- a/src/mongo/db/SConscript +++ b/src/mongo/db/SConscript @@ -422,7 +422,6 @@ env.Library( ], LIBDEPS=[ '$BUILD_DIR/mongo/db/storage/mmap_v1/mmap_v1_options', - 'commands/test_commands_enabled', 'repl/repl_settings', 'server_options', 'storage/storage_options', diff --git a/src/mongo/db/mongod_options.cpp b/src/mongo/db/mongod_options.cpp index 2f02809ee8f..6e68a66f3fb 100644 --- a/src/mongo/db/mongod_options.cpp +++ b/src/mongo/db/mongod_options.cpp @@ -450,12 +450,11 @@ Status addMongodOptions(moe::OptionSection* options) { // Sharding Options sharding_options - .addOptionChaining( - "configsvr", - "configsvr", - moe::Switch, - "declare this is a config db of a cluster; default port 27019; " - "default dir /data/configdb; requires starting this server as a replica set") + .addOptionChaining("configsvr", + "configsvr", + moe::Switch, + "declare this is a config db of a cluster; default port 27019; " + "default dir /data/configdb") .setSources(moe::SourceAllLegacy) .incompatibleWith("shardsvr") .incompatibleWith("nojournal"); @@ -464,8 +463,7 @@ Status addMongodOptions(moe::OptionSection* options) { .addOptionChaining("shardsvr", "shardsvr", moe::Switch, - "declare this is a shard db of a cluster; default port 27018; requires " - "starting this server as a replica set") + "declare this is a shard db of a cluster; default port 27018") .setSources(moe::SourceAllLegacy) .incompatibleWith("configsvr") .incompatibleWith("master") @@ -1204,18 +1202,6 @@ Status storeMongodOptions(const moe::Environment& params) { } if (params.count("sharding.clusterRole")) { auto clusterRoleParam = params["sharding.clusterRole"].as<std::string>(); - - if (!(params.count("replication.replSet") || params.count("replication.replSetName")) && - !Command::testCommandsEnabled) { - return { - ErrorCodes::InvalidOptions, - str::stream() - << "Cannot start a " - << clusterRoleParam - << " as a standalone server. Please start this node as a replica " - "set using --replSet or the config file option replication.replSetName."}; - } - if (clusterRoleParam == "configsvr") { serverGlobalParams.clusterRole = ClusterRole::ConfigServer; |