diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2015-10-16 11:27:06 -0400 |
---|---|---|
committer | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2015-10-19 17:05:30 -0400 |
commit | 02c1f2916cfd174de5341c50045811df116a0576 (patch) | |
tree | 40170a3ba3fc5197259e9dd3e332080a470746cf /src | |
parent | c6c178f2e561db9db30b1768cbe119654dd86708 (diff) | |
download | mongo-02c1f2916cfd174de5341c50045811df116a0576.tar.gz |
SERVER-20970 Allow a single-node SCCC config server
Enables the configuration in mongos and also writes a smoke test to ensure
that the basic sharding operations work.
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/s/mongos_options.cpp | 13 | ||||
-rw-r--r-- | src/mongo/shell/shardingtest.js | 10 |
2 files changed, 14 insertions, 9 deletions
diff --git a/src/mongo/s/mongos_options.cpp b/src/mongo/s/mongos_options.cpp index 740420509cc..4139c8d56f6 100644 --- a/src/mongo/s/mongos_options.cpp +++ b/src/mongo/s/mongos_options.cpp @@ -264,15 +264,16 @@ Status storeMongosOptions(const moe::Environment& params, const std::vector<std: std::vector<HostAndPort> configServers = mongosGlobalParams.configdbs.getServers(); if (mongosGlobalParams.configdbs.type() != ConnectionString::SYNC && - mongosGlobalParams.configdbs.type() != ConnectionString::SET) { - return Status( - ErrorCodes::BadValue, - "Must have either 3 node legacy config servers, or a replica set config server"); + mongosGlobalParams.configdbs.type() != ConnectionString::SET && + mongosGlobalParams.configdbs.type() != ConnectionString::MASTER) { + return Status(ErrorCodes::BadValue, + str::stream() << "Invalid config server value " + << mongosGlobalParams.configdbs.toString()); } if (configServers.size() < 3) { - warning() << "running with less than 3 config servers should be done only for testing " - "purposes and is not recommended for production"; + warning() << "Running a sharded cluster with fewer than 3 config servers should only be " + "done for testing purposes and is not recommended for production."; } return Status::OK(); diff --git a/src/mongo/shell/shardingtest.js b/src/mongo/shell/shardingtest.js index 5bf015025c9..0472cdf7094 100644 --- a/src/mongo/shell/shardingtest.js +++ b/src/mongo/shell/shardingtest.js @@ -53,7 +53,7 @@ * Can be used to specify options that are common all shards. * * sync {boolean}: Use SyncClusterConnection, and readies - * 3 config servers. + * 1 or 3 config servers, based on the value of numConfigs. * configOptions {Object}: same as the config property above. * Can be used to specify options that are common all config servers. * mongosOptions {Object}: same as the mongos property above. @@ -278,7 +278,7 @@ ShardingTest = function( testName , numShards , verboseLevel , numMongos , other // and the user didn't explicity specify a different config server configuration if (jsTestOptions().useLegacyConfigServers && otherParams.sync !== false && - (typeof otherParams.config === 'undefined' || numConfigs === 3)) { + (typeof(otherParams.config) === 'undefined' || numConfigs === 3)) { otherParams.sync = true; } @@ -287,8 +287,12 @@ ShardingTest = function( testName , numShards , verboseLevel , numMongos , other // Start the config servers if (otherParams.sync) { + if (numConfigs !== 1 && numConfigs !== 3) { + throw Error('Sync config servers only supported with 1 or 3 nodes'); + } + var configNames = []; - for ( var i = 0; i < 3 ; i++ ) { + for (var i = 0; i < numConfigs; i++) { var options = { useHostname : otherParams.useHostname, noJournalPrealloc : otherParams.nopreallocj, pathOpts : Object.merge( pathOpts, { config : i } ), |