summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/replica_set_config_checks.cpp
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2016-01-27 21:26:42 -0500
committerBenety Goh <benety@mongodb.com>2016-02-05 13:32:33 -0500
commit0bc96b1ede73c82d45b6d6c2e0b9a33e613ca7c3 (patch)
tree371c6bdd31528769473229fbb37090238831f0a6 /src/mongo/db/repl/replica_set_config_checks.cpp
parentc58239c96ee83dab5232084cb69238de2b093c49 (diff)
downloadmongo-0bc96b1ede73c82d45b6d6c2e0b9a33e613ca7c3.tar.gz
SERVER-22287 added replica set ID validation to heartbeat response processing, replSetReconfigure and replica set quorum check.
Diffstat (limited to 'src/mongo/db/repl/replica_set_config_checks.cpp')
-rw-r--r--src/mongo/db/repl/replica_set_config_checks.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/mongo/db/repl/replica_set_config_checks.cpp b/src/mongo/db/repl/replica_set_config_checks.cpp
index a382353fc27..6539bd08e3f 100644
--- a/src/mongo/db/repl/replica_set_config_checks.cpp
+++ b/src/mongo/db/repl/replica_set_config_checks.cpp
@@ -150,6 +150,13 @@ Status validateOldAndNewConfigsCompatible(const ReplicaSetConfig& oldConfig,
<< newConfig.getReplSetName());
}
+ if (oldConfig.getReplicaSetId() != newConfig.getReplicaSetId()) {
+ return Status(ErrorCodes::NewReplicaSetConfigurationIncompatible,
+ str::stream() << "New and old configurations differ in replica set ID; "
+ "old was " << oldConfig.getReplicaSetId() << ", and new is "
+ << newConfig.getReplicaSetId());
+ }
+
if (oldConfig.isConfigServer() && !newConfig.isConfigServer()) {
return Status(ErrorCodes::NewReplicaSetConfigurationIncompatible,
str::stream() << "Cannot remove \""
@@ -157,7 +164,6 @@ Status validateOldAndNewConfigsCompatible(const ReplicaSetConfig& oldConfig,
<< "\" from replica set configuration on reconfig");
}
-
//
// For every member config mNew in newConfig, if there exists member config mOld
// in oldConfig such that mNew.getHostAndPort() == mOld.getHostAndPort(), it is required