summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl
diff options
context:
space:
mode:
authorMisha Tyulenev <misha@mongodb.com>2018-01-21 15:25:24 -0500
committerMisha Tyulenev <misha@mongodb.com>2018-01-21 15:26:46 -0500
commitb251fd633d7572c0b221df3b316534596e981041 (patch)
tree52ad9e73dae57cb99f7e278a791d912c48086482 /src/mongo/db/repl
parent42c264630fa1e7d5924c291a9eeac6522d70f31e (diff)
downloadmongo-b251fd633d7572c0b221df3b316534596e981041.tar.gz
SERVER-32569 allow config servers and shard replica sets to start in non-cluster mode
Diffstat (limited to 'src/mongo/db/repl')
-rw-r--r--src/mongo/db/repl/SConscript2
-rw-r--r--src/mongo/db/repl/repl_set_config.cpp11
-rw-r--r--src/mongo/db/repl/topology_coordinator.cpp5
3 files changed, 14 insertions, 4 deletions
diff --git a/src/mongo/db/repl/SConscript b/src/mongo/db/repl/SConscript
index 15890c6cf0e..a5ff6d4b066 100644
--- a/src/mongo/db/repl/SConscript
+++ b/src/mongo/db/repl/SConscript
@@ -1029,12 +1029,12 @@ env.Library('replica_set_messages',
'handshake_args.cpp',
'is_master_response.cpp',
'member_config.cpp',
+ 'repl_set_config.cpp',
'repl_set_heartbeat_args.cpp',
'repl_set_heartbeat_args_v1.cpp',
'repl_set_heartbeat_response.cpp',
'repl_set_html_summary.cpp',
'repl_set_request_votes_args.cpp',
- 'repl_set_config.cpp',
'repl_set_tag.cpp',
'update_position_args.cpp',
'last_vote.cpp',
diff --git a/src/mongo/db/repl/repl_set_config.cpp b/src/mongo/db/repl/repl_set_config.cpp
index f4514a52322..cff88ad368a 100644
--- a/src/mongo/db/repl/repl_set_config.cpp
+++ b/src/mongo/db/repl/repl_set_config.cpp
@@ -35,11 +35,19 @@
#include "mongo/bson/util/bson_check.h"
#include "mongo/bson/util/bson_extract.h"
#include "mongo/db/jsobj.h"
+#include "mongo/db/mongod_options.h"
#include "mongo/db/server_options.h"
+#include "mongo/db/server_parameters.h"
#include "mongo/stdx/functional.h"
#include "mongo/util/stringutils.h"
namespace mongo {
+/**
+ * Dont run any sharding validations. Can not be combined with --configsvr or shardvr. Intended to
+ * allow restarting config server or shard as an independent replica set.
+ */
+MONGO_EXPORT_STARTUP_SERVER_PARAMETER(skipShardingConfigurationChecks, bool, false);
+
namespace repl {
const size_t ReplSetConfig::kMaxMembers;
@@ -569,7 +577,8 @@ Status ReplSetConfig::validate() const {
"servers cannot have a non-zero slaveDelay");
}
}
- if (serverGlobalParams.clusterRole != ClusterRole::ConfigServer) {
+ if (serverGlobalParams.clusterRole != ClusterRole::ConfigServer &&
+ !skipShardingConfigurationChecks) {
return Status(ErrorCodes::BadValue,
"Nodes being used for config servers must be started with the "
"--configsvr flag");
diff --git a/src/mongo/db/repl/topology_coordinator.cpp b/src/mongo/db/repl/topology_coordinator.cpp
index 7a91b1c1c13..8960db9792a 100644
--- a/src/mongo/db/repl/topology_coordinator.cpp
+++ b/src/mongo/db/repl/topology_coordinator.cpp
@@ -37,6 +37,7 @@
#include "mongo/db/audit.h"
#include "mongo/db/client.h"
+#include "mongo/db/mongod_options.h"
#include "mongo/db/operation_context.h"
#include "mongo/db/repl/handshake_args.h"
#include "mongo/db/repl/heartbeat_response_action.h"
@@ -2757,7 +2758,7 @@ MemberState TopologyCoordinator::getMemberState() const {
}
if (_rsConfig.isConfigServer()) {
- if (_options.clusterRole != ClusterRole::ConfigServer) {
+ if (_options.clusterRole != ClusterRole::ConfigServer && !skipShardingConfigurationChecks) {
return MemberState::RS_REMOVED;
} else {
invariant(_storageEngineSupportsReadCommitted != ReadCommittedSupport::kUnknown);
@@ -2766,7 +2767,7 @@ MemberState TopologyCoordinator::getMemberState() const {
}
}
} else {
- if (_options.clusterRole == ClusterRole::ConfigServer) {
+ if (_options.clusterRole == ClusterRole::ConfigServer && !skipShardingConfigurationChecks) {
return MemberState::RS_REMOVED;
}
}