From 0bc96b1ede73c82d45b6d6c2e0b9a33e613ca7c3 Mon Sep 17 00:00:00 2001 From: Benety Goh Date: Wed, 27 Jan 2016 21:26:42 -0500 Subject: SERVER-22287 added replica set ID validation to heartbeat response processing, replSetReconfigure and replica set quorum check. --- src/mongo/db/repl/replica_set_config_checks.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/mongo/db/repl/replica_set_config_checks.cpp') 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 -- cgit v1.2.1