Skip to content

Commit

Permalink
SERVER-19527 Add configsvrMode flag to mongod
Browse files Browse the repository at this point in the history
  • Loading branch information
stbrody committed Jul 30, 2015
1 parent 967422b commit fe1a91d
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/mongo/db/mongod_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,14 @@ Status addMongodOptions(moe::OptionSection* options) {
.setSources(moe::SourceAllLegacy)
.incompatibleWith("shardsvr");

sharding_options.addOptionChaining("sharding.configsvrMode",
"configsvrMode",
moe::String,
"Controls what config server protocol is in use. When set to"
" \"scc\" keeps server in legacy SyncClusterConnection mode "
"even when the service is running as a replSet")
.setSources(moe::SourceAllLegacy);

sharding_options.addOptionChaining(
"shardsvr",
"shardsvr",
Expand Down Expand Up @@ -1189,6 +1197,9 @@ Status storeMongodOptions(const moe::Environment& params, const std::vector<std:
if (params.count("sharding.clusterRole") &&
params["sharding.clusterRole"].as<std::string>() == "configsvr") {
serverGlobalParams.configsvr = true;
serverGlobalParams.configsvrMode = replSettings.replSet.empty()
? ServerGlobalParams::ConfigServerMode::SCC
: ServerGlobalParams::ConfigServerMode::CSRS;
mmapv1GlobalOptions.smallfiles = true; // config server implies small files

// If we haven't explicitly specified a journal option, default journaling to true for
Expand All @@ -1205,6 +1216,20 @@ Status storeMongodOptions(const moe::Environment& params, const std::vector<std:
replSettings.oplogSize = 5 * 1024 * 1024;
}

if (params.count("sharding.configsvrMode")) {
if (!serverGlobalParams.configsvr) {
return Status(ErrorCodes::BadValue,
"Cannot set \"sharding.configsvrMode\" without "
"setting \"sharding.clusterRole\" to \"configsvr\"");
}
if (params["sharding.configsvrMode"].as<std::string>() != "scc") {
return Status(ErrorCodes::BadValue,
"Bad value for sharding.configsvrMode. "
" Only supported value is \"scc\"");
}
serverGlobalParams.configsvrMode = ServerGlobalParams::ConfigServerMode::SCC;
}

if (params.count("sharding.archiveMovedChunks")) {
serverGlobalParams.moveParanoia = params["sharding.archiveMovedChunks"].as<bool>();
}
Expand Down
7 changes: 7 additions & 0 deletions src/mongo/db/server_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ struct ServerGlobalParams {
indexBuildRetry(true),
quiet(false),
configsvr(false),
configsvrMode(ConfigServerMode::NONE),
cpu(false),
objcheck(true),
defaultProfile(0),
Expand Down Expand Up @@ -79,6 +80,12 @@ struct ServerGlobalParams {
bool quiet; // --quiet

bool configsvr; // --configsvr
enum class ConfigServerMode {
NONE,
SCC,
CSRS,
};
ConfigServerMode configsvrMode; // -- configsvrMode

bool cpu; // --cpu show cpu time periodically

Expand Down

0 comments on commit fe1a91d

Please sign in to comment.