diff options
author | Spencer T Brody <spencer@mongodb.com> | 2015-11-11 19:05:19 -0500 |
---|---|---|
committer | Spencer T Brody <spencer@mongodb.com> | 2015-11-12 15:15:12 -0500 |
commit | f757a8bb463d5a3e7ca6e34f76b97000b9d9690e (patch) | |
tree | 4623cf706876c4aba9a0525fab1359f8b30fe849 /src/mongo/db/repl/replica_set_config.cpp | |
parent | 21acf1901092e46f52cf12d11853c31a7b733232 (diff) | |
download | mongo-f757a8bb463d5a3e7ca6e34f76b97000b9d9690e.tar.gz |
SERVER-21236 Don't automatically add 'configsvr':true to replset config when loading it from disk if started with --configsvr
Diffstat (limited to 'src/mongo/db/repl/replica_set_config.cpp')
-rw-r--r-- | src/mongo/db/repl/replica_set_config.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/mongo/db/repl/replica_set_config.cpp b/src/mongo/db/repl/replica_set_config.cpp index ff3ce971717..106e8329473 100644 --- a/src/mongo/db/repl/replica_set_config.cpp +++ b/src/mongo/db/repl/replica_set_config.cpp @@ -79,6 +79,14 @@ const std::string kGetLastErrorModesFieldName = "getLastErrorModes"; } // namespace Status ReplicaSetConfig::initialize(const BSONObj& cfg, bool usePV1ByDefault) { + return _initialize(cfg, false, usePV1ByDefault); +} + +Status ReplicaSetConfig::initializeForInitiate(const BSONObj& cfg, bool usePV1ByDefault) { + return _initialize(cfg, true, usePV1ByDefault); +} + +Status ReplicaSetConfig::_initialize(const BSONObj& cfg, bool forInitiate, bool usePV1ByDefault) { _isInitialized = false; _members.clear(); Status status = @@ -127,8 +135,10 @@ Status ReplicaSetConfig::initialize(const BSONObj& cfg, bool usePV1ByDefault) { // // Parse configServer // - status = bsonExtractBooleanFieldWithDefault( - cfg, kConfigServerFieldName, serverGlobalParams.configsvr, &_configServer); + status = bsonExtractBooleanFieldWithDefault(cfg, + kConfigServerFieldName, + forInitiate ? serverGlobalParams.configsvr : false, + &_configServer); if (!status.isOK()) { return status; } |