summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJudah Schvimer <judah@mongodb.com>2017-03-06 16:02:10 -0500
committerJudah Schvimer <judah@mongodb.com>2017-04-06 09:54:34 -0400
commit85cefe3ffec8bb5df082c863d3bcca239ffed2ef (patch)
treeb5f503945c787eca4bb53d0c53f1b1fd0dd55742 /src
parentd453e01da24dc03cb67f17e46b5ced9dbe947fbb (diff)
downloadmongo-85cefe3ffec8bb5df082c863d3bcca239ffed2ef.tar.gz
SERVER-27995 make repl_set* naming convention consistent
(cherry picked from commit 5b5cf72ed9e52d71ed9f41b2219080fe46f62a3a)
Diffstat (limited to 'src')
-rw-r--r--src/mongo/SConscript2
-rw-r--r--src/mongo/client/dbclient_rs_test.cpp4
-rw-r--r--src/mongo/db/SConscript2
-rw-r--r--src/mongo/db/audit.h1
-rw-r--r--src/mongo/db/repl/SConscript20
-rw-r--r--src/mongo/db/repl/check_quorum_for_config_change.cpp10
-rw-r--r--src/mongo/db/repl/check_quorum_for_config_change.h10
-rw-r--r--src/mongo/db/repl/check_quorum_for_config_change_test.cpp104
-rw-r--r--src/mongo/db/repl/data_replicator_external_state.h4
-rw-r--r--src/mongo/db/repl/data_replicator_external_state_impl.cpp2
-rw-r--r--src/mongo/db/repl/data_replicator_external_state_impl.h2
-rw-r--r--src/mongo/db/repl/data_replicator_external_state_mock.cpp2
-rw-r--r--src/mongo/db/repl/data_replicator_external_state_mock.h4
-rw-r--r--src/mongo/db/repl/data_replicator_test.cpp2
-rw-r--r--src/mongo/db/repl/elect_cmd_runner.cpp6
-rw-r--r--src/mongo/db/repl/elect_cmd_runner.h10
-rw-r--r--src/mongo/db/repl/elect_cmd_runner_test.cpp71
-rw-r--r--src/mongo/db/repl/freshness_checker.cpp6
-rw-r--r--src/mongo/db/repl/freshness_checker.h10
-rw-r--r--src/mongo/db/repl/freshness_checker_test.cpp322
-rw-r--r--src/mongo/db/repl/freshness_scanner.cpp11
-rw-r--r--src/mongo/db/repl/freshness_scanner.h10
-rw-r--r--src/mongo/db/repl/freshness_scanner_test.cpp2
-rw-r--r--src/mongo/db/repl/member_config.cpp12
-rw-r--r--src/mongo/db/repl/member_config.h20
-rw-r--r--src/mongo/db/repl/member_config_test.cpp42
-rw-r--r--src/mongo/db/repl/oplog_fetcher.cpp4
-rw-r--r--src/mongo/db/repl/oplog_fetcher.h4
-rw-r--r--src/mongo/db/repl/oplog_fetcher_test.cpp6
-rw-r--r--src/mongo/db/repl/repl_set_commands.cpp (renamed from src/mongo/db/repl/replset_commands.cpp)0
-rw-r--r--src/mongo/db/repl/repl_set_config.cpp (renamed from src/mongo/db/repl/replica_set_config.cpp)111
-rw-r--r--src/mongo/db/repl/repl_set_config.h (renamed from src/mongo/db/repl/replica_set_config.h)22
-rw-r--r--src/mongo/db/repl/repl_set_config_checks.cpp (renamed from src/mongo/db/repl/replica_set_config_checks.cpp)37
-rw-r--r--src/mongo/db/repl/repl_set_config_checks.h (renamed from src/mongo/db/repl/replica_set_config_checks.h)14
-rw-r--r--src/mongo/db/repl/repl_set_config_checks_test.cpp (renamed from src/mongo/db/repl/replica_set_config_checks_test.cpp)80
-rw-r--r--src/mongo/db/repl/repl_set_config_test.cpp (renamed from src/mongo/db/repl/replica_set_config_test.cpp)309
-rw-r--r--src/mongo/db/repl/repl_set_heartbeat_response.cpp4
-rw-r--r--src/mongo/db/repl/repl_set_heartbeat_response.h8
-rw-r--r--src/mongo/db/repl/repl_set_heartbeat_response_test.cpp2
-rw-r--r--src/mongo/db/repl/repl_set_html_summary.h6
-rw-r--r--src/mongo/db/repl/repl_set_tag.cpp (renamed from src/mongo/db/repl/replica_set_tag.cpp)70
-rw-r--r--src/mongo/db/repl/repl_set_tag.h (renamed from src/mongo/db/repl/replica_set_tag.h)64
-rw-r--r--src/mongo/db/repl/repl_set_tag_test.cpp (renamed from src/mongo/db/repl/replica_set_tag_test.cpp)64
-rw-r--r--src/mongo/db/repl/repl_set_web_handler.cpp (renamed from src/mongo/db/repl/replset_web_handler.cpp)0
-rw-r--r--src/mongo/db/repl/replication_coordinator.h6
-rw-r--r--src/mongo/db/repl/replication_coordinator_impl.cpp42
-rw-r--r--src/mongo/db/repl/replication_coordinator_impl.h32
-rw-r--r--src/mongo/db/repl/replication_coordinator_impl_elect_test.cpp16
-rw-r--r--src/mongo/db/repl/replication_coordinator_impl_elect_v1_test.cpp56
-rw-r--r--src/mongo/db/repl/replication_coordinator_impl_heartbeat.cpp12
-rw-r--r--src/mongo/db/repl/replication_coordinator_impl_heartbeat_test.cpp52
-rw-r--r--src/mongo/db/repl/replication_coordinator_impl_heartbeat_v1_test.cpp92
-rw-r--r--src/mongo/db/repl/replication_coordinator_impl_reconfig_test.cpp8
-rw-r--r--src/mongo/db/repl/replication_coordinator_impl_test.cpp4
-rw-r--r--src/mongo/db/repl/replication_coordinator_mock.cpp4
-rw-r--r--src/mongo/db/repl/replication_coordinator_mock.h8
-rw-r--r--src/mongo/db/repl/replication_coordinator_test_fixture.cpp18
-rw-r--r--src/mongo/db/repl/replication_coordinator_test_fixture.h8
-rw-r--r--src/mongo/db/repl/sync_source_feedback.cpp2
-rw-r--r--src/mongo/db/repl/sync_tail.cpp2
-rw-r--r--src/mongo/db/repl/topology_coordinator.h4
-rw-r--r--src/mongo/db/repl/topology_coordinator_impl.cpp28
-rw-r--r--src/mongo/db/repl/topology_coordinator_impl.h10
-rw-r--r--src/mongo/db/repl/topology_coordinator_impl_test.cpp20
-rw-r--r--src/mongo/db/repl/topology_coordinator_impl_v1_test.cpp22
-rw-r--r--src/mongo/db/repl/vote_requester.cpp4
-rw-r--r--src/mongo/db/repl/vote_requester.h8
-rw-r--r--src/mongo/db/repl/vote_requester_test.cpp4
-rw-r--r--src/mongo/db/s/config/configsvr_add_shard_command.cpp2
-rw-r--r--src/mongo/dbtests/mock/mock_replica_set.cpp12
-rw-r--r--src/mongo/dbtests/mock/mock_replica_set.h8
-rw-r--r--src/mongo/dbtests/mock_replica_set_test.cpp20
-rw-r--r--src/mongo/dbtests/replica_set_monitor_test.cpp18
-rw-r--r--src/mongo/s/catalog/sharding_catalog_client.cpp2
-rw-r--r--src/mongo/s/client/shard_local.cpp2
-rw-r--r--src/mongo/s/commands/cluster_add_shard_to_zone_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_remove_shard_from_zone_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_update_zone_key_range_cmd.cpp2
-rw-r--r--src/mongo/s/sharding_mongod_test_fixture.cpp2
79 files changed, 1007 insertions, 1023 deletions
diff --git a/src/mongo/SConscript b/src/mongo/SConscript
index 68eabe6700e..0a470310ec6 100644
--- a/src/mongo/SConscript
+++ b/src/mongo/SConscript
@@ -281,7 +281,7 @@ mongodLibDeps = [
'db/mongod_options',
'db/mongodandmongos',
'db/mongodwebserver',
- 'db/repl/replset_commands',
+ 'db/repl/repl_set_commands',
'db/repl/storage_interface_impl',
'db/s/balancer',
'db/serveronly',
diff --git a/src/mongo/client/dbclient_rs_test.cpp b/src/mongo/client/dbclient_rs_test.cpp
index b900070e755..15967c07677 100644
--- a/src/mongo/client/dbclient_rs_test.cpp
+++ b/src/mongo/client/dbclient_rs_test.cpp
@@ -538,7 +538,7 @@ protected:
ConnectionString::setConnectionHook(mongo::MockConnRegistry::get()->getConnStrHook());
{
- mongo::repl::ReplicaSetConfig oldConfig = _replSet->getReplConfig();
+ mongo::repl::ReplSetConfig oldConfig = _replSet->getReplConfig();
mongo::BSONObjBuilder newConfigBuilder;
newConfigBuilder.append("_id", oldConfig.getReplSetName());
@@ -616,7 +616,7 @@ protected:
}
membersBuilder.done();
- mongo::repl::ReplicaSetConfig newConfig;
+ mongo::repl::ReplSetConfig newConfig;
fassert(28569, newConfig.initialize(newConfigBuilder.done()));
fassert(28568, newConfig.validate());
_replSet->setConfig(newConfig);
diff --git a/src/mongo/db/SConscript b/src/mongo/db/SConscript
index 9f7911a2bba..e2be152f126 100644
--- a/src/mongo/db/SConscript
+++ b/src/mongo/db/SConscript
@@ -421,7 +421,7 @@ env.Library(
"clientlistplugin.cpp",
"restapi.cpp",
"stats/snapshots_webplugins.cpp",
- "repl/replset_web_handler.cpp",
+ "repl/repl_set_web_handler.cpp",
],
LIBDEPS=[
"$BUILD_DIR/mongo/db/curop",
diff --git a/src/mongo/db/audit.h b/src/mongo/db/audit.h
index 26f27ea8a8e..e17fc99bd46 100644
--- a/src/mongo/db/audit.h
+++ b/src/mongo/db/audit.h
@@ -45,7 +45,6 @@ class Client;
class Command;
class NamespaceString;
class OperationContext;
-class ReplSetConfig;
class StringData;
class UserName;
diff --git a/src/mongo/db/repl/SConscript b/src/mongo/db/repl/SConscript
index 0996f67225f..3dd405df69e 100644
--- a/src/mongo/db/repl/SConscript
+++ b/src/mongo/db/repl/SConscript
@@ -403,7 +403,7 @@ env.Library('repl_coordinator_impl',
'freshness_checker.cpp',
'freshness_scanner.cpp',
'repl_client_info.cpp',
- 'replica_set_config_checks.cpp',
+ 'repl_set_config_checks.cpp',
'replication_coordinator_impl.cpp',
'replication_coordinator_impl_elect.cpp',
'replication_coordinator_impl_elect_v1.cpp',
@@ -461,9 +461,9 @@ env.CppUnitTest(
)
env.CppUnitTest(
- target='replica_set_config_checks_test',
+ target='repl_set_config_checks_test',
source=[
- 'replica_set_config_checks_test.cpp',
+ 'repl_set_config_checks_test.cpp',
],
LIBDEPS=[
'repl_coordinator_impl',
@@ -637,8 +637,8 @@ env.Library('replica_set_messages',
'repl_set_heartbeat_response.cpp',
'repl_set_html_summary.cpp',
'repl_set_request_votes_args.cpp',
- 'replica_set_config.cpp',
- 'replica_set_tag.cpp',
+ 'repl_set_config.cpp',
+ 'repl_set_tag.cpp',
'update_position_args.cpp',
'last_vote.cpp',
],
@@ -654,11 +654,11 @@ env.Library('replica_set_messages',
'read_concern_args',
])
-env.CppUnitTest('replica_set_config_test',
+env.CppUnitTest('repl_set_config_test',
[
'member_config_test.cpp',
- 'replica_set_config_test.cpp',
- 'replica_set_tag_test.cpp',
+ 'repl_set_config_test.cpp',
+ 'repl_set_tag_test.cpp',
],
LIBDEPS=[
'$BUILD_DIR/mongo/bson/mutable/mutable_bson',
@@ -675,9 +675,9 @@ env.CppUnitTest('isself_test',
)
env.Library(
- target='replset_commands',
+ target='repl_set_commands',
source=[
- 'replset_commands.cpp',
+ 'repl_set_commands.cpp',
'repl_set_command.cpp',
'repl_set_request_votes.cpp',
],
diff --git a/src/mongo/db/repl/check_quorum_for_config_change.cpp b/src/mongo/db/repl/check_quorum_for_config_change.cpp
index 423ea40cc94..1dd1fe3ebbb 100644
--- a/src/mongo/db/repl/check_quorum_for_config_change.cpp
+++ b/src/mongo/db/repl/check_quorum_for_config_change.cpp
@@ -34,9 +34,9 @@
#include "mongo/base/disallow_copying.h"
#include "mongo/base/status.h"
+#include "mongo/db/repl/repl_set_config.h"
#include "mongo/db/repl/repl_set_heartbeat_args.h"
#include "mongo/db/repl/repl_set_heartbeat_response.h"
-#include "mongo/db/repl/replica_set_config.h"
#include "mongo/db/repl/scatter_gather_algorithm.h"
#include "mongo/db/repl/scatter_gather_runner.h"
#include "mongo/rpc/metadata/repl_set_metadata.h"
@@ -48,7 +48,7 @@ namespace repl {
using executor::RemoteCommandRequest;
-QuorumChecker::QuorumChecker(const ReplicaSetConfig* rsConfig, int myIndex)
+QuorumChecker::QuorumChecker(const ReplSetConfig* rsConfig, int myIndex)
: _rsConfig(rsConfig),
_myIndex(myIndex),
_numResponses(1), // We "responded" to ourself already.
@@ -280,7 +280,7 @@ bool QuorumChecker::hasReceivedSufficientResponses() const {
}
Status checkQuorumGeneral(ReplicationExecutor* executor,
- const ReplicaSetConfig& rsConfig,
+ const ReplSetConfig& rsConfig,
const int myIndex) {
QuorumChecker checker(&rsConfig, myIndex);
ScatterGatherRunner runner(&checker, executor);
@@ -293,14 +293,14 @@ Status checkQuorumGeneral(ReplicationExecutor* executor,
}
Status checkQuorumForInitiate(ReplicationExecutor* executor,
- const ReplicaSetConfig& rsConfig,
+ const ReplSetConfig& rsConfig,
const int myIndex) {
invariant(rsConfig.getConfigVersion() == 1);
return checkQuorumGeneral(executor, rsConfig, myIndex);
}
Status checkQuorumForReconfig(ReplicationExecutor* executor,
- const ReplicaSetConfig& rsConfig,
+ const ReplSetConfig& rsConfig,
const int myIndex) {
invariant(rsConfig.getConfigVersion() > 1);
return checkQuorumGeneral(executor, rsConfig, myIndex);
diff --git a/src/mongo/db/repl/check_quorum_for_config_change.h b/src/mongo/db/repl/check_quorum_for_config_change.h
index f5cc2795281..746a21d5ec9 100644
--- a/src/mongo/db/repl/check_quorum_for_config_change.h
+++ b/src/mongo/db/repl/check_quorum_for_config_change.h
@@ -35,7 +35,7 @@
namespace mongo {
namespace repl {
-class ReplicaSetConfig;
+class ReplSetConfig;
/**
* Quorum checking state machine.
@@ -57,7 +57,7 @@ public:
*
* "rsConfig" must stay in scope until QuorumChecker's destructor completes.
*/
- QuorumChecker(const ReplicaSetConfig* rsConfig, int myIndex);
+ QuorumChecker(const ReplSetConfig* rsConfig, int myIndex);
virtual ~QuorumChecker();
virtual std::vector<executor::RemoteCommandRequest> getRequests() const;
@@ -86,7 +86,7 @@ private:
const ResponseStatus& response);
// Pointer to the replica set configuration for which we're checking quorum.
- const ReplicaSetConfig* const _rsConfig;
+ const ReplSetConfig* const _rsConfig;
// Index of the local node's member configuration in _rsConfig.
const int _myIndex;
@@ -127,7 +127,7 @@ private:
* - No node reports a replica set name other than the one in "rsConfig".
*/
Status checkQuorumForInitiate(ReplicationExecutor* executor,
- const ReplicaSetConfig& rsConfig,
+ const ReplSetConfig& rsConfig,
const int myIndex);
/**
@@ -145,7 +145,7 @@ Status checkQuorumForInitiate(ReplicationExecutor* executor,
* - All responding nodes report a config version less than the one in "rsConfig".
*/
Status checkQuorumForReconfig(ReplicationExecutor* executor,
- const ReplicaSetConfig& rsConfig,
+ const ReplSetConfig& rsConfig,
const int myIndex);
} // namespace repl
diff --git a/src/mongo/db/repl/check_quorum_for_config_change_test.cpp b/src/mongo/db/repl/check_quorum_for_config_change_test.cpp
index e6480598f80..ca768dd2f4f 100644
--- a/src/mongo/db/repl/check_quorum_for_config_change_test.cpp
+++ b/src/mongo/db/repl/check_quorum_for_config_change_test.cpp
@@ -33,9 +33,9 @@
#include "mongo/base/status.h"
#include "mongo/db/jsobj.h"
#include "mongo/db/repl/check_quorum_for_config_change.h"
+#include "mongo/db/repl/repl_set_config.h"
#include "mongo/db/repl/repl_set_heartbeat_args.h"
#include "mongo/db/repl/repl_set_heartbeat_response.h"
-#include "mongo/db/repl/replica_set_config.h"
#include "mongo/db/repl/replication_executor.h"
#include "mongo/executor/network_interface_mock.h"
#include "mongo/platform/unordered_set.h"
@@ -72,7 +72,7 @@ class CheckQuorumTest : public mongo::unittest::Test {
protected:
CheckQuorumTest();
- void startQuorumCheck(const ReplicaSetConfig& config, int myIndex);
+ void startQuorumCheck(const ReplSetConfig& config, int myIndex);
Status waitForQuorumCheck();
bool isQuorumCheckDone();
@@ -83,8 +83,8 @@ private:
void setUp();
void tearDown();
- void _runQuorumCheck(const ReplicaSetConfig& config, int myIndex);
- virtual Status _runQuorumCheckImpl(const ReplicaSetConfig& config, int myIndex) = 0;
+ void _runQuorumCheck(const ReplSetConfig& config, int myIndex);
+ virtual Status _runQuorumCheckImpl(const ReplSetConfig& config, int myIndex) = 0;
std::unique_ptr<stdx::thread> _executorThread;
std::unique_ptr<stdx::thread> _quorumCheckThread;
@@ -107,7 +107,7 @@ void CheckQuorumTest::tearDown() {
_executorThread->join();
}
-void CheckQuorumTest::startQuorumCheck(const ReplicaSetConfig& config, int myIndex) {
+void CheckQuorumTest::startQuorumCheck(const ReplSetConfig& config, int myIndex) {
ASSERT_FALSE(_quorumCheckThread);
_isQuorumCheckDone = false;
_quorumCheckThread.reset(
@@ -125,7 +125,7 @@ bool CheckQuorumTest::isQuorumCheckDone() {
return _isQuorumCheckDone;
}
-void CheckQuorumTest::_runQuorumCheck(const ReplicaSetConfig& config, int myIndex) {
+void CheckQuorumTest::_runQuorumCheck(const ReplSetConfig& config, int myIndex) {
_quorumCheckStatus = _runQuorumCheckImpl(config, myIndex);
stdx::lock_guard<stdx::mutex> lk(_mutex);
_isQuorumCheckDone = true;
@@ -133,46 +133,46 @@ void CheckQuorumTest::_runQuorumCheck(const ReplicaSetConfig& config, int myInde
class CheckQuorumForInitiate : public CheckQuorumTest {
private:
- virtual Status _runQuorumCheckImpl(const ReplicaSetConfig& config, int myIndex) {
+ virtual Status _runQuorumCheckImpl(const ReplSetConfig& config, int myIndex) {
return checkQuorumForInitiate(_executor.get(), config, myIndex);
}
};
class CheckQuorumForReconfig : public CheckQuorumTest {
protected:
- virtual Status _runQuorumCheckImpl(const ReplicaSetConfig& config, int myIndex) {
+ virtual Status _runQuorumCheckImpl(const ReplSetConfig& config, int myIndex) {
return checkQuorumForReconfig(_executor.get(), config, myIndex);
}
};
-ReplicaSetConfig assertMakeRSConfig(const BSONObj& configBson) {
- ReplicaSetConfig config;
+ReplSetConfig assertMakeRSConfig(const BSONObj& configBson) {
+ ReplSetConfig config;
ASSERT_OK(config.initialize(configBson));
ASSERT_OK(config.validate());
return config;
}
TEST_F(CheckQuorumForInitiate, ValidSingleNodeSet) {
- ReplicaSetConfig config = assertMakeRSConfig(BSON("_id"
- << "rs0"
- << "version"
- << 1
- << "members"
- << BSON_ARRAY(BSON("_id" << 1 << "host"
- << "h1"))));
+ ReplSetConfig config = assertMakeRSConfig(BSON("_id"
+ << "rs0"
+ << "version"
+ << 1
+ << "members"
+ << BSON_ARRAY(BSON("_id" << 1 << "host"
+ << "h1"))));
startQuorumCheck(config, 0);
ASSERT_OK(waitForQuorumCheck());
}
TEST_F(CheckQuorumForInitiate, QuorumCheckCanceledByShutdown) {
_executor->shutdown();
- ReplicaSetConfig config = assertMakeRSConfig(BSON("_id"
- << "rs0"
- << "version"
- << 1
- << "members"
- << BSON_ARRAY(BSON("_id" << 1 << "host"
- << "h1"))));
+ ReplSetConfig config = assertMakeRSConfig(BSON("_id"
+ << "rs0"
+ << "version"
+ << 1
+ << "members"
+ << BSON_ARRAY(BSON("_id" << 1 << "host"
+ << "h1"))));
startQuorumCheck(config, 0);
ASSERT_EQUALS(ErrorCodes::ShutdownInProgress, waitForQuorumCheck());
}
@@ -181,21 +181,21 @@ TEST_F(CheckQuorumForInitiate, QuorumCheckFailedDueToSeveralDownNodes) {
// In this test, "we" are host "h3:1". All other nodes time out on
// their heartbeat request, and so the quorum check for initiate
// will fail because some members were unavailable.
- ReplicaSetConfig config = assertMakeRSConfig(BSON("_id"
- << "rs0"
- << "version"
- << 1
- << "members"
- << BSON_ARRAY(BSON("_id" << 1 << "host"
- << "h1:1")
- << BSON("_id" << 2 << "host"
- << "h2:1")
- << BSON("_id" << 3 << "host"
- << "h3:1")
- << BSON("_id" << 4 << "host"
- << "h4:1")
- << BSON("_id" << 5 << "host"
- << "h5:1"))));
+ ReplSetConfig config = assertMakeRSConfig(BSON("_id"
+ << "rs0"
+ << "version"
+ << 1
+ << "members"
+ << BSON_ARRAY(BSON("_id" << 1 << "host"
+ << "h1:1")
+ << BSON("_id" << 2 << "host"
+ << "h2:1")
+ << BSON("_id" << 3 << "host"
+ << "h3:1")
+ << BSON("_id" << 4 << "host"
+ << "h4:1")
+ << BSON("_id" << 5 << "host"
+ << "h5:1"))));
startQuorumCheck(config, 2);
_net->enterNetwork();
const Date_t startDate = _net->now();
@@ -219,7 +219,7 @@ TEST_F(CheckQuorumForInitiate, QuorumCheckFailedDueToSeveralDownNodes) {
ASSERT_REASON_CONTAINS(status, "h5:1");
}
-const BSONObj makeHeartbeatRequest(const ReplicaSetConfig& rsConfig, int myConfigIndex) {
+const BSONObj makeHeartbeatRequest(const ReplSetConfig& rsConfig, int myConfigIndex) {
const MemberConfig& myConfig = rsConfig.getMemberAt(myConfigIndex);
ReplSetHeartbeatArgs hbArgs;
hbArgs.setSetName(rsConfig.getReplSetName());
@@ -235,7 +235,7 @@ TEST_F(CheckQuorumForInitiate, QuorumCheckSuccessForFiveNodes) {
// In this test, "we" are host "h3:1". All nodes respond successfully to their heartbeat
// requests, and the quorum check succeeds.
- const ReplicaSetConfig rsConfig =
+ const ReplSetConfig rsConfig =
assertMakeRSConfig(BSON("_id"
<< "rs0"
<< "version"
@@ -282,7 +282,7 @@ TEST_F(CheckQuorumForInitiate, QuorumCheckFailedDueToOneDownNode) {
// all nodes must be available for initiate. This is so even though "h2"
// is neither voting nor electable.
- const ReplicaSetConfig rsConfig =
+ const ReplSetConfig rsConfig =
assertMakeRSConfig(BSON("_id"
<< "rs0"
<< "version"
@@ -348,7 +348,7 @@ TEST_F(CheckQuorumForInitiate, QuorumCheckFailedDueToSetNameMismatch) {
// successfully to their heartbeat requests, but quorum check fails because
// "h4" declares that the requested replica set name was not what it expected.
- const ReplicaSetConfig rsConfig =
+ const ReplSetConfig rsConfig =
assertMakeRSConfig(BSON("_id"
<< "rs0"
<< "version"
@@ -410,7 +410,7 @@ TEST_F(CheckQuorumForInitiate, QuorumCheckFailedDueToSetIdMismatch) {
// "h4" declares that the requested replica set ID was not what it expected.
const auto replicaSetId = OID::gen();
- const ReplicaSetConfig rsConfig =
+ const ReplSetConfig rsConfig =
assertMakeRSConfig(BSON("_id"
<< "rs0"
<< "version"
@@ -491,7 +491,7 @@ TEST_F(CheckQuorumForInitiate, QuorumCheckFailedDueToInitializedNode) {
// successfully to their heartbeat requests, but quorum check fails because
// "h5" declares that it is already initialized.
- const ReplicaSetConfig rsConfig =
+ const ReplSetConfig rsConfig =
assertMakeRSConfig(BSON("_id"
<< "rs0"
<< "version"
@@ -557,7 +557,7 @@ TEST_F(CheckQuorumForInitiate, QuorumCheckFailedDueToInitializedNodeOnlyOneRespo
//
// Compare to QuorumCheckFailedDueToInitializedNode, above.
- const ReplicaSetConfig rsConfig =
+ const ReplSetConfig rsConfig =
assertMakeRSConfig(BSON("_id"
<< "rs0"
<< "version"
@@ -618,7 +618,7 @@ TEST_F(CheckQuorumForInitiate, QuorumCheckFailedDueToNodeWithData) {
// In this test, "we" are host "h3:1". Only node "h5" responds before the test completes,
// and quorum check fails because "h5" declares that it has data already.
- const ReplicaSetConfig rsConfig =
+ const ReplSetConfig rsConfig =
assertMakeRSConfig(BSON("_id"
<< "rs0"
<< "version"
@@ -676,7 +676,7 @@ TEST_F(CheckQuorumForReconfig, QuorumCheckVetoedDueToHigherConfigVersion) {
// In this test, "we" are host "h3:1". The request to "h2" does not arrive before the end
// of the test, and the request to "h1" comes back indicating a higher config version.
- const ReplicaSetConfig rsConfig =
+ const ReplSetConfig rsConfig =
assertMakeRSConfig(BSON("_id"
<< "rs0"
<< "version"
@@ -731,7 +731,7 @@ TEST_F(CheckQuorumForReconfig, QuorumCheckVetoedDueToIncompatibleSetName) {
// In this test, "we" are host "h3:1". The request to "h1" times out,
// and the request to "h2" comes back indicating an incompatible set name.
- const ReplicaSetConfig rsConfig =
+ const ReplSetConfig rsConfig =
assertMakeRSConfig(BSON("_id"
<< "rs0"
<< "version"
@@ -785,7 +785,7 @@ TEST_F(CheckQuorumForReconfig, QuorumCheckFailsDueToInsufficientVoters) {
// "h5" also responds, but because it cannot vote, is irrelevant for the reconfig
// quorum check.
- const ReplicaSetConfig rsConfig =
+ const ReplSetConfig rsConfig =
assertMakeRSConfig(BSON("_id"
<< "rs0"
<< "version"
@@ -850,7 +850,7 @@ TEST_F(CheckQuorumForReconfig, QuorumCheckFailsDueToNoElectableNodeResponding) {
// In this test, "we" are host "h4". Only "h1", "h2" and "h3" are electable,
// and none of them respond.
- const ReplicaSetConfig rsConfig =
+ const ReplSetConfig rsConfig =
assertMakeRSConfig(BSON("_id"
<< "rs0"
<< "version"
@@ -907,7 +907,7 @@ TEST_F(CheckQuorumForReconfig, QuorumCheckSucceedsWithAsSoonAsPossible) {
// This test should succeed as soon as h1 and h2 respond, so we block
// h3 and h5 from responding or timing out until the test completes.
- const ReplicaSetConfig rsConfig =
+ const ReplSetConfig rsConfig =
assertMakeRSConfig(BSON("_id"
<< "rs0"
<< "version"
diff --git a/src/mongo/db/repl/data_replicator_external_state.h b/src/mongo/db/repl/data_replicator_external_state.h
index 44f34ee208c..0102ddab533 100644
--- a/src/mongo/db/repl/data_replicator_external_state.h
+++ b/src/mongo/db/repl/data_replicator_external_state.h
@@ -34,7 +34,7 @@
#include "mongo/db/repl/oplog_buffer.h"
#include "mongo/db/repl/optime.h"
#include "mongo/db/repl/optime_with.h"
-#include "mongo/db/repl/replica_set_config.h"
+#include "mongo/db/repl/repl_set_config.h"
#include "mongo/rpc/metadata/oplog_query_metadata.h"
#include "mongo/rpc/metadata/repl_set_metadata.h"
#include "mongo/util/net/hostandport.h"
@@ -121,7 +121,7 @@ public:
/**
* Returns the current replica set config if there is one, or an error why there isn't.
*/
- virtual StatusWith<ReplicaSetConfig> getCurrentConfig() const = 0;
+ virtual StatusWith<ReplSetConfig> getCurrentConfig() const = 0;
private:
/**
diff --git a/src/mongo/db/repl/data_replicator_external_state_impl.cpp b/src/mongo/db/repl/data_replicator_external_state_impl.cpp
index ab166f3bdc2..eed85a8216e 100644
--- a/src/mongo/db/repl/data_replicator_external_state_impl.cpp
+++ b/src/mongo/db/repl/data_replicator_external_state_impl.cpp
@@ -115,7 +115,7 @@ std::unique_ptr<OplogBuffer> DataReplicatorExternalStateImpl::makeSteadyStateOpl
return _replicationCoordinatorExternalState->makeSteadyStateOplogBuffer(txn);
}
-StatusWith<ReplicaSetConfig> DataReplicatorExternalStateImpl::getCurrentConfig() const {
+StatusWith<ReplSetConfig> DataReplicatorExternalStateImpl::getCurrentConfig() const {
return _replicationCoordinator->getConfig();
}
diff --git a/src/mongo/db/repl/data_replicator_external_state_impl.h b/src/mongo/db/repl/data_replicator_external_state_impl.h
index d4ce61119a6..2c5518d7a1d 100644
--- a/src/mongo/db/repl/data_replicator_external_state_impl.h
+++ b/src/mongo/db/repl/data_replicator_external_state_impl.h
@@ -63,7 +63,7 @@ public:
std::unique_ptr<OplogBuffer> makeSteadyStateOplogBuffer(OperationContext* txn) const override;
- StatusWith<ReplicaSetConfig> getCurrentConfig() const override;
+ StatusWith<ReplSetConfig> getCurrentConfig() const override;
private:
StatusWith<OpTime> _multiApply(OperationContext* txn,
diff --git a/src/mongo/db/repl/data_replicator_external_state_mock.cpp b/src/mongo/db/repl/data_replicator_external_state_mock.cpp
index eeed8c240f3..a5eb417b403 100644
--- a/src/mongo/db/repl/data_replicator_external_state_mock.cpp
+++ b/src/mongo/db/repl/data_replicator_external_state_mock.cpp
@@ -90,7 +90,7 @@ std::unique_ptr<OplogBuffer> DataReplicatorExternalStateMock::makeSteadyStateOpl
return stdx::make_unique<OplogBufferBlockingQueue>();
}
-StatusWith<ReplicaSetConfig> DataReplicatorExternalStateMock::getCurrentConfig() const {
+StatusWith<ReplSetConfig> DataReplicatorExternalStateMock::getCurrentConfig() const {
return replSetConfigResult;
}
diff --git a/src/mongo/db/repl/data_replicator_external_state_mock.h b/src/mongo/db/repl/data_replicator_external_state_mock.h
index 1e32647a518..ea2943a0749 100644
--- a/src/mongo/db/repl/data_replicator_external_state_mock.h
+++ b/src/mongo/db/repl/data_replicator_external_state_mock.h
@@ -60,7 +60,7 @@ public:
std::unique_ptr<OplogBuffer> makeSteadyStateOplogBuffer(OperationContext* txn) const override;
- StatusWith<ReplicaSetConfig> getCurrentConfig() const override;
+ StatusWith<ReplSetConfig> getCurrentConfig() const override;
// Task executor. Not owned by us.
executor::TaskExecutor* taskExecutor = nullptr;
@@ -94,7 +94,7 @@ public:
MultiInitialSyncApplyFn multiInitialSyncApplyFn = [](
MultiApplier::OperationPtrs*, const HostAndPort&, AtomicUInt32*) { return Status::OK(); };
- StatusWith<ReplicaSetConfig> replSetConfigResult = ReplicaSetConfig();
+ StatusWith<ReplSetConfig> replSetConfigResult = ReplSetConfig();
private:
StatusWith<OpTime> _multiApply(OperationContext* txn,
diff --git a/src/mongo/db/repl/data_replicator_test.cpp b/src/mongo/db/repl/data_replicator_test.cpp
index 8480a435362..0955ec7aee2 100644
--- a/src/mongo/db/repl/data_replicator_test.cpp
+++ b/src/mongo/db/repl/data_replicator_test.cpp
@@ -349,7 +349,7 @@ protected:
dataReplicatorExternalState->currentTerm = 1LL;
dataReplicatorExternalState->lastCommittedOpTime = _myLastOpTime;
{
- ReplicaSetConfig config;
+ ReplSetConfig config;
ASSERT_OK(config.initialize(BSON("_id"
<< "myset"
<< "version"
diff --git a/src/mongo/db/repl/elect_cmd_runner.cpp b/src/mongo/db/repl/elect_cmd_runner.cpp
index 907f396c23c..6f155213861 100644
--- a/src/mongo/db/repl/elect_cmd_runner.cpp
+++ b/src/mongo/db/repl/elect_cmd_runner.cpp
@@ -34,7 +34,7 @@
#include "mongo/base/status.h"
#include "mongo/db/repl/member_heartbeat_data.h"
-#include "mongo/db/repl/replica_set_config.h"
+#include "mongo/db/repl/repl_set_config.h"
#include "mongo/db/repl/replication_executor.h"
#include "mongo/db/repl/scatter_gather_runner.h"
#include "mongo/util/log.h"
@@ -44,7 +44,7 @@ namespace repl {
using executor::RemoteCommandRequest;
-ElectCmdRunner::Algorithm::Algorithm(const ReplicaSetConfig& rsConfig,
+ElectCmdRunner::Algorithm::Algorithm(const ReplSetConfig& rsConfig,
int selfIndex,
const std::vector<HostAndPort>& targets,
OID round)
@@ -130,7 +130,7 @@ ElectCmdRunner::~ElectCmdRunner() {}
StatusWith<ReplicationExecutor::EventHandle> ElectCmdRunner::start(
ReplicationExecutor* executor,
- const ReplicaSetConfig& currentConfig,
+ const ReplSetConfig& currentConfig,
int selfIndex,
const std::vector<HostAndPort>& targets) {
_algorithm.reset(new Algorithm(currentConfig, selfIndex, targets, OID::gen()));
diff --git a/src/mongo/db/repl/elect_cmd_runner.h b/src/mongo/db/repl/elect_cmd_runner.h
index 32539b2cd26..c428fa11002 100644
--- a/src/mongo/db/repl/elect_cmd_runner.h
+++ b/src/mongo/db/repl/elect_cmd_runner.h
@@ -32,7 +32,7 @@
#include "mongo/base/disallow_copying.h"
#include "mongo/bson/oid.h"
-#include "mongo/db/repl/replica_set_config.h"
+#include "mongo/db/repl/repl_set_config.h"
#include "mongo/db/repl/replication_executor.h"
#include "mongo/db/repl/scatter_gather_algorithm.h"
@@ -42,7 +42,7 @@ class Status;
namespace repl {
-class ReplicaSetConfig;
+class ReplSetConfig;
class ScatterGatherRunner;
class ElectCmdRunner {
@@ -51,7 +51,7 @@ class ElectCmdRunner {
public:
class Algorithm : public ScatterGatherAlgorithm {
public:
- Algorithm(const ReplicaSetConfig& rsConfig,
+ Algorithm(const ReplSetConfig& rsConfig,
int selfIndex,
const std::vector<HostAndPort>& targets,
OID round);
@@ -75,7 +75,7 @@ public:
bool _sufficientResponsesReceived;
- const ReplicaSetConfig _rsConfig;
+ const ReplSetConfig _rsConfig;
const int _selfIndex;
const std::vector<HostAndPort> _targets;
const OID _round;
@@ -91,7 +91,7 @@ public:
* Returned handle can be used to schedule a callback when the process is complete.
*/
StatusWith<ReplicationExecutor::EventHandle> start(ReplicationExecutor* executor,
- const ReplicaSetConfig& currentConfig,
+ const ReplSetConfig& currentConfig,
int selfIndex,
const std::vector<HostAndPort>& targets);
diff --git a/src/mongo/db/repl/elect_cmd_runner_test.cpp b/src/mongo/db/repl/elect_cmd_runner_test.cpp
index 680689e713d..5c253f5bb72 100644
--- a/src/mongo/db/repl/elect_cmd_runner_test.cpp
+++ b/src/mongo/db/repl/elect_cmd_runner_test.cpp
@@ -32,7 +32,7 @@
#include "mongo/db/jsobj.h"
#include "mongo/db/repl/elect_cmd_runner.h"
#include "mongo/db/repl/member_heartbeat_data.h"
-#include "mongo/db/repl/replica_set_config.h"
+#include "mongo/db/repl/repl_set_config.h"
#include "mongo/db/repl/replication_executor.h"
#include "mongo/executor/network_interface_mock.h"
#include "mongo/stdx/functional.h"
@@ -54,7 +54,7 @@ using executor::RemoteCommandResponse;
class ElectCmdRunnerTest : public mongo::unittest::Test {
public:
void startTest(ElectCmdRunner* electCmdRunner,
- const ReplicaSetConfig& currentConfig,
+ const ReplSetConfig& currentConfig,
int selfIndex,
const std::vector<HostAndPort>& hosts);
@@ -63,7 +63,7 @@ public:
void electCmdRunnerRunner(const ReplicationExecutor::CallbackArgs& data,
ElectCmdRunner* electCmdRunner,
StatusWith<ReplicationExecutor::EventHandle>* evh,
- const ReplicaSetConfig& currentConfig,
+ const ReplSetConfig& currentConfig,
int selfIndex,
const std::vector<HostAndPort>& hosts);
@@ -89,14 +89,14 @@ void ElectCmdRunnerTest::tearDown() {
_executorThread->join();
}
-ReplicaSetConfig assertMakeRSConfig(const BSONObj& configBson) {
- ReplicaSetConfig config;
+ReplSetConfig assertMakeRSConfig(const BSONObj& configBson) {
+ ReplSetConfig config;
ASSERT_OK(config.initialize(configBson));
ASSERT_OK(config.validate());
return config;
}
-const BSONObj makeElectRequest(const ReplicaSetConfig& rsConfig, int selfIndex) {
+const BSONObj makeElectRequest(const ReplSetConfig& rsConfig, int selfIndex) {
const MemberConfig& myConfig = rsConfig.getMemberAt(selfIndex);
return BSON("replSetElect" << 1 << "set" << rsConfig.getReplSetName() << "who"
<< myConfig.getHostAndPort().toString()
@@ -125,7 +125,7 @@ BSONObj stripRound(const BSONObj& orig) {
void ElectCmdRunnerTest::electCmdRunnerRunner(const ReplicationExecutor::CallbackArgs& data,
ElectCmdRunner* electCmdRunner,
StatusWith<ReplicationExecutor::EventHandle>* evh,
- const ReplicaSetConfig& currentConfig,
+ const ReplSetConfig& currentConfig,
int selfIndex,
const std::vector<HostAndPort>& hosts) {
invariant(data.status.isOK());
@@ -135,7 +135,7 @@ void ElectCmdRunnerTest::electCmdRunnerRunner(const ReplicationExecutor::Callbac
}
void ElectCmdRunnerTest::startTest(ElectCmdRunner* electCmdRunner,
- const ReplicaSetConfig& currentConfig,
+ const ReplSetConfig& currentConfig,
int selfIndex,
const std::vector<HostAndPort>& hosts) {
StatusWith<ReplicationExecutor::EventHandle> evh(ErrorCodes::InternalError, "Not set");
@@ -160,13 +160,13 @@ void ElectCmdRunnerTest::waitForTest() {
TEST_F(ElectCmdRunnerTest, OneNode) {
// Only one node in the config.
- const ReplicaSetConfig config = assertMakeRSConfig(BSON("_id"
- << "rs0"
- << "version"
- << 1
- << "members"
- << BSON_ARRAY(BSON("_id" << 1 << "host"
- << "h1"))));
+ const ReplSetConfig config = assertMakeRSConfig(BSON("_id"
+ << "rs0"
+ << "version"
+ << 1
+ << "members"
+ << BSON_ARRAY(BSON("_id" << 1 << "host"
+ << "h1"))));
std::vector<HostAndPort> hosts;
ElectCmdRunner electCmdRunner;
@@ -177,16 +177,15 @@ TEST_F(ElectCmdRunnerTest, OneNode) {
TEST_F(ElectCmdRunnerTest, TwoNodes) {
// Two nodes, we are node h1.
- const ReplicaSetConfig config =
- assertMakeRSConfig(BSON("_id"
- << "rs0"
- << "version"
- << 1
- << "members"
- << BSON_ARRAY(BSON("_id" << 1 << "host"
- << "h0")
- << BSON("_id" << 2 << "host"
- << "h1"))));
+ const ReplSetConfig config = assertMakeRSConfig(BSON("_id"
+ << "rs0"
+ << "version"
+ << 1
+ << "members"
+ << BSON_ARRAY(BSON("_id" << 1 << "host"
+ << "h0")
+ << BSON("_id" << 2 << "host"
+ << "h1"))));
std::vector<HostAndPort> hosts;
hosts.push_back(config.getMemberAt(1).getHostAndPort());
@@ -216,15 +215,15 @@ TEST_F(ElectCmdRunnerTest, TwoNodes) {
TEST_F(ElectCmdRunnerTest, ShuttingDown) {
// Two nodes, we are node h1. Shutdown happens while we're scheduling remote commands.
- ReplicaSetConfig config = assertMakeRSConfig(BSON("_id"
- << "rs0"
- << "version"
- << 1
- << "members"
- << BSON_ARRAY(BSON("_id" << 1 << "host"
- << "h0")
- << BSON("_id" << 2 << "host"
- << "h1"))));
+ ReplSetConfig config = assertMakeRSConfig(BSON("_id"
+ << "rs0"
+ << "version"
+ << 1
+ << "members"
+ << BSON_ARRAY(BSON("_id" << 1 << "host"
+ << "h0")
+ << BSON("_id" << 2 << "host"
+ << "h1"))));
std::vector<HostAndPort> hosts;
hosts.push_back(config.getMemberAt(1).getHostAndPort());
@@ -253,11 +252,11 @@ public:
virtual void start(const BSONObj& configObj) {
int selfConfigIndex = 0;
- ReplicaSetConfig config;
+ ReplSetConfig config;
config.initialize(configObj);
std::vector<HostAndPort> hosts;
- for (ReplicaSetConfig::MemberIterator mem = ++config.membersBegin();
+ for (ReplSetConfig::MemberIterator mem = ++config.membersBegin();
mem != config.membersEnd();
++mem) {
hosts.push_back(mem->getHostAndPort());
diff --git a/src/mongo/db/repl/freshness_checker.cpp b/src/mongo/db/repl/freshness_checker.cpp
index fddef67d4fa..8ab9cb1cd7c 100644
--- a/src/mongo/db/repl/freshness_checker.cpp
+++ b/src/mongo/db/repl/freshness_checker.cpp
@@ -35,7 +35,7 @@
#include "mongo/base/status.h"
#include "mongo/bson/timestamp.h"
#include "mongo/db/repl/member_heartbeat_data.h"
-#include "mongo/db/repl/replica_set_config.h"
+#include "mongo/db/repl/repl_set_config.h"
#include "mongo/db/repl/replication_executor.h"
#include "mongo/db/repl/scatter_gather_runner.h"
#include "mongo/rpc/get_status_from_command_result.h"
@@ -49,7 +49,7 @@ namespace repl {
using executor::RemoteCommandRequest;
FreshnessChecker::Algorithm::Algorithm(Timestamp lastOpTimeApplied,
- const ReplicaSetConfig& rsConfig,
+ const ReplSetConfig& rsConfig,
int selfIndex,
const std::vector<HostAndPort>& targets)
: _responsesProcessed(0),
@@ -212,7 +212,7 @@ FreshnessChecker::~FreshnessChecker() {}
StatusWith<ReplicationExecutor::EventHandle> FreshnessChecker::start(
ReplicationExecutor* executor,
const Timestamp& lastOpTimeApplied,
- const ReplicaSetConfig& currentConfig,
+ const ReplSetConfig& currentConfig,
int selfIndex,
const std::vector<HostAndPort>& targets) {
_originalConfigVersion = currentConfig.getConfigVersion();
diff --git a/src/mongo/db/repl/freshness_checker.h b/src/mongo/db/repl/freshness_checker.h
index 6da248a203e..9d4eb50023f 100644
--- a/src/mongo/db/repl/freshness_checker.h
+++ b/src/mongo/db/repl/freshness_checker.h
@@ -32,7 +32,7 @@
#include "mongo/base/disallow_copying.h"
#include "mongo/bson/timestamp.h"
-#include "mongo/db/repl/replica_set_config.h"
+#include "mongo/db/repl/repl_set_config.h"
#include "mongo/db/repl/replication_executor.h"
#include "mongo/db/repl/scatter_gather_algorithm.h"
@@ -42,7 +42,7 @@ class Status;
namespace repl {
-class ReplicaSetConfig;
+class ReplSetConfig;
class ScatterGatherRunner;
class FreshnessChecker {
@@ -60,7 +60,7 @@ public:
class Algorithm : public ScatterGatherAlgorithm {
public:
Algorithm(Timestamp lastOpTimeApplied,
- const ReplicaSetConfig& rsConfig,
+ const ReplSetConfig& rsConfig,
int selfIndex,
const std::vector<HostAndPort>& targets);
virtual ~Algorithm();
@@ -87,7 +87,7 @@ public:
const Timestamp _lastOpTimeApplied;
// Config to use for this check
- const ReplicaSetConfig _rsConfig;
+ const ReplSetConfig _rsConfig;
// Our index position in _rsConfig
const int _selfIndex;
@@ -120,7 +120,7 @@ public:
**/
StatusWith<ReplicationExecutor::EventHandle> start(ReplicationExecutor* executor,
const Timestamp& lastOpTimeApplied,
- const ReplicaSetConfig& currentConfig,
+ const ReplSetConfig& currentConfig,
int selfIndex,
const std::vector<HostAndPort>& targets);
diff --git a/src/mongo/db/repl/freshness_checker_test.cpp b/src/mongo/db/repl/freshness_checker_test.cpp
index 5c33c8988bb..0c3930391ef 100644
--- a/src/mongo/db/repl/freshness_checker_test.cpp
+++ b/src/mongo/db/repl/freshness_checker_test.cpp
@@ -32,7 +32,7 @@
#include "mongo/db/jsobj.h"
#include "mongo/db/repl/freshness_checker.h"
#include "mongo/db/repl/member_heartbeat_data.h"
-#include "mongo/db/repl/replica_set_config.h"
+#include "mongo/db/repl/repl_set_config.h"
#include "mongo/db/repl/replication_executor.h"
#include "mongo/executor/network_interface_mock.h"
#include "mongo/platform/unordered_set.h"
@@ -60,7 +60,7 @@ bool stringContains(const std::string& haystack, const std::string& needle) {
class FreshnessCheckerTest : public mongo::unittest::Test {
protected:
void startTest(const Timestamp& lastOpTimeApplied,
- const ReplicaSetConfig& currentConfig,
+ const ReplSetConfig& currentConfig,
int selfIndex,
const std::vector<HostAndPort>& hosts);
void waitOnChecker();
@@ -79,7 +79,7 @@ protected:
private:
void freshnessCheckerRunner(const ReplicationExecutor::CallbackArgs& data,
const Timestamp& lastOpTimeApplied,
- const ReplicaSetConfig& currentConfig,
+ const ReplSetConfig& currentConfig,
int selfIndex,
const std::vector<HostAndPort>& hosts);
void setUp();
@@ -109,14 +109,14 @@ FreshnessChecker::ElectionAbortReason FreshnessCheckerTest::shouldAbortElection(
return _checker->shouldAbortElection();
}
-ReplicaSetConfig assertMakeRSConfig(const BSONObj& configBson) {
- ReplicaSetConfig config;
+ReplSetConfig assertMakeRSConfig(const BSONObj& configBson) {
+ ReplSetConfig config;
ASSERT_OK(config.initialize(configBson));
ASSERT_OK(config.validate());
return config;
}
-const BSONObj makeFreshRequest(const ReplicaSetConfig& rsConfig,
+const BSONObj makeFreshRequest(const ReplSetConfig& rsConfig,
Timestamp lastOpTimeApplied,
int selfIndex) {
const MemberConfig& myConfig = rsConfig.getMemberAt(selfIndex);
@@ -134,7 +134,7 @@ const BSONObj makeFreshRequest(const ReplicaSetConfig& rsConfig,
// for correct concurrency operation.
void FreshnessCheckerTest::freshnessCheckerRunner(const ReplicationExecutor::CallbackArgs& data,
const Timestamp& lastOpTimeApplied,
- const ReplicaSetConfig& currentConfig,
+ const ReplSetConfig& currentConfig,
int selfIndex,
const std::vector<HostAndPort>& hosts) {
invariant(data.status.isOK());
@@ -146,7 +146,7 @@ void FreshnessCheckerTest::freshnessCheckerRunner(const ReplicationExecutor::Cal
}
void FreshnessCheckerTest::startTest(const Timestamp& lastOpTimeApplied,
- const ReplicaSetConfig& currentConfig,
+ const ReplSetConfig& currentConfig,
int selfIndex,
const std::vector<HostAndPort>& hosts) {
_executor->wait(
@@ -161,15 +161,15 @@ void FreshnessCheckerTest::startTest(const Timestamp& lastOpTimeApplied,
TEST_F(FreshnessCheckerTest, TwoNodes) {
// Two nodes, we are node h1. We are freshest, but we tie with h2.
- ReplicaSetConfig config = assertMakeRSConfig(BSON("_id"
- << "rs0"
- << "version"
- << 1
- << "members"
- << BSON_ARRAY(BSON("_id" << 1 << "host"
- << "h0")
- << BSON("_id" << 2 << "host"
- << "h1"))));
+ ReplSetConfig config = assertMakeRSConfig(BSON("_id"
+ << "rs0"
+ << "version"
+ << 1
+ << "members"
+ << BSON_ARRAY(BSON("_id" << 1 << "host"
+ << "h0")
+ << BSON("_id" << 2 << "host"
+ << "h1"))));
std::vector<HostAndPort> hosts;
hosts.push_back(config.getMemberAt(1).getHostAndPort());
@@ -206,15 +206,15 @@ TEST_F(FreshnessCheckerTest, TwoNodes) {
TEST_F(FreshnessCheckerTest, ShuttingDown) {
// Two nodes, we are node h1. Shutdown happens while we're scheduling remote commands.
- ReplicaSetConfig config = assertMakeRSConfig(BSON("_id"
- << "rs0"
- << "version"
- << 1
- << "members"
- << BSON_ARRAY(BSON("_id" << 1 << "host"
- << "h0")
- << BSON("_id" << 2 << "host"
- << "h1"))));
+ ReplSetConfig config = assertMakeRSConfig(BSON("_id"
+ << "rs0"
+ << "version"
+ << 1
+ << "members"
+ << BSON_ARRAY(BSON("_id" << 1 << "host"
+ << "h0")
+ << BSON("_id" << 2 << "host"
+ << "h1"))));
std::vector<HostAndPort> hosts;
hosts.push_back(config.getMemberAt(1).getHostAndPort());
@@ -231,15 +231,15 @@ TEST_F(FreshnessCheckerTest, ShuttingDown) {
TEST_F(FreshnessCheckerTest, ElectNotElectingSelfWeAreNotFreshest) {
// other responds as fresher than us
startCapturingLogMessages();
- ReplicaSetConfig config = assertMakeRSConfig(BSON("_id"
- << "rs0"
- << "version"
- << 1
- << "members"
- << BSON_ARRAY(BSON("_id" << 1 << "host"
- << "h0")
- << BSON("_id" << 2 << "host"
- << "h1"))));
+ ReplSetConfig config = assertMakeRSConfig(BSON("_id"
+ << "rs0"
+ << "version"
+ << 1
+ << "members"
+ << BSON_ARRAY(BSON("_id" << 1 << "host"
+ << "h0")
+ << BSON("_id" << 2 << "host"
+ << "h1"))));
std::vector<HostAndPort> hosts;
hosts.push_back(config.getMemberAt(1).getHostAndPort());
@@ -284,15 +284,15 @@ TEST_F(FreshnessCheckerTest, ElectNotElectingSelfWeAreNotFreshest) {
TEST_F(FreshnessCheckerTest, ElectNotElectingSelfWeAreNotFreshestOpTime) {
// other responds with a later optime than ours
startCapturingLogMessages();
- ReplicaSetConfig config = assertMakeRSConfig(BSON("_id"
- << "rs0"
- << "version"
- << 1
- << "members"
- << BSON_ARRAY(BSON("_id" << 1 << "host"
- << "h0")
- << BSON("_id" << 2 << "host"
- << "h1"))));
+ ReplSetConfig config = assertMakeRSConfig(BSON("_id"
+ << "rs0"
+ << "version"
+ << 1
+ << "members"
+ << BSON_ARRAY(BSON("_id" << 1 << "host"
+ << "h0")
+ << BSON("_id" << 2 << "host"
+ << "h1"))));
std::vector<HostAndPort> hosts;
hosts.push_back(config.getMemberAt(1).getHostAndPort());
@@ -334,15 +334,15 @@ TEST_F(FreshnessCheckerTest, ElectNotElectingSelfWeAreNotFreshestOpTime) {
TEST_F(FreshnessCheckerTest, ElectWrongTypeInFreshnessResponse) {
// other responds with "opTime" field of non-Date value, causing not freshest
startCapturingLogMessages();
- ReplicaSetConfig config = assertMakeRSConfig(BSON("_id"
- << "rs0"
- << "version"
- << 1
- << "members"
- << BSON_ARRAY(BSON("_id" << 1 << "host"
- << "h0")
- << BSON("_id" << 2 << "host"
- << "h1"))));
+ ReplSetConfig config = assertMakeRSConfig(BSON("_id"
+ << "rs0"
+ << "version"
+ << 1
+ << "members"
+ << BSON_ARRAY(BSON("_id" << 1 << "host"
+ << "h0")
+ << BSON("_id" << 2 << "host"
+ << "h1"))));
std::vector<HostAndPort> hosts;
hosts.push_back(config.getMemberAt(1).getHostAndPort());
@@ -387,15 +387,15 @@ TEST_F(FreshnessCheckerTest, ElectWrongTypeInFreshnessResponse) {
TEST_F(FreshnessCheckerTest, ElectVetoed) {
// other responds with veto
startCapturingLogMessages();
- ReplicaSetConfig config = assertMakeRSConfig(BSON("_id"
- << "rs0"
- << "version"
- << 1
- << "members"
- << BSON_ARRAY(BSON("_id" << 1 << "host"
- << "h0")
- << BSON("_id" << 2 << "host"
- << "h1"))));
+ ReplSetConfig config = assertMakeRSConfig(BSON("_id"
+ << "rs0"
+ << "version"
+ << 1
+ << "members"
+ << BSON_ARRAY(BSON("_id" << 1 << "host"
+ << "h0")
+ << BSON("_id" << 2 << "host"
+ << "h1"))));
std::vector<HostAndPort> hosts;
hosts.push_back(config.getMemberAt(1).getHostAndPort());
@@ -442,7 +442,7 @@ TEST_F(FreshnessCheckerTest, ElectVetoed) {
"'I'd rather you didn't'"));
}
-int findIdForMember(const ReplicaSetConfig& rsConfig, const HostAndPort& host) {
+int findIdForMember(const ReplSetConfig& rsConfig, const HostAndPort& host) {
const MemberConfig* member = rsConfig.findMemberByHostAndPort(host);
ASSERT_TRUE(member != NULL) << "No host named " << host.toString() << " in config";
return member->getId();
@@ -451,24 +451,24 @@ int findIdForMember(const ReplicaSetConfig& rsConfig, const HostAndPort& host) {
TEST_F(FreshnessCheckerTest, ElectNotElectingSelfWeAreNotFreshestManyNodes) {
// one other responds as fresher than us
startCapturingLogMessages();
- ReplicaSetConfig config = assertMakeRSConfig(BSON("_id"
- << "rs0"
- << "version"
- << 1
- << "members"
- << BSON_ARRAY(BSON("_id" << 1 << "host"
- << "h0")
- << BSON("_id" << 2 << "host"
- << "h1")
- << BSON("_id" << 3 << "host"
- << "h2")
- << BSON("_id" << 4 << "host"
- << "h3")
- << BSON("_id" << 5 << "host"
- << "h4"))));
+ ReplSetConfig config = assertMakeRSConfig(BSON("_id"
+ << "rs0"
+ << "version"
+ << 1
+ << "members"
+ << BSON_ARRAY(BSON("_id" << 1 << "host"
+ << "h0")
+ << BSON("_id" << 2 << "host"
+ << "h1")
+ << BSON("_id" << 3 << "host"
+ << "h2")
+ << BSON("_id" << 4 << "host"
+ << "h3")
+ << BSON("_id" << 5 << "host"
+ << "h4"))));
std::vector<HostAndPort> hosts;
- for (ReplicaSetConfig::MemberIterator mem = ++config.membersBegin(); mem != config.membersEnd();
+ for (ReplSetConfig::MemberIterator mem = ++config.membersBegin(); mem != config.membersEnd();
++mem) {
hosts.push_back(mem->getHostAndPort());
}
@@ -511,24 +511,24 @@ TEST_F(FreshnessCheckerTest, ElectNotElectingSelfWeAreNotFreshestManyNodes) {
TEST_F(FreshnessCheckerTest, ElectNotElectingSelfWeAreNotFreshestOpTimeManyNodes) {
// one other responds with a later optime than ours
startCapturingLogMessages();
- ReplicaSetConfig config = assertMakeRSConfig(BSON("_id"
- << "rs0"
- << "version"
- << 1
- << "members"
- << BSON_ARRAY(BSON("_id" << 1 << "host"
- << "h0")
- << BSON("_id" << 2 << "host"
- << "h1")
- << BSON("_id" << 3 << "host"
- << "h2")
- << BSON("_id" << 4 << "host"
- << "h3")
- << BSON("_id" << 5 << "host"
- << "h4"))));
+ ReplSetConfig config = assertMakeRSConfig(BSON("_id"
+ << "rs0"
+ << "version"
+ << 1
+ << "members"
+ << BSON_ARRAY(BSON("_id" << 1 << "host"
+ << "h0")
+ << BSON("_id" << 2 << "host"
+ << "h1")
+ << BSON("_id" << 3 << "host"
+ << "h2")
+ << BSON("_id" << 4 << "host"
+ << "h3")
+ << BSON("_id" << 5 << "host"
+ << "h4"))));
std::vector<HostAndPort> hosts;
- for (ReplicaSetConfig::MemberIterator mem = config.membersBegin(); mem != config.membersEnd();
+ for (ReplSetConfig::MemberIterator mem = config.membersBegin(); mem != config.membersEnd();
++mem) {
if (HostAndPort("h0") == mem->getHostAndPort()) {
continue;
@@ -584,24 +584,24 @@ TEST_F(FreshnessCheckerTest, ElectNotElectingSelfWeAreNotFreshestOpTimeManyNodes
TEST_F(FreshnessCheckerTest, ElectWrongTypeInFreshnessResponseManyNodes) {
// one other responds with "opTime" field of non-Date value, causing not freshest
startCapturingLogMessages();
- ReplicaSetConfig config = assertMakeRSConfig(BSON("_id"
- << "rs0"
- << "version"
- << 1
- << "members"
- << BSON_ARRAY(BSON("_id" << 1 << "host"
- << "h0")
- << BSON("_id" << 2 << "host"
- << "h1")
- << BSON("_id" << 3 << "host"
- << "h2")
- << BSON("_id" << 4 << "host"
- << "h3")
- << BSON("_id" << 5 << "host"
- << "h4"))));
+ ReplSetConfig config = assertMakeRSConfig(BSON("_id"
+ << "rs0"
+ << "version"
+ << 1
+ << "members"
+ << BSON_ARRAY(BSON("_id" << 1 << "host"
+ << "h0")
+ << BSON("_id" << 2 << "host"
+ << "h1")
+ << BSON("_id" << 3 << "host"
+ << "h2")
+ << BSON("_id" << 4 << "host"
+ << "h3")
+ << BSON("_id" << 5 << "host"
+ << "h4"))));
std::vector<HostAndPort> hosts;
- for (ReplicaSetConfig::MemberIterator mem = ++config.membersBegin(); mem != config.membersEnd();
+ for (ReplSetConfig::MemberIterator mem = ++config.membersBegin(); mem != config.membersEnd();
++mem) {
hosts.push_back(mem->getHostAndPort());
}
@@ -646,24 +646,24 @@ TEST_F(FreshnessCheckerTest, ElectWrongTypeInFreshnessResponseManyNodes) {
TEST_F(FreshnessCheckerTest, ElectVetoedManyNodes) {
// one other responds with veto
startCapturingLogMessages();
- ReplicaSetConfig config = assertMakeRSConfig(BSON("_id"
- << "rs0"
- << "version"
- << 1
- << "members"
- << BSON_ARRAY(BSON("_id" << 1 << "host"
- << "h0")
- << BSON("_id" << 2 << "host"
- << "h1")
- << BSON("_id" << 3 << "host"
- << "h2")
- << BSON("_id" << 4 << "host"
- << "h3")
- << BSON("_id" << 5 << "host"
- << "h4"))));
+ ReplSetConfig config = assertMakeRSConfig(BSON("_id"
+ << "rs0"
+ << "version"
+ << 1
+ << "members"
+ << BSON_ARRAY(BSON("_id" << 1 << "host"
+ << "h0")
+ << BSON("_id" << 2 << "host"
+ << "h1")
+ << BSON("_id" << 3 << "host"
+ << "h2")
+ << BSON("_id" << 4 << "host"
+ << "h3")
+ << BSON("_id" << 5 << "host"
+ << "h4"))));
std::vector<HostAndPort> hosts;
- for (ReplicaSetConfig::MemberIterator mem = ++config.membersBegin(); mem != config.membersEnd();
+ for (ReplSetConfig::MemberIterator mem = ++config.membersBegin(); mem != config.membersEnd();
++mem) {
hosts.push_back(mem->getHostAndPort());
}
@@ -708,24 +708,24 @@ TEST_F(FreshnessCheckerTest, ElectVetoedManyNodes) {
TEST_F(FreshnessCheckerTest, ElectVetoedAndTiedFreshnessManyNodes) {
// one other responds with veto and another responds with tie
startCapturingLogMessages();
- ReplicaSetConfig config = assertMakeRSConfig(BSON("_id"
- << "rs0"
- << "version"
- << 1
- << "members"
- << BSON_ARRAY(BSON("_id" << 1 << "host"
- << "h0")
- << BSON("_id" << 2 << "host"
- << "h1")
- << BSON("_id" << 3 << "host"
- << "h2")
- << BSON("_id" << 4 << "host"
- << "h3")
- << BSON("_id" << 5 << "host"
- << "h4"))));
+ ReplSetConfig config = assertMakeRSConfig(BSON("_id"
+ << "rs0"
+ << "version"
+ << 1
+ << "members"
+ << BSON_ARRAY(BSON("_id" << 1 << "host"
+ << "h0")
+ << BSON("_id" << 2 << "host"
+ << "h1")
+ << BSON("_id" << 3 << "host"
+ << "h2")
+ << BSON("_id" << 4 << "host"
+ << "h3")
+ << BSON("_id" << 5 << "host"
+ << "h4"))));
std::vector<HostAndPort> hosts;
- for (ReplicaSetConfig::MemberIterator mem = config.membersBegin(); mem != config.membersEnd();
+ for (ReplSetConfig::MemberIterator mem = config.membersBegin(); mem != config.membersEnd();
++mem) {
if (HostAndPort("h0") == mem->getHostAndPort()) {
continue;
@@ -786,24 +786,24 @@ TEST_F(FreshnessCheckerTest, ElectVetoedAndTiedFreshnessManyNodes) {
}
TEST_F(FreshnessCheckerTest, ElectManyNodesNotAllRespond) {
- ReplicaSetConfig config = assertMakeRSConfig(BSON("_id"
- << "rs0"
- << "version"
- << 1
- << "members"
- << BSON_ARRAY(BSON("_id" << 1 << "host"
- << "h0")
- << BSON("_id" << 2 << "host"
- << "h1")
- << BSON("_id" << 3 << "host"
- << "h2")
- << BSON("_id" << 4 << "host"
- << "h3")
- << BSON("_id" << 5 << "host"
- << "h4"))));
+ ReplSetConfig config = assertMakeRSConfig(BSON("_id"
+ << "rs0"
+ << "version"
+ << 1
+ << "members"
+ << BSON_ARRAY(BSON("_id" << 1 << "host"
+ << "h0")
+ << BSON("_id" << 2 << "host"
+ << "h1")
+ << BSON("_id" << 3 << "host"
+ << "h2")
+ << BSON("_id" << 4 << "host"
+ << "h3")
+ << BSON("_id" << 5 << "host"
+ << "h4"))));
std::vector<HostAndPort> hosts;
- for (ReplicaSetConfig::MemberIterator mem = ++config.membersBegin(); mem != config.membersEnd();
+ for (ReplSetConfig::MemberIterator mem = ++config.membersBegin(); mem != config.membersEnd();
++mem) {
hosts.push_back(mem->getHostAndPort());
}
@@ -850,7 +850,7 @@ public:
int selfConfigIndex = 0;
Timestamp lastOpTimeApplied(100, 0);
- ReplicaSetConfig config;
+ ReplSetConfig config;
config.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -864,7 +864,7 @@ public:
<< "host2"))));
std::vector<HostAndPort> hosts;
- for (ReplicaSetConfig::MemberIterator mem = ++config.membersBegin();
+ for (ReplSetConfig::MemberIterator mem = ++config.membersBegin();
mem != config.membersEnd();
++mem) {
hosts.push_back(mem->getHostAndPort());
diff --git a/src/mongo/db/repl/freshness_scanner.cpp b/src/mongo/db/repl/freshness_scanner.cpp
index e3880d6cc76..f9de9409373 100644
--- a/src/mongo/db/repl/freshness_scanner.cpp
+++ b/src/mongo/db/repl/freshness_scanner.cpp
@@ -45,7 +45,7 @@ namespace repl {
using executor::RemoteCommandRequest;
-FreshnessScanner::Algorithm::Algorithm(const ReplicaSetConfig& rsConfig,
+FreshnessScanner::Algorithm::Algorithm(const ReplSetConfig& rsConfig,
int myIndex,
Milliseconds timeout)
: _rsConfig(rsConfig), _myIndex(myIndex), _timeout(timeout) {
@@ -108,11 +108,10 @@ FreshnessScanner::Result FreshnessScanner::Algorithm::getResult() const {
return _freshnessInfos;
}
-StatusWith<ReplicationExecutor::EventHandle> FreshnessScanner::start(
- ReplicationExecutor* executor,
- const ReplicaSetConfig& rsConfig,
- int myIndex,
- Milliseconds timeout) {
+StatusWith<ReplicationExecutor::EventHandle> FreshnessScanner::start(ReplicationExecutor* executor,
+ const ReplSetConfig& rsConfig,
+ int myIndex,
+ Milliseconds timeout) {
_algorithm.reset(new Algorithm(rsConfig, myIndex, timeout));
_runner.reset(new ScatterGatherRunner(_algorithm.get(), executor));
return _runner->start();
diff --git a/src/mongo/db/repl/freshness_scanner.h b/src/mongo/db/repl/freshness_scanner.h
index af71f5912e1..bc474b4fadd 100644
--- a/src/mongo/db/repl/freshness_scanner.h
+++ b/src/mongo/db/repl/freshness_scanner.h
@@ -34,7 +34,7 @@
#include "mongo/base/disallow_copying.h"
#include "mongo/bson/timestamp.h"
#include "mongo/db/repl/optime.h"
-#include "mongo/db/repl/replica_set_config.h"
+#include "mongo/db/repl/repl_set_config.h"
#include "mongo/db/repl/replication_executor.h"
#include "mongo/db/repl/scatter_gather_algorithm.h"
#include "mongo/db/repl/scatter_gather_runner.h"
@@ -53,7 +53,7 @@ class FreshnessScanner {
public:
struct FreshnessInfo {
- // The index of node in ReplicaSetConfig.
+ // The index of node in ReplSetConfig.
int index;
// The latest applied opTime on that node.
OpTime opTime;
@@ -63,7 +63,7 @@ public:
class Algorithm : public ScatterGatherAlgorithm {
public:
- Algorithm(const ReplicaSetConfig& rsConfig, int myIndex, Milliseconds timeout);
+ Algorithm(const ReplSetConfig& rsConfig, int myIndex, Milliseconds timeout);
virtual std::vector<executor::RemoteCommandRequest> getRequests() const;
virtual void processResponse(const executor::RemoteCommandRequest& request,
const ResponseStatus& response);
@@ -77,7 +77,7 @@ public:
Result getResult() const;
private:
- const ReplicaSetConfig _rsConfig;
+ const ReplSetConfig _rsConfig;
std::vector<HostAndPort> _targets;
const int _myIndex;
const Milliseconds _timeout;
@@ -97,7 +97,7 @@ public:
* If this function returns Status::OK(), evh is then guaranteed to be signaled.
**/
StatusWith<ReplicationExecutor::EventHandle> start(ReplicationExecutor* executor,
- const ReplicaSetConfig& rsConfig,
+ const ReplSetConfig& rsConfig,
int myIndex,
Milliseconds timeout);
diff --git a/src/mongo/db/repl/freshness_scanner_test.cpp b/src/mongo/db/repl/freshness_scanner_test.cpp
index d931ef55b70..7a4339e956a 100644
--- a/src/mongo/db/repl/freshness_scanner_test.cpp
+++ b/src/mongo/db/repl/freshness_scanner_test.cpp
@@ -119,7 +119,7 @@ protected:
return makeResponseStatus(response);
}
- ReplicaSetConfig _config;
+ ReplSetConfig _config;
private:
// owned by _executor
diff --git a/src/mongo/db/repl/member_config.cpp b/src/mongo/db/repl/member_config.cpp
index d8f3c1ed7bf..2e459d4757d 100644
--- a/src/mongo/db/repl/member_config.cpp
+++ b/src/mongo/db/repl/member_config.cpp
@@ -75,7 +75,7 @@ const Seconds kMaxSlaveDelay(3600 * 24 * 366);
} // namespace
-Status MemberConfig::initialize(const BSONObj& mcfg, ReplicaSetTagConfig* tagConfig) {
+Status MemberConfig::initialize(const BSONObj& mcfg, ReplSetTagConfig* tagConfig) {
Status status = bsonCheckOnlyHasFields(
"replica set member configuration", mcfg, kLegalMemberConfigFieldNames);
if (!status.isOK())
@@ -270,9 +270,8 @@ Status MemberConfig::validate() const {
return Status::OK();
}
-bool MemberConfig::hasTags(const ReplicaSetTagConfig& tagConfig) const {
- for (std::vector<ReplicaSetTag>::const_iterator tag = _tags.begin(); tag != _tags.end();
- tag++) {
+bool MemberConfig::hasTags(const ReplSetTagConfig& tagConfig) const {
+ for (std::vector<ReplSetTag>::const_iterator tag = _tags.begin(); tag != _tags.end(); tag++) {
std::string tagKey = tagConfig.getTagKey(*tag);
if (tagKey[0] == '$') {
// Filter out internal tags
@@ -283,7 +282,7 @@ bool MemberConfig::hasTags(const ReplicaSetTagConfig& tagConfig) const {
return false;
}
-BSONObj MemberConfig::toBSON(const ReplicaSetTagConfig& tagConfig) const {
+BSONObj MemberConfig::toBSON(const ReplSetTagConfig& tagConfig) const {
BSONObjBuilder configBuilder;
configBuilder.append("_id", _id);
configBuilder.append("host", _host.toString());
@@ -293,8 +292,7 @@ BSONObj MemberConfig::toBSON(const ReplicaSetTagConfig& tagConfig) const {
configBuilder.append("priority", _priority);
BSONObjBuilder tags(configBuilder.subobjStart("tags"));
- for (std::vector<ReplicaSetTag>::const_iterator tag = _tags.begin(); tag != _tags.end();
- tag++) {
+ for (std::vector<ReplSetTag>::const_iterator tag = _tags.begin(); tag != _tags.end(); tag++) {
std::string tagKey = tagConfig.getTagKey(*tag);
if (tagKey[0] == '$') {
// Filter out internal tags
diff --git a/src/mongo/db/repl/member_config.h b/src/mongo/db/repl/member_config.h
index 694a8941f8e..5da77cf3048 100644
--- a/src/mongo/db/repl/member_config.h
+++ b/src/mongo/db/repl/member_config.h
@@ -32,7 +32,7 @@
#include <vector>
#include "mongo/base/status.h"
-#include "mongo/db/repl/replica_set_tag.h"
+#include "mongo/db/repl/repl_set_tag.h"
#include "mongo/util/net/hostandport.h"
#include "mongo/util/time_support.h"
@@ -47,7 +47,7 @@ namespace repl {
*/
class MemberConfig {
public:
- typedef std::vector<ReplicaSetTag>::const_iterator TagIterator;
+ typedef std::vector<ReplSetTag>::const_iterator TagIterator;
static const std::string kIdFieldName;
static const std::string kVotesFieldName;
@@ -72,12 +72,12 @@ public:
/**
* Initializes this MemberConfig from the contents of "mcfg".
*
- * If "mcfg" describes any tags, builds ReplicaSetTags for this
+ * If "mcfg" describes any tags, builds ReplSetTags for this
* configuration using "tagConfig" as the tag's namespace. This may
* have the effect of altering "tagConfig" when "mcfg" describes a
* tag not previously added to "tagConfig".
*/
- Status initialize(const BSONObj& mcfg, ReplicaSetTagConfig* tagConfig);
+ Status initialize(const BSONObj& mcfg, ReplSetTagConfig* tagConfig);
/**
* Performs basic consistency checks on the member configuration.
@@ -85,7 +85,7 @@ public:
Status validate() const;
/**
- * Gets the identifier for this member, unique within a ReplicaSetConfig.
+ * Gets the identifier for this member, unique within a ReplSetConfig.
*/
int getId() const {
return _id;
@@ -161,7 +161,7 @@ public:
* Returns true if this MemberConfig has any non-internal tags, using "tagConfig" to
* determine the internal property of the tags.
*/
- bool hasTags(const ReplicaSetTagConfig& tagConfig) const;
+ bool hasTags(const ReplSetTagConfig& tagConfig) const;
/**
* Gets a begin iterator over the tags for this member.
@@ -187,7 +187,7 @@ public:
/**
* Returns the member config as a BSONObj, using "tagConfig" to generate the tag subdoc.
*/
- BSONObj toBSON(const ReplicaSetTagConfig& tagConfig) const;
+ BSONObj toBSON(const ReplSetTagConfig& tagConfig) const;
private:
int _id;
@@ -196,9 +196,9 @@ private:
int _votes; // Can this member vote? Only 0 and 1 are valid. Default 1.
bool _arbiterOnly;
Seconds _slaveDelay;
- bool _hidden; // if set, don't advertise to drivers in isMaster.
- bool _buildIndexes; // if false, do not create any non-_id indexes
- std::vector<ReplicaSetTag> _tags; // tagging for data center, rack, etc.
+ bool _hidden; // if set, don't advertise to drivers in isMaster.
+ bool _buildIndexes; // if false, do not create any non-_id indexes
+ std::vector<ReplSetTag> _tags; // tagging for data center, rack, etc.
};
} // namespace repl
diff --git a/src/mongo/db/repl/member_config_test.cpp b/src/mongo/db/repl/member_config_test.cpp
index eda31743ba7..31174f25057 100644
--- a/src/mongo/db/repl/member_config_test.cpp
+++ b/src/mongo/db/repl/member_config_test.cpp
@@ -39,7 +39,7 @@ namespace repl {
namespace {
TEST(MemberConfig, ParseMinimalMemberConfigAndCheckDefaults) {
- ReplicaSetTagConfig tagConfig;
+ ReplSetTagConfig tagConfig;
MemberConfig mc;
ASSERT_OK(mc.initialize(BSON("_id" << 0 << "host"
<< "localhost:12345"),
@@ -57,7 +57,7 @@ TEST(MemberConfig, ParseMinimalMemberConfigAndCheckDefaults) {
}
TEST(MemberConfig, ParseFailsWithIllegalFieldName) {
- ReplicaSetTagConfig tagConfig;
+ ReplSetTagConfig tagConfig;
MemberConfig mc;
ASSERT_EQUALS(ErrorCodes::BadValue,
mc.initialize(BSON("_id" << 0 << "host"
@@ -68,7 +68,7 @@ TEST(MemberConfig, ParseFailsWithIllegalFieldName) {
}
TEST(MemberConfig, ParseFailsWithMissingIdField) {
- ReplicaSetTagConfig tagConfig;
+ ReplSetTagConfig tagConfig;
MemberConfig mc;
ASSERT_EQUALS(ErrorCodes::NoSuchKey,
mc.initialize(BSON("host"
@@ -77,7 +77,7 @@ TEST(MemberConfig, ParseFailsWithMissingIdField) {
}
TEST(MemberConfig, ParseFailsWithBadIdField) {
- ReplicaSetTagConfig tagConfig;
+ ReplSetTagConfig tagConfig;
MemberConfig mc;
ASSERT_EQUALS(ErrorCodes::NoSuchKey,
mc.initialize(BSON("host"
@@ -96,14 +96,14 @@ TEST(MemberConfig, ParseFailsWithBadIdField) {
}
TEST(MemberConfig, ParseFailsWithMissingHostField) {
- ReplicaSetTagConfig tagConfig;
+ ReplSetTagConfig tagConfig;
MemberConfig mc;
ASSERT_EQUALS(ErrorCodes::NoSuchKey, mc.initialize(BSON("_id" << 0), &tagConfig));
}
TEST(MemberConfig, ParseFailsWithBadHostField) {
- ReplicaSetTagConfig tagConfig;
+ ReplSetTagConfig tagConfig;
MemberConfig mc;
ASSERT_EQUALS(ErrorCodes::TypeMismatch,
mc.initialize(BSON("_id" << 0 << "host" << 0), &tagConfig));
@@ -118,7 +118,7 @@ TEST(MemberConfig, ParseFailsWithBadHostField) {
}
TEST(MemberConfig, ParseArbiterOnly) {
- ReplicaSetTagConfig tagConfig;
+ ReplSetTagConfig tagConfig;
MemberConfig mc;
ASSERT_OK(mc.initialize(BSON("_id" << 0 << "host"
<< "h"
@@ -135,7 +135,7 @@ TEST(MemberConfig, ParseArbiterOnly) {
}
TEST(MemberConfig, ParseHidden) {
- ReplicaSetTagConfig tagConfig;
+ ReplSetTagConfig tagConfig;
MemberConfig mc;
ASSERT_OK(mc.initialize(BSON("_id" << 0 << "host"
<< "h"
@@ -158,7 +158,7 @@ TEST(MemberConfig, ParseHidden) {
}
TEST(MemberConfig, ParseBuildIndexes) {
- ReplicaSetTagConfig tagConfig;
+ ReplSetTagConfig tagConfig;
MemberConfig mc;
ASSERT_OK(mc.initialize(BSON("_id" << 0 << "host"
<< "h"
@@ -175,7 +175,7 @@ TEST(MemberConfig, ParseBuildIndexes) {
}
TEST(MemberConfig, ParseVotes) {
- ReplicaSetTagConfig tagConfig;
+ ReplSetTagConfig tagConfig;
MemberConfig mc;
ASSERT_OK(mc.initialize(BSON("_id" << 0 << "host"
<< "h"
@@ -226,7 +226,7 @@ TEST(MemberConfig, ParseVotes) {
}
TEST(MemberConfig, ParsePriority) {
- ReplicaSetTagConfig tagConfig;
+ ReplSetTagConfig tagConfig;
MemberConfig mc;
ASSERT_OK(mc.initialize(BSON("_id" << 0 << "host"
<< "h"
@@ -256,7 +256,7 @@ TEST(MemberConfig, ParsePriority) {
}
TEST(MemberConfig, ParseSlaveDelay) {
- ReplicaSetTagConfig tagConfig;
+ ReplSetTagConfig tagConfig;
MemberConfig mc;
ASSERT_OK(mc.initialize(BSON("_id" << 0 << "host"
<< "h"
@@ -267,7 +267,7 @@ TEST(MemberConfig, ParseSlaveDelay) {
}
TEST(MemberConfig, ParseTags) {
- ReplicaSetTagConfig tagConfig;
+ ReplSetTagConfig tagConfig;
MemberConfig mc;
ASSERT_OK(mc.initialize(BSON("_id" << 0 << "host"
<< "h"
@@ -288,7 +288,7 @@ TEST(MemberConfig, ParseTags) {
}
TEST(MemberConfig, ValidateFailsWithIdOutOfRange) {
- ReplicaSetTagConfig tagConfig;
+ ReplSetTagConfig tagConfig;
MemberConfig mc;
ASSERT_OK(mc.initialize(BSON("_id" << -1 << "host"
<< "localhost:12345"),
@@ -301,7 +301,7 @@ TEST(MemberConfig, ValidateFailsWithIdOutOfRange) {
}
TEST(MemberConfig, ValidateVotes) {
- ReplicaSetTagConfig tagConfig;
+ ReplSetTagConfig tagConfig;
MemberConfig mc;
ASSERT_OK(mc.initialize(BSON("_id" << 0 << "host"
@@ -368,7 +368,7 @@ TEST(MemberConfig, ValidateVotes) {
}
TEST(MemberConfig, ValidatePriorityRanges) {
- ReplicaSetTagConfig tagConfig;
+ ReplSetTagConfig tagConfig;
MemberConfig mc;
ASSERT_OK(mc.initialize(BSON("_id" << 0 << "host"
<< "h"
@@ -397,7 +397,7 @@ TEST(MemberConfig, ValidatePriorityRanges) {
}
TEST(MemberConfig, ValidateSlaveDelays) {
- ReplicaSetTagConfig tagConfig;
+ ReplSetTagConfig tagConfig;
MemberConfig mc;
ASSERT_OK(mc.initialize(BSON("_id" << 0 << "host"
<< "h"
@@ -434,7 +434,7 @@ TEST(MemberConfig, ValidateSlaveDelays) {
}
TEST(MemberConfig, ValidatePriorityAndSlaveDelayRelationship) {
- ReplicaSetTagConfig tagConfig;
+ ReplSetTagConfig tagConfig;
MemberConfig mc;
ASSERT_OK(mc.initialize(BSON("_id" << 0 << "host"
<< "h"
@@ -447,7 +447,7 @@ TEST(MemberConfig, ValidatePriorityAndSlaveDelayRelationship) {
}
TEST(MemberConfig, ValidatePriorityAndHiddenRelationship) {
- ReplicaSetTagConfig tagConfig;
+ ReplSetTagConfig tagConfig;
MemberConfig mc;
ASSERT_OK(mc.initialize(BSON("_id" << 0 << "host"
<< "h"
@@ -468,7 +468,7 @@ TEST(MemberConfig, ValidatePriorityAndHiddenRelationship) {
}
TEST(MemberConfig, ValidatePriorityAndBuildIndexesRelationship) {
- ReplicaSetTagConfig tagConfig;
+ ReplSetTagConfig tagConfig;
MemberConfig mc;
ASSERT_OK(mc.initialize(BSON("_id" << 0 << "host"
<< "h"
@@ -490,7 +490,7 @@ TEST(MemberConfig, ValidatePriorityAndBuildIndexesRelationship) {
}
TEST(MemberConfig, ValidateArbiterVotesRelationship) {
- ReplicaSetTagConfig tagConfig;
+ ReplSetTagConfig tagConfig;
MemberConfig mc;
ASSERT_OK(mc.initialize(BSON("_id" << 0 << "host"
<< "h"
diff --git a/src/mongo/db/repl/oplog_fetcher.cpp b/src/mongo/db/repl/oplog_fetcher.cpp
index 81a3a606bff..e06ff578870 100644
--- a/src/mongo/db/repl/oplog_fetcher.cpp
+++ b/src/mongo/db/repl/oplog_fetcher.cpp
@@ -76,7 +76,7 @@ ServerStatusMetricField<Counter64> displayBytesRead("repl.network.bytes", &netwo
/**
* Calculates await data timeout based on the current replica set configuration.
*/
-Milliseconds calculateAwaitDataTimeout(const ReplicaSetConfig& config) {
+Milliseconds calculateAwaitDataTimeout(const ReplSetConfig& config) {
// Under protocol version 1, make the awaitData timeout (maxTimeMS) dependent on the election
// timeout. This enables the sync source to communicate liveness of the primary to secondaries.
// Under protocol version 0, use a default timeout of 2 seconds for awaitData.
@@ -272,7 +272,7 @@ OplogFetcher::OplogFetcher(executor::TaskExecutor* executor,
OpTimeWithHash lastFetched,
HostAndPort source,
NamespaceString nss,
- ReplicaSetConfig config,
+ ReplSetConfig config,
std::size_t maxFetcherRestarts,
DataReplicatorExternalState* dataReplicatorExternalState,
EnqueueDocumentsFn enqueueDocumentsFn,
diff --git a/src/mongo/db/repl/oplog_fetcher.h b/src/mongo/db/repl/oplog_fetcher.h
index ff50f82c068..943cb3d8ec6 100644
--- a/src/mongo/db/repl/oplog_fetcher.h
+++ b/src/mongo/db/repl/oplog_fetcher.h
@@ -39,7 +39,7 @@
#include "mongo/db/namespace_string.h"
#include "mongo/db/repl/data_replicator_external_state.h"
#include "mongo/db/repl/optime_with.h"
-#include "mongo/db/repl/replica_set_config.h"
+#include "mongo/db/repl/repl_set_config.h"
#include "mongo/stdx/condition_variable.h"
#include "mongo/stdx/functional.h"
#include "mongo/stdx/mutex.h"
@@ -134,7 +134,7 @@ public:
OpTimeWithHash lastFetched,
HostAndPort source,
NamespaceString nss,
- ReplicaSetConfig config,
+ ReplSetConfig config,
std::size_t maxFetcherRestarts,
DataReplicatorExternalState* dataReplicatorExternalState,
EnqueueDocumentsFn enqueueDocumentsFn,
diff --git a/src/mongo/db/repl/oplog_fetcher_test.cpp b/src/mongo/db/repl/oplog_fetcher_test.cpp
index a94dac92122..5419e7d7f13 100644
--- a/src/mongo/db/repl/oplog_fetcher_test.cpp
+++ b/src/mongo/db/repl/oplog_fetcher_test.cpp
@@ -177,7 +177,7 @@ RemoteCommandRequest OplogFetcherTest::processNetworkResponse(
HostAndPort source("localhost:12345");
NamespaceString nss("local.oplog.rs");
-ReplicaSetConfig _createConfig(bool isV1ElectionProtocol) {
+ReplSetConfig _createConfig(bool isV1ElectionProtocol) {
BSONObjBuilder bob;
bob.append("_id", "myset");
bob.append("version", 1);
@@ -195,7 +195,7 @@ ReplicaSetConfig _createConfig(bool isV1ElectionProtocol) {
}
auto configObj = bob.obj();
- ReplicaSetConfig config;
+ ReplSetConfig config;
ASSERT_OK(config.initialize(configObj));
return config;
}
@@ -267,7 +267,7 @@ TEST_F(OplogFetcherTest, InvalidConstruction) {
lastFetched,
source,
nss,
- ReplicaSetConfig(),
+ ReplSetConfig(),
0,
dataReplicatorExternalState.get(),
enqueueDocumentsFn,
diff --git a/src/mongo/db/repl/replset_commands.cpp b/src/mongo/db/repl/repl_set_commands.cpp
index c2793e42764..c2793e42764 100644
--- a/src/mongo/db/repl/replset_commands.cpp
+++ b/src/mongo/db/repl/repl_set_commands.cpp
diff --git a/src/mongo/db/repl/replica_set_config.cpp b/src/mongo/db/repl/repl_set_config.cpp
index 9b2ab012a59..929f2c5d2f0 100644
--- a/src/mongo/db/repl/replica_set_config.cpp
+++ b/src/mongo/db/repl/repl_set_config.cpp
@@ -28,7 +28,7 @@
#include "mongo/platform/basic.h"
-#include "mongo/db/repl/replica_set_config.h"
+#include "mongo/db/repl/repl_set_config.h"
#include <algorithm>
@@ -42,17 +42,17 @@
namespace mongo {
namespace repl {
-const size_t ReplicaSetConfig::kMaxMembers;
-const size_t ReplicaSetConfig::kMaxVotingMembers;
+const size_t ReplSetConfig::kMaxMembers;
+const size_t ReplSetConfig::kMaxVotingMembers;
-const std::string ReplicaSetConfig::kConfigServerFieldName = "configsvr";
-const std::string ReplicaSetConfig::kVersionFieldName = "version";
-const std::string ReplicaSetConfig::kMajorityWriteConcernModeName = "$majority";
-const Milliseconds ReplicaSetConfig::kDefaultHeartbeatInterval(2000);
-const Seconds ReplicaSetConfig::kDefaultHeartbeatTimeoutPeriod(10);
-const Milliseconds ReplicaSetConfig::kDefaultElectionTimeoutPeriod(10000);
-const Milliseconds ReplicaSetConfig::kDefaultCatchUpTimeoutPeriod(2000);
-const bool ReplicaSetConfig::kDefaultChainingAllowed(true);
+const std::string ReplSetConfig::kConfigServerFieldName = "configsvr";
+const std::string ReplSetConfig::kVersionFieldName = "version";
+const std::string ReplSetConfig::kMajorityWriteConcernModeName = "$majority";
+const Milliseconds ReplSetConfig::kDefaultHeartbeatInterval(2000);
+const Seconds ReplSetConfig::kDefaultHeartbeatTimeoutPeriod(10);
+const Milliseconds ReplSetConfig::kDefaultElectionTimeoutPeriod(10000);
+const Milliseconds ReplSetConfig::kDefaultCatchUpTimeoutPeriod(2000);
+const bool ReplSetConfig::kDefaultChainingAllowed(true);
namespace {
@@ -65,11 +65,11 @@ const std::string kWriteConcernMajorityJournalDefaultFieldName =
"writeConcernMajorityJournalDefault";
const std::string kLegalConfigTopFieldNames[] = {kIdFieldName,
- ReplicaSetConfig::kVersionFieldName,
+ ReplSetConfig::kVersionFieldName,
kMembersFieldName,
kSettingsFieldName,
kProtocolVersionFieldName,
- ReplicaSetConfig::kConfigServerFieldName,
+ ReplSetConfig::kConfigServerFieldName,
kWriteConcernMajorityJournalDefaultFieldName};
const std::string kChainingAllowedFieldName = "chainingAllowed";
@@ -83,20 +83,20 @@ const std::string kReplicaSetIdFieldName = "replicaSetId";
} // namespace
-Status ReplicaSetConfig::initialize(const BSONObj& cfg,
- bool usePV1ByDefault,
- OID defaultReplicaSetId) {
+Status ReplSetConfig::initialize(const BSONObj& cfg,
+ bool usePV1ByDefault,
+ OID defaultReplicaSetId) {
return _initialize(cfg, false, usePV1ByDefault, defaultReplicaSetId);
}
-Status ReplicaSetConfig::initializeForInitiate(const BSONObj& cfg, bool usePV1ByDefault) {
+Status ReplSetConfig::initializeForInitiate(const BSONObj& cfg, bool usePV1ByDefault) {
return _initialize(cfg, true, usePV1ByDefault, OID());
}
-Status ReplicaSetConfig::_initialize(const BSONObj& cfg,
- bool forInitiate,
- bool usePV1ByDefault,
- OID defaultReplicaSetId) {
+Status ReplSetConfig::_initialize(const BSONObj& cfg,
+ bool forInitiate,
+ bool usePV1ByDefault,
+ OID defaultReplicaSetId) {
_isInitialized = false;
_members.clear();
Status status =
@@ -219,7 +219,7 @@ Status ReplicaSetConfig::_initialize(const BSONObj& cfg,
return Status::OK();
}
-Status ReplicaSetConfig::_parseSettingsSubdocument(const BSONObj& settings) {
+Status ReplSetConfig::_parseSettingsSubdocument(const BSONObj& settings) {
//
// Parse heartbeatIntervalMillis
//
@@ -340,7 +340,7 @@ Status ReplicaSetConfig::_parseSettingsSubdocument(const BSONObj& settings) {
<< " to be an Object, not "
<< typeName(modeElement.type()));
}
- ReplicaSetTagPattern pattern = _tagConfig.makePattern();
+ ReplSetTagPattern pattern = _tagConfig.makePattern();
for (BSONObj::iterator constraintIter(modeElement.Obj()); constraintIter.more();) {
const BSONElement constraintElement = constraintIter.next();
if (!constraintElement.isNumber()) {
@@ -391,7 +391,7 @@ Status ReplicaSetConfig::_parseSettingsSubdocument(const BSONObj& settings) {
return Status::OK();
}
-Status ReplicaSetConfig::validate() const {
+Status ReplSetConfig::validate() const {
if (_version <= 0 || _version > std::numeric_limits<int>::max()) {
return Status(ErrorCodes::BadValue,
str::stream() << kVersionFieldName << " field value of " << _version
@@ -570,21 +570,21 @@ Status ReplicaSetConfig::validate() const {
if (!_connectionString.isValid()) {
return Status(ErrorCodes::BadValue,
- "ReplicaSetConfig represented an invalid replica set ConnectionString");
+ "ReplSetConfig represented an invalid replica set ConnectionString");
}
return Status::OK();
}
-Status ReplicaSetConfig::checkIfWriteConcernCanBeSatisfied(
+Status ReplSetConfig::checkIfWriteConcernCanBeSatisfied(
const WriteConcernOptions& writeConcern) const {
if (!writeConcern.wMode.empty() && writeConcern.wMode != WriteConcernOptions::kMajority) {
- StatusWith<ReplicaSetTagPattern> tagPatternStatus = findCustomWriteMode(writeConcern.wMode);
+ StatusWith<ReplSetTagPattern> tagPatternStatus = findCustomWriteMode(writeConcern.wMode);
if (!tagPatternStatus.isOK()) {
return tagPatternStatus.getStatus();
}
- ReplicaSetTagMatch matcher(tagPatternStatus.getValue());
+ ReplSetTagMatch matcher(tagPatternStatus.getValue());
for (size_t j = 0; j < _members.size(); ++j) {
const MemberConfig& memberConfig = _members[j];
for (MemberConfig::TagIterator it = memberConfig.tagsBegin();
@@ -615,12 +615,12 @@ Status ReplicaSetConfig::checkIfWriteConcernCanBeSatisfied(
}
}
-const MemberConfig& ReplicaSetConfig::getMemberAt(size_t i) const {
+const MemberConfig& ReplSetConfig::getMemberAt(size_t i) const {
invariant(i < _members.size());
return _members[i];
}
-const MemberConfig* ReplicaSetConfig::findMemberByID(int id) const {
+const MemberConfig* ReplSetConfig::findMemberByID(int id) const {
for (std::vector<MemberConfig>::const_iterator it = _members.begin(); it != _members.end();
++it) {
if (it->getId() == id) {
@@ -630,7 +630,7 @@ const MemberConfig* ReplicaSetConfig::findMemberByID(int id) const {
return NULL;
}
-const int ReplicaSetConfig::findMemberIndexByHostAndPort(const HostAndPort& hap) const {
+const int ReplSetConfig::findMemberIndexByHostAndPort(const HostAndPort& hap) const {
int x = 0;
for (std::vector<MemberConfig>::const_iterator it = _members.begin(); it != _members.end();
++it) {
@@ -642,7 +642,7 @@ const int ReplicaSetConfig::findMemberIndexByHostAndPort(const HostAndPort& hap)
return -1;
}
-const int ReplicaSetConfig::findMemberIndexByConfigId(long long configId) const {
+const int ReplSetConfig::findMemberIndexByConfigId(long long configId) const {
int x = 0;
for (const auto& member : _members) {
if (member.getId() == configId) {
@@ -653,39 +653,38 @@ const int ReplicaSetConfig::findMemberIndexByConfigId(long long configId) const
return -1;
}
-const MemberConfig* ReplicaSetConfig::findMemberByHostAndPort(const HostAndPort& hap) const {
+const MemberConfig* ReplSetConfig::findMemberByHostAndPort(const HostAndPort& hap) const {
int idx = findMemberIndexByHostAndPort(hap);
return idx != -1 ? &getMemberAt(idx) : NULL;
}
-Milliseconds ReplicaSetConfig::getHeartbeatInterval() const {
+Milliseconds ReplSetConfig::getHeartbeatInterval() const {
return _heartbeatInterval;
}
-bool ReplicaSetConfig::isLocalHostAllowed() const {
- // It is sufficient to check any one member's hostname, since in ReplicaSetConfig::validate,
+bool ReplSetConfig::isLocalHostAllowed() const {
+ // It is sufficient to check any one member's hostname, since in ReplSetConfig::validate,
// it's ensured that either all members have hostname localhost or none do.
return _members.begin()->getHostAndPort().isLocalHost();
}
-ReplicaSetTag ReplicaSetConfig::findTag(StringData key, StringData value) const {
+ReplSetTag ReplSetConfig::findTag(StringData key, StringData value) const {
return _tagConfig.findTag(key, value);
}
-StatusWith<ReplicaSetTagPattern> ReplicaSetConfig::findCustomWriteMode(
- StringData patternName) const {
- const StringMap<ReplicaSetTagPattern>::const_iterator iter =
+StatusWith<ReplSetTagPattern> ReplSetConfig::findCustomWriteMode(StringData patternName) const {
+ const StringMap<ReplSetTagPattern>::const_iterator iter =
_customWriteConcernModes.find(patternName);
if (iter == _customWriteConcernModes.end()) {
- return StatusWith<ReplicaSetTagPattern>(
+ return StatusWith<ReplSetTagPattern>(
ErrorCodes::UnknownReplWriteConcern,
str::stream() << "No write concern mode named '" << escape(patternName.toString())
<< "' found in replica set configuration");
}
- return StatusWith<ReplicaSetTagPattern>(iter->second);
+ return StatusWith<ReplSetTagPattern>(iter->second);
}
-void ReplicaSetConfig::_calculateMajorities() {
+void ReplSetConfig::_calculateMajorities() {
const int voters = std::count_if(_members.begin(),
_members.end(),
stdx::bind(&MemberConfig::isVoter, stdx::placeholders::_1));
@@ -698,10 +697,10 @@ void ReplicaSetConfig::_calculateMajorities() {
_writeMajority = std::min(_majorityVoteCount, voters - arbiters);
}
-void ReplicaSetConfig::_addInternalWriteConcernModes() {
+void ReplSetConfig::_addInternalWriteConcernModes() {
// $majority: the majority of voting nodes or all non-arbiter voting nodes if
// the majority of voting nodes are arbiters.
- ReplicaSetTagPattern pattern = _tagConfig.makePattern();
+ ReplSetTagPattern pattern = _tagConfig.makePattern();
Status status = _tagConfig.addTagCountConstraintToPattern(
&pattern, MemberConfig::kInternalVoterTagName, _writeMajority);
@@ -727,7 +726,7 @@ void ReplicaSetConfig::_addInternalWriteConcernModes() {
}
}
-void ReplicaSetConfig::_initializeConnectionString() {
+void ReplSetConfig::_initializeConnectionString() {
std::vector<HostAndPort> visibleMembers;
for (const auto& member : _members) {
if (!member.isHidden() && !member.isArbiter()) {
@@ -744,7 +743,7 @@ void ReplicaSetConfig::_initializeConnectionString() {
}
}
-BSONObj ReplicaSetConfig::toBSON() const {
+BSONObj ReplSetConfig::toBSON() const {
BSONObjBuilder configBuilder;
configBuilder.append(kIdFieldName, _replSetName);
configBuilder.appendIntOrLL(kVersionFieldName, _version);
@@ -754,12 +753,12 @@ BSONObj ReplicaSetConfig::toBSON() const {
}
// Only include writeConcernMajorityJournalDefault if it is not the default version for this
- // ProtocolVersion to prevent breaking cross version-3.2.1 compatibilty of ReplicaSetConfigs.
+ // ProtocolVersion to prevent breaking cross version-3.2.1 compatibilty of ReplSetConfigs.
if (_protocolVersion > 0) {
configBuilder.append(kProtocolVersionFieldName, _protocolVersion);
// Only include writeConcernMajorityJournalDefault if it is not the default version for this
// ProtocolVersion to prevent breaking cross version-3.2.1 compatibilty of
- // ReplicaSetConfigs.
+ // ReplSetConfigs.
if (!_writeConcernMajorityJournalDefault) {
configBuilder.append(kWriteConcernMajorityJournalDefaultFieldName,
_writeConcernMajorityJournalDefault);
@@ -788,7 +787,7 @@ BSONObj ReplicaSetConfig::toBSON() const {
BSONObjBuilder gleModes(settingsBuilder.subobjStart(kGetLastErrorModesFieldName));
- for (StringMap<ReplicaSetTagPattern>::const_iterator mode = _customWriteConcernModes.begin();
+ for (StringMap<ReplSetTagPattern>::const_iterator mode = _customWriteConcernModes.begin();
mode != _customWriteConcernModes.end();
++mode) {
if (mode->first[0] == '$') {
@@ -796,10 +795,10 @@ BSONObj ReplicaSetConfig::toBSON() const {
continue;
}
BSONObjBuilder modeBuilder(gleModes.subobjStart(mode->first));
- for (ReplicaSetTagPattern::ConstraintIterator itr = mode->second.constraintsBegin();
+ for (ReplSetTagPattern::ConstraintIterator itr = mode->second.constraintsBegin();
itr != mode->second.constraintsEnd();
itr++) {
- modeBuilder.append(_tagConfig.getTagKey(ReplicaSetTag(itr->getKeyIndex(), 0)),
+ modeBuilder.append(_tagConfig.getTagKey(ReplSetTag(itr->getKeyIndex(), 0)),
itr->getMinCount());
}
modeBuilder.done();
@@ -816,9 +815,9 @@ BSONObj ReplicaSetConfig::toBSON() const {
return configBuilder.obj();
}
-std::vector<std::string> ReplicaSetConfig::getWriteConcernNames() const {
+std::vector<std::string> ReplSetConfig::getWriteConcernNames() const {
std::vector<std::string> names;
- for (StringMap<ReplicaSetTagPattern>::const_iterator mode = _customWriteConcernModes.begin();
+ for (StringMap<ReplSetTagPattern>::const_iterator mode = _customWriteConcernModes.begin();
mode != _customWriteConcernModes.end();
++mode) {
names.push_back(mode->first);
@@ -826,13 +825,13 @@ std::vector<std::string> ReplicaSetConfig::getWriteConcernNames() const {
return names;
}
-Milliseconds ReplicaSetConfig::getPriorityTakeoverDelay(int memberIdx) const {
+Milliseconds ReplSetConfig::getPriorityTakeoverDelay(int memberIdx) const {
auto member = getMemberAt(memberIdx);
int priorityRank = _calculatePriorityRank(member.getPriority());
return (priorityRank + 1) * getElectionTimeoutPeriod();
}
-int ReplicaSetConfig::_calculatePriorityRank(double priority) const {
+int ReplSetConfig::_calculatePriorityRank(double priority) const {
int count = 0;
for (MemberIterator mem = membersBegin(); mem != membersEnd(); mem++) {
if (mem->getPriority() > priority) {
diff --git a/src/mongo/db/repl/replica_set_config.h b/src/mongo/db/repl/repl_set_config.h
index 0586342df92..e44e51b12a7 100644
--- a/src/mongo/db/repl/replica_set_config.h
+++ b/src/mongo/db/repl/repl_set_config.h
@@ -35,7 +35,7 @@
#include "mongo/base/status_with.h"
#include "mongo/client/connection_string.h"
#include "mongo/db/repl/member_config.h"
-#include "mongo/db/repl/replica_set_tag.h"
+#include "mongo/db/repl/repl_set_tag.h"
#include "mongo/db/write_concern_options.h"
#include "mongo/util/string_map.h"
#include "mongo/util/time_support.h"
@@ -49,7 +49,7 @@ namespace repl {
/**
* Representation of the configuration information about a particular replica set.
*/
-class ReplicaSetConfig {
+class ReplSetConfig {
public:
typedef std::vector<MemberConfig>::const_iterator MemberIterator;
@@ -67,7 +67,7 @@ public:
static const bool kDefaultChainingAllowed;
/**
- * Initializes this ReplicaSetConfig from the contents of "cfg".
+ * Initializes this ReplSetConfig from the contents of "cfg".
* The default protocol version is 0 to keep backward-compatibility.
* If usePV1ByDefault is true, the protocol version will be 1 when it's not specified in "cfg".
* Sets _replicaSetId to "defaultReplicaSetId" if a replica set ID is not specified in "cfg".
@@ -137,14 +137,14 @@ public:
}
/**
- * Gets a begin iterator over the MemberConfigs stored in this ReplicaSetConfig.
+ * Gets a begin iterator over the MemberConfigs stored in this ReplSetConfig.
*/
MemberIterator membersBegin() const {
return _members.begin();
}
/**
- * Gets an end iterator over the MemberConfigs stored in this ReplicaSetConfig.
+ * Gets an end iterator over the MemberConfigs stored in this ReplSetConfig.
*/
MemberIterator membersEnd() const {
return _members.end();
@@ -267,24 +267,24 @@ public:
}
/**
- * Returns a ReplicaSetTag with the given "key" and "value", or an invalid
+ * Returns a ReplSetTag with the given "key" and "value", or an invalid
* tag if the configuration describes no such tag.
*/
- ReplicaSetTag findTag(StringData key, StringData value) const;
+ ReplSetTag findTag(StringData key, StringData value) const;
/**
* Returns the pattern corresponding to "patternName" in this configuration.
* If "patternName" is not a valid pattern in this configuration, returns
* ErrorCodes::NoSuchKey.
*/
- StatusWith<ReplicaSetTagPattern> findCustomWriteMode(StringData patternName) const;
+ StatusWith<ReplSetTagPattern> findCustomWriteMode(StringData patternName) const;
/**
* Returns the "tags configuration" for this replicaset.
*
* NOTE(schwerin): Not clear if this should be used other than for reporting/debugging.
*/
- const ReplicaSetTagConfig& getTagConfig() const {
+ const ReplSetTagConfig& getTagConfig() const {
return _tagConfig;
}
@@ -388,8 +388,8 @@ private:
int _majorityVoteCount = 0;
int _writeMajority = 0;
int _totalVotingMembers = 0;
- ReplicaSetTagConfig _tagConfig;
- StringMap<ReplicaSetTagPattern> _customWriteConcernModes;
+ ReplSetTagConfig _tagConfig;
+ StringMap<ReplSetTagPattern> _customWriteConcernModes;
long long _protocolVersion = 0;
bool _configServer = false;
OID _replicaSetId;
diff --git a/src/mongo/db/repl/replica_set_config_checks.cpp b/src/mongo/db/repl/repl_set_config_checks.cpp
index 581382777d8..4e5125a86cf 100644
--- a/src/mongo/db/repl/replica_set_config_checks.cpp
+++ b/src/mongo/db/repl/repl_set_config_checks.cpp
@@ -28,11 +28,11 @@
#include "mongo/platform/basic.h"
-#include "mongo/db/repl/replica_set_config_checks.h"
+#include "mongo/db/repl/repl_set_config_checks.h"
#include <iterator>
-#include "mongo/db/repl/replica_set_config.h"
+#include "mongo/db/repl/repl_set_config.h"
#include "mongo/db/repl/replication_coordinator_external_state.h"
#include "mongo/db/service_context.h"
#include "mongo/util/mongoutils/str.h"
@@ -49,10 +49,10 @@ namespace {
* "newConfig".
*/
StatusWith<int> findSelfInConfig(ReplicationCoordinatorExternalState* externalState,
- const ReplicaSetConfig& newConfig,
+ const ReplSetConfig& newConfig,
ServiceContext* ctx) {
- std::vector<ReplicaSetConfig::MemberIterator> meConfigs;
- for (ReplicaSetConfig::MemberIterator iter = newConfig.membersBegin();
+ std::vector<ReplSetConfig::MemberIterator> meConfigs;
+ for (ReplSetConfig::MemberIterator iter = newConfig.membersBegin();
iter != newConfig.membersEnd();
++iter) {
if (externalState->isSelf(iter->getHostAndPort(), ctx)) {
@@ -89,7 +89,7 @@ StatusWith<int> findSelfInConfig(ReplicationCoordinatorExternalState* externalSt
* Checks if the node with the given config index is electable, returning a useful
* status message if not.
*/
-Status checkElectable(const ReplicaSetConfig& newConfig, int configIndex) {
+Status checkElectable(const ReplSetConfig& newConfig, int configIndex) {
const MemberConfig& myConfig = newConfig.getMemberAt(configIndex);
if (!myConfig.isElectable()) {
return Status(ErrorCodes::NodeNotElectable,
@@ -110,7 +110,7 @@ Status checkElectable(const ReplicaSetConfig& newConfig, int configIndex) {
* reconfig or initiate commands.
*/
StatusWith<int> findSelfInConfigIfElectable(ReplicationCoordinatorExternalState* externalState,
- const ReplicaSetConfig& newConfig,
+ const ReplSetConfig& newConfig,
ServiceContext* ctx) {
StatusWith<int> result = findSelfInConfig(externalState, newConfig, ctx);
if (result.isOK()) {
@@ -136,8 +136,8 @@ StatusWith<int> findSelfInConfigIfElectable(ReplicationCoordinatorExternalState*
* require knowledge of which node is executing the configuration are out of scope
* for this function.
*/
-Status validateOldAndNewConfigsCompatible(const ReplicaSetConfig& oldConfig,
- const ReplicaSetConfig& newConfig) {
+Status validateOldAndNewConfigsCompatible(const ReplSetConfig& oldConfig,
+ const ReplSetConfig& newConfig) {
invariant(newConfig.isInitialized());
invariant(oldConfig.isInitialized());
@@ -172,8 +172,7 @@ Status validateOldAndNewConfigsCompatible(const ReplicaSetConfig& oldConfig,
if (oldConfig.isConfigServer() && !newConfig.isConfigServer()) {
return Status(ErrorCodes::NewReplicaSetConfigurationIncompatible,
- str::stream() << "Cannot remove \""
- << ReplicaSetConfig::kConfigServerFieldName
+ str::stream() << "Cannot remove \"" << ReplSetConfig::kConfigServerFieldName
<< "\" from replica set configuration on reconfig");
}
@@ -185,10 +184,10 @@ Status validateOldAndNewConfigsCompatible(const ReplicaSetConfig& oldConfig,
// Also, one may not use reconfig to change the value of the buildIndexes or
// arbiterOnly flags.
//
- for (ReplicaSetConfig::MemberIterator mNew = newConfig.membersBegin();
+ for (ReplSetConfig::MemberIterator mNew = newConfig.membersBegin();
mNew != newConfig.membersEnd();
++mNew) {
- for (ReplicaSetConfig::MemberIterator mOld = oldConfig.membersBegin();
+ for (ReplSetConfig::MemberIterator mOld = oldConfig.membersBegin();
mOld != oldConfig.membersEnd();
++mOld) {
const bool idsEqual = mOld->getId() == mNew->getId();
@@ -239,8 +238,8 @@ Status validateOldAndNewConfigsCompatible(const ReplicaSetConfig& oldConfig,
} // namespace
StatusWith<int> validateConfigForStartUp(ReplicationCoordinatorExternalState* externalState,
- const ReplicaSetConfig& oldConfig,
- const ReplicaSetConfig& newConfig,
+ const ReplSetConfig& oldConfig,
+ const ReplSetConfig& newConfig,
ServiceContext* ctx) {
Status status = newConfig.validate();
if (!status.isOK()) {
@@ -256,7 +255,7 @@ StatusWith<int> validateConfigForStartUp(ReplicationCoordinatorExternalState* ex
}
StatusWith<int> validateConfigForInitiate(ReplicationCoordinatorExternalState* externalState,
- const ReplicaSetConfig& newConfig,
+ const ReplSetConfig& newConfig,
ServiceContext* ctx) {
Status status = newConfig.validate();
if (!status.isOK()) {
@@ -272,8 +271,8 @@ StatusWith<int> validateConfigForInitiate(ReplicationCoordinatorExternalState* e
}
StatusWith<int> validateConfigForReconfig(ReplicationCoordinatorExternalState* externalState,
- const ReplicaSetConfig& oldConfig,
- const ReplicaSetConfig& newConfig,
+ const ReplSetConfig& oldConfig,
+ const ReplSetConfig& newConfig,
ServiceContext* ctx,
bool force) {
Status status = newConfig.validate();
@@ -295,7 +294,7 @@ StatusWith<int> validateConfigForReconfig(ReplicationCoordinatorExternalState* e
StatusWith<int> validateConfigForHeartbeatReconfig(
ReplicationCoordinatorExternalState* externalState,
- const ReplicaSetConfig& newConfig,
+ const ReplSetConfig& newConfig,
ServiceContext* ctx) {
Status status = newConfig.validate();
if (!status.isOK()) {
diff --git a/src/mongo/db/repl/replica_set_config_checks.h b/src/mongo/db/repl/repl_set_config_checks.h
index 3c73dd044c3..23016355061 100644
--- a/src/mongo/db/repl/replica_set_config_checks.h
+++ b/src/mongo/db/repl/repl_set_config_checks.h
@@ -37,7 +37,7 @@ class ServiceContext;
namespace repl {
class ReplicationCoordinatorExternalState;
-class ReplicaSetConfig;
+class ReplSetConfig;
/**
* Validates that "newConfig" is a legal configuration that the current
@@ -50,8 +50,8 @@ class ReplicaSetConfig;
* successor configuration.
*/
StatusWith<int> validateConfigForStartUp(ReplicationCoordinatorExternalState* externalState,
- const ReplicaSetConfig& oldConfig,
- const ReplicaSetConfig& newConfig,
+ const ReplSetConfig& oldConfig,
+ const ReplSetConfig& newConfig,
ServiceContext* ctx);
/**
@@ -62,7 +62,7 @@ StatusWith<int> validateConfigForStartUp(ReplicationCoordinatorExternalState* ex
* on success, and an indicative error on failure.
*/
StatusWith<int> validateConfigForInitiate(ReplicationCoordinatorExternalState* externalState,
- const ReplicaSetConfig& newConfig,
+ const ReplSetConfig& newConfig,
ServiceContext* ctx);
/**
@@ -76,8 +76,8 @@ StatusWith<int> validateConfigForInitiate(ReplicationCoordinatorExternalState* e
* on success, and an indicative error on failure.
*/
StatusWith<int> validateConfigForReconfig(ReplicationCoordinatorExternalState* externalState,
- const ReplicaSetConfig& oldConfig,
- const ReplicaSetConfig& newConfig,
+ const ReplSetConfig& oldConfig,
+ const ReplSetConfig& newConfig,
ServiceContext* ctx,
bool force);
@@ -91,7 +91,7 @@ StatusWith<int> validateConfigForReconfig(ReplicationCoordinatorExternalState* e
*/
StatusWith<int> validateConfigForHeartbeatReconfig(
ReplicationCoordinatorExternalState* externalState,
- const ReplicaSetConfig& newConfig,
+ const ReplSetConfig& newConfig,
ServiceContext* ctx);
} // namespace repl
} // namespace mongo
diff --git a/src/mongo/db/repl/replica_set_config_checks_test.cpp b/src/mongo/db/repl/repl_set_config_checks_test.cpp
index 8036416499a..082b44364c2 100644
--- a/src/mongo/db/repl/replica_set_config_checks_test.cpp
+++ b/src/mongo/db/repl/repl_set_config_checks_test.cpp
@@ -30,8 +30,8 @@
#include "mongo/base/status.h"
#include "mongo/db/jsobj.h"
-#include "mongo/db/repl/replica_set_config.h"
-#include "mongo/db/repl/replica_set_config_checks.h"
+#include "mongo/db/repl/repl_set_config.h"
+#include "mongo/db/repl/repl_set_config_checks.h"
#include "mongo/db/repl/replication_coordinator_external_state.h"
#include "mongo/db/repl/replication_coordinator_external_state_mock.h"
#include "mongo/db/server_options.h"
@@ -46,7 +46,7 @@ TEST(ValidateConfigForInitiate, VersionMustBe1) {
ReplicationCoordinatorExternalStateMock rses;
rses.addSelf(HostAndPort("h1"));
- ReplicaSetConfig config;
+ ReplSetConfig config;
ASSERT_OK(config.initializeForInitiate(BSON("_id"
<< "rs0"
<< "version"
@@ -59,7 +59,7 @@ TEST(ValidateConfigForInitiate, VersionMustBe1) {
}
TEST(ValidateConfigForInitiate, MustFindSelf) {
- ReplicaSetConfig config;
+ ReplSetConfig config;
ASSERT_OK(config.initializeForInitiate(BSON("_id"
<< "rs0"
<< "version"
@@ -92,7 +92,7 @@ TEST(ValidateConfigForInitiate, MustFindSelf) {
}
TEST(ValidateConfigForInitiate, SelfMustBeElectable) {
- ReplicaSetConfig config;
+ ReplSetConfig config;
ASSERT_OK(config.initializeForInitiate(BSON("_id"
<< "rs0"
<< "version"
@@ -119,8 +119,8 @@ TEST(ValidateConfigForReconfig, NewConfigVersionNumberMustBeHigherThanOld) {
ReplicationCoordinatorExternalStateMock externalState;
externalState.addSelf(HostAndPort("h1"));
- ReplicaSetConfig oldConfig;
- ReplicaSetConfig newConfig;
+ ReplSetConfig oldConfig;
+ ReplSetConfig newConfig;
// Two configurations, identical except for version.
ASSERT_OK(oldConfig.initialize(BSON("_id"
@@ -183,8 +183,8 @@ TEST(ValidateConfigForReconfig, NewConfigMustNotChangeSetName) {
ReplicationCoordinatorExternalStateMock externalState;
externalState.addSelf(HostAndPort("h1"));
- ReplicaSetConfig oldConfig;
- ReplicaSetConfig newConfig;
+ ReplSetConfig oldConfig;
+ ReplSetConfig newConfig;
// Two configurations, compatible except for set name.
ASSERT_OK(oldConfig.initialize(BSON("_id"
@@ -228,8 +228,8 @@ TEST(ValidateConfigForReconfig, NewConfigMustNotChangeSetId) {
ReplicationCoordinatorExternalStateMock externalState;
externalState.addSelf(HostAndPort("h1"));
- ReplicaSetConfig oldConfig;
- ReplicaSetConfig newConfig;
+ ReplSetConfig oldConfig;
+ ReplSetConfig newConfig;
// Two configurations, compatible except for set ID.
ASSERT_OK(oldConfig.initialize(BSON("_id"
@@ -279,9 +279,9 @@ TEST(ValidateConfigForReconfig, NewConfigMustNotFlipBuildIndexesFlag) {
ReplicationCoordinatorExternalStateMock externalState;
externalState.addSelf(HostAndPort("h1"));
- ReplicaSetConfig oldConfig;
- ReplicaSetConfig newConfig;
- ReplicaSetConfig oldConfigRefresh;
+ ReplSetConfig oldConfig;
+ ReplSetConfig newConfig;
+ ReplSetConfig oldConfigRefresh;
// Three configurations, two compatible except that h2 flips the buildIndex flag.
// The third, compatible with the first.
@@ -355,9 +355,9 @@ TEST(ValidateConfigForReconfig, NewConfigMustNotFlipArbiterFlag) {
ReplicationCoordinatorExternalStateMock externalState;
externalState.addSelf(HostAndPort("h1"));
- ReplicaSetConfig oldConfig;
- ReplicaSetConfig newConfig;
- ReplicaSetConfig oldConfigRefresh;
+ ReplSetConfig oldConfig;
+ ReplSetConfig newConfig;
+ ReplSetConfig oldConfigRefresh;
// Three configurations, two compatible except that h2 flips the arbiterOnly flag.
// The third, compatible with the first.
@@ -428,10 +428,10 @@ TEST(ValidateConfigForReconfig, HostAndIdRemappingRestricted) {
ReplicationCoordinatorExternalStateMock externalState;
externalState.addSelf(HostAndPort("h1"));
- ReplicaSetConfig oldConfig;
- ReplicaSetConfig legalNewConfigWithNewHostAndId;
- ReplicaSetConfig illegalNewConfigReusingHost;
- ReplicaSetConfig illegalNewConfigReusingId;
+ ReplSetConfig oldConfig;
+ ReplSetConfig legalNewConfigWithNewHostAndId;
+ ReplSetConfig illegalNewConfigReusingHost;
+ ReplSetConfig illegalNewConfigReusingId;
ASSERT_OK(oldConfig.initialize(BSON("_id"
<< "rs0"
@@ -524,7 +524,7 @@ TEST(ValidateConfigForReconfig, HostAndIdRemappingRestricted) {
TEST(ValidateConfigForReconfig, MustFindSelf) {
// Old and new config are same except for version change; this is just testing that we can
// find ourself in the new config.
- ReplicaSetConfig oldConfig;
+ ReplSetConfig oldConfig;
ASSERT_OK(oldConfig.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -537,7 +537,7 @@ TEST(ValidateConfigForReconfig, MustFindSelf) {
<< BSON("_id" << 3 << "host"
<< "h3")))));
- ReplicaSetConfig newConfig;
+ ReplSetConfig newConfig;
ASSERT_OK(newConfig.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -591,7 +591,7 @@ TEST(ValidateConfigForReconfig, MustFindSelf) {
TEST(ValidateConfigForReconfig, SelfMustEndElectable) {
// Old and new config are same except for version change and the electability of one node;
// this is just testing that we must be electable in the new config.
- ReplicaSetConfig oldConfig;
+ ReplSetConfig oldConfig;
ASSERT_OK(oldConfig.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -604,7 +604,7 @@ TEST(ValidateConfigForReconfig, SelfMustEndElectable) {
<< BSON("_id" << 3 << "host"
<< "h3")))));
- ReplicaSetConfig newConfig;
+ ReplSetConfig newConfig;
ASSERT_OK(newConfig.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -636,7 +636,7 @@ TEST(ValidateConfigForInitiate, NewConfigInvalid) {
// The new config is not valid due to a duplicate _id value. This tests that if the new
// config is invalid, validateConfigForInitiate will return a status indicating what is
// wrong with the new config.
- ReplicaSetConfig newConfig;
+ ReplSetConfig newConfig;
ASSERT_OK(newConfig.initializeForInitiate(BSON("_id"
<< "rs0"
<< "version"
@@ -659,7 +659,7 @@ TEST(ValidateConfigForReconfig, NewConfigInvalid) {
// The new config is not valid due to a duplicate _id value. This tests that if the new
// config is invalid, validateConfigForReconfig will return a status indicating what is
// wrong with the new config.
- ReplicaSetConfig oldConfig;
+ ReplSetConfig oldConfig;
ASSERT_OK(oldConfig.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -668,7 +668,7 @@ TEST(ValidateConfigForReconfig, NewConfigInvalid) {
<< BSON_ARRAY(BSON("_id" << 0 << "host"
<< "h2")))));
- ReplicaSetConfig newConfig;
+ ReplSetConfig newConfig;
ASSERT_OK(newConfig.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -698,7 +698,7 @@ TEST(ValidateConfigForStartUp, NewConfigInvalid) {
// The new config is not valid due to a duplicate _id value. This tests that if the new
// config is invalid, validateConfigForStartUp will return a status indicating what is wrong
// with the new config.
- ReplicaSetConfig oldConfig;
+ ReplSetConfig oldConfig;
ASSERT_OK(oldConfig.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -707,7 +707,7 @@ TEST(ValidateConfigForStartUp, NewConfigInvalid) {
<< BSON_ARRAY(BSON("_id" << 0 << "host"
<< "h2")))));
- ReplicaSetConfig newConfig;
+ ReplSetConfig newConfig;
ASSERT_OK(newConfig.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -730,7 +730,7 @@ TEST(ValidateConfigForStartUp, OldAndNewConfigIncompatible) {
// The new config is not compatible with the old config due to a member changing _ids. This
// tests that validateConfigForStartUp will return a status indicating the incompatiblilty
// between the old and new config.
- ReplicaSetConfig oldConfig;
+ ReplSetConfig oldConfig;
ASSERT_OK(oldConfig.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -742,7 +742,7 @@ TEST(ValidateConfigForStartUp, OldAndNewConfigIncompatible) {
<< "h3")))));
- ReplicaSetConfig newConfig;
+ ReplSetConfig newConfig;
ASSERT_OK(newConfig.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -765,7 +765,7 @@ TEST(ValidateConfigForStartUp, OldAndNewConfigCompatible) {
// The new config is compatible with the old config. This tests that
// validateConfigForStartUp will return a Status::OK() indicating the validity of this
// config change.
- ReplicaSetConfig oldConfig;
+ ReplSetConfig oldConfig;
ASSERT_OK(oldConfig.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -777,7 +777,7 @@ TEST(ValidateConfigForStartUp, OldAndNewConfigCompatible) {
<< "h3")))));
- ReplicaSetConfig newConfig;
+ ReplSetConfig newConfig;
ASSERT_OK(newConfig.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -801,7 +801,7 @@ TEST(ValidateConfigForHeartbeatReconfig, NewConfigInvalid) {
// The new config is not valid due to a duplicate _id value. This tests that if the new
// config is invalid, validateConfigForHeartbeatReconfig will return a status indicating
// what is wrong with the new config.
- ReplicaSetConfig newConfig;
+ ReplSetConfig newConfig;
ASSERT_OK(newConfig.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -823,7 +823,7 @@ TEST(ValidateConfigForHeartbeatReconfig, NewConfigInvalid) {
TEST(ValidateConfigForHeartbeatReconfig, NewConfigValid) {
// The new config is valid. This tests that validateConfigForHeartbeatReconfig will return
// a Status::OK() indicating the validity of this config change.
- ReplicaSetConfig newConfig;
+ ReplSetConfig newConfig;
ASSERT_OK(newConfig.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -844,7 +844,7 @@ TEST(ValidateConfigForHeartbeatReconfig, NewConfigValid) {
TEST(ValidateForReconfig, ForceStillNeedsValidConfig) {
// The new config is invalid due to two nodes with the same _id value. This tests that
// ValidateForReconfig fails with an invalid config, even if force is true.
- ReplicaSetConfig oldConfig;
+ ReplSetConfig oldConfig;
ASSERT_OK(oldConfig.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -856,7 +856,7 @@ TEST(ValidateForReconfig, ForceStillNeedsValidConfig) {
<< "h3")))));
- ReplicaSetConfig newConfig;
+ ReplSetConfig newConfig;
ASSERT_OK(newConfig.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -879,7 +879,7 @@ TEST(ValidateForReconfig, ForceStillNeedsValidConfig) {
TEST(ValidateForReconfig, ForceStillNeedsSelfPresent) {
// The new config does not contain self. This tests that ValidateForReconfig fails
// if the member receiving it is absent from the config, even if force is true.
- ReplicaSetConfig oldConfig;
+ ReplSetConfig oldConfig;
ASSERT_OK(oldConfig.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -891,7 +891,7 @@ TEST(ValidateForReconfig, ForceStillNeedsSelfPresent) {
<< "h3")))));
- ReplicaSetConfig newConfig;
+ ReplSetConfig newConfig;
ASSERT_OK(newConfig.initialize(BSON("_id"
<< "rs0"
<< "version"
diff --git a/src/mongo/db/repl/replica_set_config_test.cpp b/src/mongo/db/repl/repl_set_config_test.cpp
index 6e5bb69b40b..8f582195b51 100644
--- a/src/mongo/db/repl/replica_set_config_test.cpp
+++ b/src/mongo/db/repl/repl_set_config_test.cpp
@@ -32,7 +32,7 @@
#include "mongo/bson/mutable/document.h"
#include "mongo/bson/mutable/element.h"
#include "mongo/db/jsobj.h"
-#include "mongo/db/repl/replica_set_config.h"
+#include "mongo/db/repl/repl_set_config.h"
#include "mongo/db/server_options.h"
#include "mongo/unittest/unittest.h"
#include "mongo/util/scopeguard.h"
@@ -42,7 +42,7 @@ namespace repl {
namespace {
// Creates a bson document reprsenting a replica set config doc with the given members, and votes
-BSONObj createConfigDoc(int members, int voters = ReplicaSetConfig::kMaxVotingMembers) {
+BSONObj createConfigDoc(int members, int voters = ReplSetConfig::kMaxVotingMembers) {
str::stream configJson;
configJson << "{_id:'rs0', version:1, members:[";
for (int i = 0; i < members; ++i) {
@@ -58,8 +58,8 @@ BSONObj createConfigDoc(int members, int voters = ReplicaSetConfig::kMaxVotingMe
return fromjson(configJson);
}
-TEST(ReplicaSetConfig, ParseMinimalConfigAndCheckDefaults) {
- ReplicaSetConfig config;
+TEST(ReplSetConfig, ParseMinimalConfigAndCheckDefaults) {
+ ReplSetConfig config;
ASSERT_OK(config.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -74,11 +74,10 @@ TEST(ReplicaSetConfig, ParseMinimalConfigAndCheckDefaults) {
ASSERT_EQUALS(0, config.membersBegin()->getId());
ASSERT_EQUALS(1, config.getDefaultWriteConcern().wNumNodes);
ASSERT_EQUALS("", config.getDefaultWriteConcern().wMode);
- ASSERT_EQUALS(ReplicaSetConfig::kDefaultHeartbeatInterval, config.getHeartbeatInterval());
- ASSERT_EQUALS(ReplicaSetConfig::kDefaultHeartbeatTimeoutPeriod,
+ ASSERT_EQUALS(ReplSetConfig::kDefaultHeartbeatInterval, config.getHeartbeatInterval());
+ ASSERT_EQUALS(ReplSetConfig::kDefaultHeartbeatTimeoutPeriod,
config.getHeartbeatTimeoutPeriod());
- ASSERT_EQUALS(ReplicaSetConfig::kDefaultElectionTimeoutPeriod,
- config.getElectionTimeoutPeriod());
+ ASSERT_EQUALS(ReplSetConfig::kDefaultElectionTimeoutPeriod, config.getElectionTimeoutPeriod());
ASSERT_TRUE(config.isChainingAllowed());
ASSERT_FALSE(config.getWriteConcernMajorityShouldJournal());
ASSERT_FALSE(config.isConfigServer());
@@ -88,8 +87,8 @@ TEST(ReplicaSetConfig, ParseMinimalConfigAndCheckDefaults) {
config.getConnectionString().toString());
}
-TEST(ReplicaSetConfig, ParseLargeConfigAndCheckAccessors) {
- ReplicaSetConfig config;
+TEST(ReplSetConfig, ParseLargeConfigAndCheckAccessors) {
+ ReplSetConfig config;
ASSERT_OK(config.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -135,8 +134,8 @@ TEST(ReplicaSetConfig, ParseLargeConfigAndCheckAccessors) {
config.getConnectionString().toString());
}
-TEST(ReplicaSetConfig, GetConnectionStringFiltersHiddenNodes) {
- ReplicaSetConfig config;
+TEST(ReplSetConfig, GetConnectionStringFiltersHiddenNodes) {
+ ReplSetConfig config;
ASSERT_OK(config.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -163,8 +162,8 @@ TEST(ReplicaSetConfig, GetConnectionStringFiltersHiddenNodes) {
config.getConnectionString().toString());
}
-TEST(ReplicaSetConfig, MajorityCalculationThreeVotersNoArbiters) {
- ReplicaSetConfig config;
+TEST(ReplSetConfig, MajorityCalculationThreeVotersNoArbiters) {
+ ReplSetConfig config;
ASSERT_OK(config.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -193,8 +192,8 @@ TEST(ReplicaSetConfig, MajorityCalculationThreeVotersNoArbiters) {
ASSERT_EQUALS(2, config.getWriteMajority());
}
-TEST(ReplicaSetConfig, MajorityCalculationNearlyHalfArbiters) {
- ReplicaSetConfig config;
+TEST(ReplSetConfig, MajorityCalculationNearlyHalfArbiters) {
+ ReplSetConfig config;
ASSERT_OK(config.initialize(BSON("_id"
<< "mySet"
<< "version"
@@ -228,8 +227,8 @@ TEST(ReplicaSetConfig, MajorityCalculationNearlyHalfArbiters) {
ASSERT_EQUALS(3, config.getWriteMajority());
}
-TEST(ReplicaSetConfig, MajorityCalculationEvenNumberOfMembers) {
- ReplicaSetConfig config;
+TEST(ReplSetConfig, MajorityCalculationEvenNumberOfMembers) {
+ ReplSetConfig config;
ASSERT_OK(config.initialize(BSON("_id"
<< "mySet"
<< "version"
@@ -255,8 +254,8 @@ TEST(ReplicaSetConfig, MajorityCalculationEvenNumberOfMembers) {
ASSERT_EQUALS(3, config.getWriteMajority());
}
-TEST(ReplicaSetConfig, MajorityCalculationNearlyHalfSecondariesNoVotes) {
- ReplicaSetConfig config;
+TEST(ReplSetConfig, MajorityCalculationNearlyHalfSecondariesNoVotes) {
+ ReplSetConfig config;
ASSERT_OK(config.initialize(BSON("_id"
<< "mySet"
<< "version"
@@ -294,8 +293,8 @@ TEST(ReplicaSetConfig, MajorityCalculationNearlyHalfSecondariesNoVotes) {
ASSERT_EQUALS(2, config.getWriteMajority());
}
-TEST(ReplicaSetConfig, ParseFailsWithBadOrMissingIdField) {
- ReplicaSetConfig config;
+TEST(ReplSetConfig, ParseFailsWithBadOrMissingIdField) {
+ ReplSetConfig config;
// Replica set name must be a string.
ASSERT_EQUALS(ErrorCodes::TypeMismatch,
config.initialize(BSON("_id" << 1 << "version" << 1 << "members"
@@ -321,8 +320,8 @@ TEST(ReplicaSetConfig, ParseFailsWithBadOrMissingIdField) {
ASSERT_EQUALS(ErrorCodes::BadValue, config.validate());
}
-TEST(ReplicaSetConfig, ParseFailsWithBadOrMissingVersionField) {
- ReplicaSetConfig config;
+TEST(ReplSetConfig, ParseFailsWithBadOrMissingVersionField) {
+ ReplSetConfig config;
// Config version field must be present.
ASSERT_EQUALS(ErrorCodes::NoSuchKey,
config.initialize(BSON("_id"
@@ -365,8 +364,8 @@ TEST(ReplicaSetConfig, ParseFailsWithBadOrMissingVersionField) {
ASSERT_EQUALS(ErrorCodes::BadValue, config.validate());
}
-TEST(ReplicaSetConfig, ParseFailsWithBadMembers) {
- ReplicaSetConfig config;
+TEST(ReplSetConfig, ParseFailsWithBadMembers) {
+ ReplSetConfig config;
ASSERT_EQUALS(ErrorCodes::TypeMismatch,
config.initialize(BSON("_id"
<< "rs0"
@@ -385,8 +384,8 @@ TEST(ReplicaSetConfig, ParseFailsWithBadMembers) {
<< "localhost:12345")))));
}
-TEST(ReplicaSetConfig, ParseFailsWithLocalNonLocalHostMix) {
- ReplicaSetConfig config;
+TEST(ReplSetConfig, ParseFailsWithLocalNonLocalHostMix) {
+ ReplSetConfig config;
ASSERT_OK(config.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -399,8 +398,8 @@ TEST(ReplicaSetConfig, ParseFailsWithLocalNonLocalHostMix) {
ASSERT_EQUALS(ErrorCodes::BadValue, config.validate());
}
-TEST(ReplicaSetConfig, ParseFailsWithNoElectableNodes) {
- ReplicaSetConfig config;
+TEST(ReplSetConfig, ParseFailsWithNoElectableNodes) {
+ ReplSetConfig config;
const BSONObj configBsonNoElectableNodes = BSON("_id"
<< "rs0"
<< "version"
@@ -471,8 +470,8 @@ TEST(ReplicaSetConfig, ParseFailsWithNoElectableNodes) {
ASSERT_OK(config.validate());
}
-TEST(ReplicaSetConfig, ParseFailsWithTooFewVoters) {
- ReplicaSetConfig config;
+TEST(ReplSetConfig, ParseFailsWithTooFewVoters) {
+ ReplSetConfig config;
const BSONObj configBsonNoVoters = BSON("_id"
<< "rs0"
<< "version"
@@ -513,16 +512,16 @@ TEST(ReplicaSetConfig, ParseFailsWithTooFewVoters) {
ASSERT_OK(config.validate());
}
-TEST(ReplicaSetConfig, ParseFailsWithTooManyVoters) {
- ReplicaSetConfig config;
- ASSERT_OK(config.initialize(createConfigDoc(8, ReplicaSetConfig::kMaxVotingMembers)));
+TEST(ReplSetConfig, ParseFailsWithTooManyVoters) {
+ ReplSetConfig config;
+ ASSERT_OK(config.initialize(createConfigDoc(8, ReplSetConfig::kMaxVotingMembers)));
ASSERT_OK(config.validate());
- ASSERT_OK(config.initialize(createConfigDoc(8, ReplicaSetConfig::kMaxVotingMembers + 1)));
+ ASSERT_OK(config.initialize(createConfigDoc(8, ReplSetConfig::kMaxVotingMembers + 1)));
ASSERT_NOT_OK(config.validate());
}
-TEST(ReplicaSetConfig, ParseFailsWithDuplicateHost) {
- ReplicaSetConfig config;
+TEST(ReplSetConfig, ParseFailsWithDuplicateHost) {
+ ReplSetConfig config;
const BSONObj configBson = BSON("_id"
<< "rs0"
<< "version"
@@ -536,8 +535,8 @@ TEST(ReplicaSetConfig, ParseFailsWithDuplicateHost) {
ASSERT_EQUALS(ErrorCodes::BadValue, config.validate());
}
-TEST(ReplicaSetConfig, ParseFailsWithTooManyNodes) {
- ReplicaSetConfig config;
+TEST(ReplSetConfig, ParseFailsWithTooManyNodes) {
+ ReplSetConfig config;
namespace mmb = mutablebson;
mmb::Document configDoc;
mmb::Element configDocRoot = configDoc.root();
@@ -545,13 +544,13 @@ TEST(ReplicaSetConfig, ParseFailsWithTooManyNodes) {
ASSERT_OK(configDocRoot.appendInt("version", 1));
mmb::Element membersArray = configDoc.makeElementArray("members");
ASSERT_OK(configDocRoot.pushBack(membersArray));
- for (size_t i = 0; i < ReplicaSetConfig::kMaxMembers; ++i) {
+ for (size_t i = 0; i < ReplSetConfig::kMaxMembers; ++i) {
mmb::Element memberElement = configDoc.makeElementObject("");
ASSERT_OK(membersArray.pushBack(memberElement));
ASSERT_OK(memberElement.appendInt("_id", i));
ASSERT_OK(
memberElement.appendString("host", std::string(str::stream() << "localhost" << i + 1)));
- if (i >= ReplicaSetConfig::kMaxVotingMembers) {
+ if (i >= ReplSetConfig::kMaxVotingMembers) {
ASSERT_OK(memberElement.appendInt("votes", 0));
ASSERT_OK(memberElement.appendInt("priority", 0));
}
@@ -560,9 +559,9 @@ TEST(ReplicaSetConfig, ParseFailsWithTooManyNodes) {
mmb::Element memberElement = configDoc.makeElementObject("");
ASSERT_OK(membersArray.pushBack(memberElement));
- ASSERT_OK(memberElement.appendInt("_id", ReplicaSetConfig::kMaxMembers));
+ ASSERT_OK(memberElement.appendInt("_id", ReplSetConfig::kMaxMembers));
ASSERT_OK(memberElement.appendString(
- "host", std::string(str::stream() << "localhost" << ReplicaSetConfig::kMaxMembers + 1)));
+ "host", std::string(str::stream() << "localhost" << ReplSetConfig::kMaxMembers + 1)));
ASSERT_OK(memberElement.appendInt("votes", 0));
ASSERT_OK(memberElement.appendInt("priority", 0));
const BSONObj configBsonTooManyNodes = configDoc.getObject();
@@ -574,8 +573,8 @@ TEST(ReplicaSetConfig, ParseFailsWithTooManyNodes) {
ASSERT_EQUALS(ErrorCodes::BadValue, config.validate());
}
-TEST(ReplicaSetConfig, ParseFailsWithUnexpectedField) {
- ReplicaSetConfig config;
+TEST(ReplSetConfig, ParseFailsWithUnexpectedField) {
+ ReplSetConfig config;
Status status = config.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -585,8 +584,8 @@ TEST(ReplicaSetConfig, ParseFailsWithUnexpectedField) {
ASSERT_EQUALS(ErrorCodes::BadValue, status);
}
-TEST(ReplicaSetConfig, ParseFailsWithNonArrayMembersField) {
- ReplicaSetConfig config;
+TEST(ReplSetConfig, ParseFailsWithNonArrayMembersField) {
+ ReplSetConfig config;
Status status = config.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -596,8 +595,8 @@ TEST(ReplicaSetConfig, ParseFailsWithNonArrayMembersField) {
ASSERT_EQUALS(ErrorCodes::TypeMismatch, status);
}
-TEST(ReplicaSetConfig, ParseFailsWithNonNumericHeartbeatIntervalMillisField) {
- ReplicaSetConfig config;
+TEST(ReplSetConfig, ParseFailsWithNonNumericHeartbeatIntervalMillisField) {
+ ReplSetConfig config;
Status status = config.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -613,11 +612,11 @@ TEST(ReplicaSetConfig, ParseFailsWithNonNumericHeartbeatIntervalMillisField) {
ASSERT_FALSE(config.isInitialized());
// Uninitialized configuration should return default heartbeat interval.
- ASSERT_EQUALS(ReplicaSetConfig::kDefaultHeartbeatInterval, config.getHeartbeatInterval());
+ ASSERT_EQUALS(ReplSetConfig::kDefaultHeartbeatInterval, config.getHeartbeatInterval());
}
-TEST(ReplicaSetConfig, ParseFailsWithNonNumericElectionTimeoutMillisField) {
- ReplicaSetConfig config;
+TEST(ReplSetConfig, ParseFailsWithNonNumericElectionTimeoutMillisField) {
+ ReplSetConfig config;
Status status = config.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -631,8 +630,8 @@ TEST(ReplicaSetConfig, ParseFailsWithNonNumericElectionTimeoutMillisField) {
ASSERT_EQUALS(ErrorCodes::TypeMismatch, status);
}
-TEST(ReplicaSetConfig, ParseFailsWithNonNumericHeartbeatTimeoutSecsField) {
- ReplicaSetConfig config;
+TEST(ReplSetConfig, ParseFailsWithNonNumericHeartbeatTimeoutSecsField) {
+ ReplSetConfig config;
Status status = config.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -646,8 +645,8 @@ TEST(ReplicaSetConfig, ParseFailsWithNonNumericHeartbeatTimeoutSecsField) {
ASSERT_EQUALS(ErrorCodes::TypeMismatch, status);
}
-TEST(ReplicaSetConfig, ParseFailsWithNonBoolChainingAllowedField) {
- ReplicaSetConfig config;
+TEST(ReplSetConfig, ParseFailsWithNonBoolChainingAllowedField) {
+ ReplSetConfig config;
Status status = config.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -661,8 +660,8 @@ TEST(ReplicaSetConfig, ParseFailsWithNonBoolChainingAllowedField) {
ASSERT_EQUALS(ErrorCodes::TypeMismatch, status);
}
-TEST(ReplicaSetConfig, ParseFailsWithNonBoolConfigServerField) {
- ReplicaSetConfig config;
+TEST(ReplSetConfig, ParseFailsWithNonBoolConfigServerField) {
+ ReplSetConfig config;
Status status = config.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -675,8 +674,8 @@ TEST(ReplicaSetConfig, ParseFailsWithNonBoolConfigServerField) {
ASSERT_EQUALS(ErrorCodes::TypeMismatch, status);
}
-TEST(ReplicaSetConfig, ParseFailsWithNonObjectSettingsField) {
- ReplicaSetConfig config;
+TEST(ReplSetConfig, ParseFailsWithNonObjectSettingsField) {
+ ReplSetConfig config;
Status status = config.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -689,8 +688,8 @@ TEST(ReplicaSetConfig, ParseFailsWithNonObjectSettingsField) {
ASSERT_EQUALS(ErrorCodes::TypeMismatch, status);
}
-TEST(ReplicaSetConfig, ParseFailsWithGetLastErrorDefaultsFieldUnparseable) {
- ReplicaSetConfig config;
+TEST(ReplSetConfig, ParseFailsWithGetLastErrorDefaultsFieldUnparseable) {
+ ReplSetConfig config;
Status status = config.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -704,8 +703,8 @@ TEST(ReplicaSetConfig, ParseFailsWithGetLastErrorDefaultsFieldUnparseable) {
ASSERT_EQUALS(ErrorCodes::FailedToParse, status);
}
-TEST(ReplicaSetConfig, ParseFailsWithNonObjectGetLastErrorDefaultsField) {
- ReplicaSetConfig config;
+TEST(ReplSetConfig, ParseFailsWithNonObjectGetLastErrorDefaultsField) {
+ ReplSetConfig config;
Status status = config.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -719,8 +718,8 @@ TEST(ReplicaSetConfig, ParseFailsWithNonObjectGetLastErrorDefaultsField) {
ASSERT_EQUALS(ErrorCodes::TypeMismatch, status);
}
-TEST(ReplicaSetConfig, ParseFailsWithNonObjectGetLastErrorModesField) {
- ReplicaSetConfig config;
+TEST(ReplSetConfig, ParseFailsWithNonObjectGetLastErrorModesField) {
+ ReplSetConfig config;
Status status = config.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -734,8 +733,8 @@ TEST(ReplicaSetConfig, ParseFailsWithNonObjectGetLastErrorModesField) {
ASSERT_EQUALS(ErrorCodes::TypeMismatch, status);
}
-TEST(ReplicaSetConfig, ParseFailsWithDuplicateGetLastErrorModesField) {
- ReplicaSetConfig config;
+TEST(ReplSetConfig, ParseFailsWithDuplicateGetLastErrorModesField) {
+ ReplSetConfig config;
Status status = config.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -753,8 +752,8 @@ TEST(ReplicaSetConfig, ParseFailsWithDuplicateGetLastErrorModesField) {
ASSERT_EQUALS(ErrorCodes::DuplicateKey, status);
}
-TEST(ReplicaSetConfig, ParseFailsWithNonObjectGetLastErrorModesEntryField) {
- ReplicaSetConfig config;
+TEST(ReplSetConfig, ParseFailsWithNonObjectGetLastErrorModesEntryField) {
+ ReplSetConfig config;
Status status = config.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -770,8 +769,8 @@ TEST(ReplicaSetConfig, ParseFailsWithNonObjectGetLastErrorModesEntryField) {
ASSERT_EQUALS(ErrorCodes::TypeMismatch, status);
}
-TEST(ReplicaSetConfig, ParseFailsWithNonNumericGetLastErrorModesConstraintValue) {
- ReplicaSetConfig config;
+TEST(ReplSetConfig, ParseFailsWithNonNumericGetLastErrorModesConstraintValue) {
+ ReplSetConfig config;
Status status =
config.initialize(BSON("_id"
<< "rs0"
@@ -789,8 +788,8 @@ TEST(ReplicaSetConfig, ParseFailsWithNonNumericGetLastErrorModesConstraintValue)
ASSERT_EQUALS(ErrorCodes::TypeMismatch, status);
}
-TEST(ReplicaSetConfig, ParseFailsWithNegativeGetLastErrorModesConstraintValue) {
- ReplicaSetConfig config;
+TEST(ReplSetConfig, ParseFailsWithNegativeGetLastErrorModesConstraintValue) {
+ ReplSetConfig config;
Status status =
config.initialize(BSON("_id"
<< "rs0"
@@ -807,8 +806,8 @@ TEST(ReplicaSetConfig, ParseFailsWithNegativeGetLastErrorModesConstraintValue) {
ASSERT_EQUALS(ErrorCodes::BadValue, status);
}
-TEST(ReplicaSetConfig, ParseFailsWithNonExistentGetLastErrorModesConstraintTag) {
- ReplicaSetConfig config;
+TEST(ReplSetConfig, ParseFailsWithNonExistentGetLastErrorModesConstraintTag) {
+ ReplSetConfig config;
Status status =
config.initialize(BSON("_id"
<< "rs0"
@@ -825,8 +824,8 @@ TEST(ReplicaSetConfig, ParseFailsWithNonExistentGetLastErrorModesConstraintTag)
ASSERT_EQUALS(ErrorCodes::NoSuchKey, status);
}
-TEST(ReplicaSetConfig, ValidateFailsWithBadProtocolVersion) {
- ReplicaSetConfig config;
+TEST(ReplSetConfig, ValidateFailsWithBadProtocolVersion) {
+ ReplSetConfig config;
Status status = config.initialize(BSON("_id"
<< "rs0"
<< "protocolVersion"
@@ -844,8 +843,8 @@ TEST(ReplicaSetConfig, ValidateFailsWithBadProtocolVersion) {
ASSERT_EQUALS(ErrorCodes::BadValue, status);
}
-TEST(ReplicaSetConfig, ValidateFailsWithDuplicateMemberId) {
- ReplicaSetConfig config;
+TEST(ReplSetConfig, ValidateFailsWithDuplicateMemberId) {
+ ReplSetConfig config;
Status status = config.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -861,8 +860,8 @@ TEST(ReplicaSetConfig, ValidateFailsWithDuplicateMemberId) {
ASSERT_EQUALS(ErrorCodes::BadValue, status);
}
-TEST(ReplicaSetConfig, ValidateFailsWithInvalidMember) {
- ReplicaSetConfig config;
+TEST(ReplSetConfig, ValidateFailsWithInvalidMember) {
+ ReplSetConfig config;
Status status = config.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -878,8 +877,8 @@ TEST(ReplicaSetConfig, ValidateFailsWithInvalidMember) {
ASSERT_EQUALS(ErrorCodes::BadValue, status);
}
-TEST(ReplicaSetConfig, ChainingAllowedField) {
- ReplicaSetConfig config;
+TEST(ReplSetConfig, ChainingAllowedField) {
+ ReplSetConfig config;
ASSERT_OK(config.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -905,8 +904,8 @@ TEST(ReplicaSetConfig, ChainingAllowedField) {
ASSERT_FALSE(config.isChainingAllowed());
}
-TEST(ReplicaSetConfig, ConfigServerField) {
- ReplicaSetConfig config;
+TEST(ReplSetConfig, ConfigServerField) {
+ ReplSetConfig config;
ASSERT_OK(config.initialize(BSON("_id"
<< "rs0"
<< "protocolVersion"
@@ -920,7 +919,7 @@ TEST(ReplicaSetConfig, ConfigServerField) {
<< "localhost:12345")))));
ASSERT_TRUE(config.isConfigServer());
- ReplicaSetConfig config2;
+ ReplSetConfig config2;
ASSERT_OK(config2.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -944,10 +943,10 @@ TEST(ReplicaSetConfig, ConfigServerField) {
ASSERT_OK(config2.validate());
}
-TEST(ReplicaSetConfig, ConfigServerFieldDefaults) {
+TEST(ReplSetConfig, ConfigServerFieldDefaults) {
serverGlobalParams.clusterRole = ClusterRole::None;
- ReplicaSetConfig config;
+ ReplSetConfig config;
ASSERT_OK(config.initialize(BSON("_id"
<< "rs0"
<< "protocolVersion"
@@ -959,7 +958,7 @@ TEST(ReplicaSetConfig, ConfigServerFieldDefaults) {
<< "localhost:12345")))));
ASSERT_FALSE(config.isConfigServer());
- ReplicaSetConfig config2;
+ ReplSetConfig config2;
ASSERT_OK(config2.initializeForInitiate(BSON("_id"
<< "rs0"
<< "protocolVersion"
@@ -974,7 +973,7 @@ TEST(ReplicaSetConfig, ConfigServerFieldDefaults) {
serverGlobalParams.clusterRole = ClusterRole::ConfigServer;
ON_BLOCK_EXIT([&] { serverGlobalParams.clusterRole = ClusterRole::None; });
- ReplicaSetConfig config3;
+ ReplSetConfig config3;
ASSERT_OK(config3.initialize(BSON("_id"
<< "rs0"
<< "protocolVersion"
@@ -986,7 +985,7 @@ TEST(ReplicaSetConfig, ConfigServerFieldDefaults) {
<< "localhost:12345")))));
ASSERT_FALSE(config3.isConfigServer());
- ReplicaSetConfig config4;
+ ReplSetConfig config4;
ASSERT_OK(config4.initializeForInitiate(BSON("_id"
<< "rs0"
<< "protocolVersion"
@@ -999,8 +998,8 @@ TEST(ReplicaSetConfig, ConfigServerFieldDefaults) {
ASSERT_TRUE(config4.isConfigServer());
}
-TEST(ReplicaSetConfig, HeartbeatIntervalField) {
- ReplicaSetConfig config;
+TEST(ReplSetConfig, HeartbeatIntervalField) {
+ ReplSetConfig config;
ASSERT_OK(config.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -1025,8 +1024,8 @@ TEST(ReplicaSetConfig, HeartbeatIntervalField) {
ASSERT_EQUALS(ErrorCodes::BadValue, config.validate());
}
-TEST(ReplicaSetConfig, ElectionTimeoutField) {
- ReplicaSetConfig config;
+TEST(ReplSetConfig, ElectionTimeoutField) {
+ ReplSetConfig config;
ASSERT_OK(config.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -1052,8 +1051,8 @@ TEST(ReplicaSetConfig, ElectionTimeoutField) {
ASSERT_STRING_CONTAINS(status.reason(), "election timeout must be greater than 0");
}
-TEST(ReplicaSetConfig, HeartbeatTimeoutField) {
- ReplicaSetConfig config;
+TEST(ReplSetConfig, HeartbeatTimeoutField) {
+ ReplSetConfig config;
ASSERT_OK(config.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -1079,8 +1078,8 @@ TEST(ReplicaSetConfig, HeartbeatTimeoutField) {
ASSERT_STRING_CONTAINS(status.reason(), "heartbeat timeout must be greater than 0");
}
-TEST(ReplicaSetConfig, GleDefaultField) {
- ReplicaSetConfig config;
+TEST(ReplSetConfig, GleDefaultField) {
+ ReplSetConfig config;
ASSERT_OK(config.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -1152,17 +1151,17 @@ bool operator==(const MemberConfig& a, const MemberConfig& b) {
a.getNumTags() == b.getNumTags();
}
-bool operator==(const ReplicaSetConfig& a, const ReplicaSetConfig& b) {
+bool operator==(const ReplSetConfig& a, const ReplSetConfig& b) {
// compare WriteConcernModes
std::vector<std::string> modeNames = a.getWriteConcernNames();
for (std::vector<std::string>::iterator it = modeNames.begin(); it != modeNames.end(); it++) {
- ReplicaSetTagPattern patternA = a.findCustomWriteMode(*it).getValue();
- ReplicaSetTagPattern patternB = b.findCustomWriteMode(*it).getValue();
- for (ReplicaSetTagPattern::ConstraintIterator itrA = patternA.constraintsBegin();
+ ReplSetTagPattern patternA = a.findCustomWriteMode(*it).getValue();
+ ReplSetTagPattern patternB = b.findCustomWriteMode(*it).getValue();
+ for (ReplSetTagPattern::ConstraintIterator itrA = patternA.constraintsBegin();
itrA != patternA.constraintsEnd();
itrA++) {
bool same = false;
- for (ReplicaSetTagPattern::ConstraintIterator itrB = patternB.constraintsBegin();
+ for (ReplSetTagPattern::ConstraintIterator itrB = patternB.constraintsBegin();
itrB != patternB.constraintsEnd();
itrB++) {
if (itrA->getKeyIndex() == itrB->getKeyIndex() &&
@@ -1178,9 +1177,9 @@ bool operator==(const ReplicaSetConfig& a, const ReplicaSetConfig& b) {
}
// compare the members
- for (ReplicaSetConfig::MemberIterator memA = a.membersBegin(); memA != a.membersEnd(); memA++) {
+ for (ReplSetConfig::MemberIterator memA = a.membersBegin(); memA != a.membersEnd(); memA++) {
bool same = false;
- for (ReplicaSetConfig::MemberIterator memB = b.membersBegin(); memB != b.membersEnd();
+ for (ReplSetConfig::MemberIterator memB = b.membersBegin(); memB != b.membersEnd();
memB++) {
if (*memA == *memB) {
same = true;
@@ -1206,9 +1205,9 @@ bool operator==(const ReplicaSetConfig& a, const ReplicaSetConfig& b) {
a.getReplicaSetId() == b.getReplicaSetId();
}
-TEST(ReplicaSetConfig, toBSONRoundTripAbility) {
- ReplicaSetConfig configA;
- ReplicaSetConfig configB;
+TEST(ReplSetConfig, toBSONRoundTripAbility) {
+ ReplSetConfig configA;
+ ReplSetConfig configB;
ASSERT_OK(configA.initialize(BSON(
"_id"
<< "rs0"
@@ -1224,9 +1223,9 @@ TEST(ReplicaSetConfig, toBSONRoundTripAbility) {
ASSERT_TRUE(configA == configB);
}
-TEST(ReplicaSetConfig, toBSONRoundTripAbilityLarge) {
- ReplicaSetConfig configA;
- ReplicaSetConfig configB;
+TEST(ReplSetConfig, toBSONRoundTripAbilityLarge) {
+ ReplSetConfig configA;
+ ReplSetConfig configB;
ASSERT_OK(configA.initialize(
BSON("_id"
<< "asdf"
@@ -1294,9 +1293,9 @@ TEST(ReplicaSetConfig, toBSONRoundTripAbilityLarge) {
ASSERT_TRUE(configA == configB);
}
-TEST(ReplicaSetConfig, toBSONRoundTripAbilityInvalid) {
- ReplicaSetConfig configA;
- ReplicaSetConfig configB;
+TEST(ReplSetConfig, toBSONRoundTripAbilityInvalid) {
+ ReplSetConfig configA;
+ ReplSetConfig configB;
ASSERT_OK(
configA.initialize(BSON("_id"
<< ""
@@ -1336,8 +1335,8 @@ TEST(ReplicaSetConfig, toBSONRoundTripAbilityInvalid) {
ASSERT_TRUE(configA == configB);
}
-TEST(ReplicaSetConfig, CheckIfWriteConcernCanBeSatisfied) {
- ReplicaSetConfig configA;
+TEST(ReplSetConfig, CheckIfWriteConcernCanBeSatisfied) {
+ ReplSetConfig configA;
ASSERT_OK(configA.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -1423,9 +1422,9 @@ TEST(ReplicaSetConfig, CheckIfWriteConcernCanBeSatisfied) {
configA.checkIfWriteConcernCanBeSatisfied(invalidModeNotEnoughNodesWC));
}
-TEST(ReplicaSetConfig, CheckMaximumNodesOkay) {
- ReplicaSetConfig configA;
- ReplicaSetConfig configB;
+TEST(ReplSetConfig, CheckMaximumNodesOkay) {
+ ReplSetConfig configA;
+ ReplSetConfig configB;
const int memberCount = 50;
ASSERT_OK(configA.initialize(createConfigDoc(memberCount)));
ASSERT_OK(configB.initialize(configA.toBSON()));
@@ -1434,9 +1433,9 @@ TEST(ReplicaSetConfig, CheckMaximumNodesOkay) {
ASSERT_TRUE(configA == configB);
}
-TEST(ReplicaSetConfig, CheckBeyondMaximumNodesFailsValidate) {
- ReplicaSetConfig configA;
- ReplicaSetConfig configB;
+TEST(ReplSetConfig, CheckBeyondMaximumNodesFailsValidate) {
+ ReplSetConfig configA;
+ ReplSetConfig configB;
const int memberCount = 51;
ASSERT_OK(configA.initialize(createConfigDoc(memberCount)));
ASSERT_OK(configB.initialize(configA.toBSON()));
@@ -1445,8 +1444,8 @@ TEST(ReplicaSetConfig, CheckBeyondMaximumNodesFailsValidate) {
ASSERT_TRUE(configA == configB);
}
-TEST(ReplicaSetConfig, CheckConfigServerCantBeProtocolVersion0) {
- ReplicaSetConfig configA;
+TEST(ReplSetConfig, CheckConfigServerCantBeProtocolVersion0) {
+ ReplSetConfig configA;
ASSERT_OK(configA.initialize(BSON("_id"
<< "rs0"
<< "protocolVersion"
@@ -1467,8 +1466,8 @@ TEST(ReplicaSetConfig, CheckConfigServerCantBeProtocolVersion0) {
ASSERT_STRING_CONTAINS(status.reason(), "cannot run in protocolVersion 0");
}
-TEST(ReplicaSetConfig, CheckConfigServerCantHaveArbiters) {
- ReplicaSetConfig configA;
+TEST(ReplSetConfig, CheckConfigServerCantHaveArbiters) {
+ ReplSetConfig configA;
ASSERT_OK(configA.initialize(BSON("_id"
<< "rs0"
<< "protocolVersion"
@@ -1489,8 +1488,8 @@ TEST(ReplicaSetConfig, CheckConfigServerCantHaveArbiters) {
ASSERT_STRING_CONTAINS(status.reason(), "Arbiters are not allowed");
}
-TEST(ReplicaSetConfig, CheckConfigServerMustBuildIndexes) {
- ReplicaSetConfig configA;
+TEST(ReplSetConfig, CheckConfigServerMustBuildIndexes) {
+ ReplSetConfig configA;
ASSERT_OK(configA.initialize(BSON("_id"
<< "rs0"
<< "protocolVersion"
@@ -1513,8 +1512,8 @@ TEST(ReplicaSetConfig, CheckConfigServerMustBuildIndexes) {
ASSERT_STRING_CONTAINS(status.reason(), "must build indexes");
}
-TEST(ReplicaSetConfig, CheckConfigServerCantHaveSlaveDelay) {
- ReplicaSetConfig configA;
+TEST(ReplSetConfig, CheckConfigServerCantHaveSlaveDelay) {
+ ReplSetConfig configA;
ASSERT_OK(configA.initialize(BSON("_id"
<< "rs0"
<< "protocolVersion"
@@ -1537,10 +1536,10 @@ TEST(ReplicaSetConfig, CheckConfigServerCantHaveSlaveDelay) {
ASSERT_STRING_CONTAINS(status.reason(), "cannot have a non-zero slaveDelay");
}
-TEST(ReplicaSetConfig, CheckConfigServerMustHaveTrueForWriteConcernMajorityJournalDefault) {
+TEST(ReplSetConfig, CheckConfigServerMustHaveTrueForWriteConcernMajorityJournalDefault) {
serverGlobalParams.clusterRole = ClusterRole::ConfigServer;
ON_BLOCK_EXIT([&] { serverGlobalParams.clusterRole = ClusterRole::None; });
- ReplicaSetConfig configA;
+ ReplSetConfig configA;
ASSERT_OK(configA.initialize(BSON("_id"
<< "rs0"
<< "protocolVersion"
@@ -1561,8 +1560,8 @@ TEST(ReplicaSetConfig, CheckConfigServerMustHaveTrueForWriteConcernMajorityJourn
ASSERT_STRING_CONTAINS(status.reason(), " must be true in replica set configurations being ");
}
-TEST(ReplicaSetConfig, GetPriorityTakeoverDelay) {
- ReplicaSetConfig configA;
+TEST(ReplSetConfig, GetPriorityTakeoverDelay) {
+ ReplSetConfig configA;
ASSERT_OK(configA.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -1597,7 +1596,7 @@ TEST(ReplicaSetConfig, GetPriorityTakeoverDelay) {
ASSERT_EQUALS(Milliseconds(2000), configA.getPriorityTakeoverDelay(3));
ASSERT_EQUALS(Milliseconds(1000), configA.getPriorityTakeoverDelay(4));
- ReplicaSetConfig configB;
+ ReplSetConfig configB;
ASSERT_OK(configB.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -1633,9 +1632,9 @@ TEST(ReplicaSetConfig, GetPriorityTakeoverDelay) {
ASSERT_EQUALS(Milliseconds(1000), configB.getPriorityTakeoverDelay(4));
}
-TEST(ReplicaSetConfig, ConfirmDefaultValuesOfAndAbilityToSetWriteConcernMajorityJournalDefault) {
+TEST(ReplSetConfig, ConfirmDefaultValuesOfAndAbilityToSetWriteConcernMajorityJournalDefault) {
// PV0, should default to false.
- ReplicaSetConfig config;
+ ReplSetConfig config;
ASSERT_OK(config.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -1692,24 +1691,24 @@ TEST(ReplicaSetConfig, ConfirmDefaultValuesOfAndAbilityToSetWriteConcernMajority
ASSERT_TRUE(config.toBSON().hasField("writeConcernMajorityJournalDefault"));
}
-TEST(ReplicaSetConfig, ReplSetId) {
+TEST(ReplSetConfig, ReplSetId) {
// Uninitialized configuration has no ID.
- ASSERT_FALSE(ReplicaSetConfig().hasReplicaSetId());
+ ASSERT_FALSE(ReplSetConfig().hasReplicaSetId());
// Cannot provide replica set ID in configuration document when initialized from
// replSetInitiate.
auto status =
- ReplicaSetConfig().initializeForInitiate(BSON("_id"
- << "rs0"
- << "version"
- << 1
- << "members"
- << BSON_ARRAY(BSON("_id" << 0 << "host"
- << "localhost:12345"
- << "priority"
- << 1))
- << "settings"
- << BSON("replicaSetId" << OID::gen())));
+ ReplSetConfig().initializeForInitiate(BSON("_id"
+ << "rs0"
+ << "version"
+ << 1
+ << "members"
+ << BSON_ARRAY(BSON("_id" << 0 << "host"
+ << "localhost:12345"
+ << "priority"
+ << 1))
+ << "settings"
+ << BSON("replicaSetId" << OID::gen())));
ASSERT_EQUALS(ErrorCodes::InvalidReplicaSetConfig, status);
ASSERT_STRING_CONTAINS(status.reason(),
"replica set configuration cannot contain 'replicaSetId' field when "
@@ -1717,7 +1716,7 @@ TEST(ReplicaSetConfig, ReplSetId) {
// Configuration created by replSetInitiate should generate replica set ID.
- ReplicaSetConfig configInitiate;
+ ReplSetConfig configInitiate;
ASSERT_OK(
configInitiate.initializeForInitiate(BSON("_id"
<< "rs0"
@@ -1733,7 +1732,7 @@ TEST(ReplicaSetConfig, ReplSetId) {
OID replicaSetId = configInitiate.getReplicaSetId();
// Configuration initialized from local database can contain ID.
- ReplicaSetConfig configLocal;
+ ReplSetConfig configLocal;
ASSERT_OK(configLocal.initialize(BSON("_id"
<< "rs0"
<< "version"
diff --git a/src/mongo/db/repl/repl_set_heartbeat_response.cpp b/src/mongo/db/repl/repl_set_heartbeat_response.cpp
index 032ef5e3b1d..dd99ffdc61b 100644
--- a/src/mongo/db/repl/repl_set_heartbeat_response.cpp
+++ b/src/mongo/db/repl/repl_set_heartbeat_response.cpp
@@ -334,7 +334,7 @@ Status ReplSetHeartbeatResponse::initialize(const BSONObj& doc, long long term)
const BSONElement rsConfigElement = doc[kConfigFieldName];
if (rsConfigElement.eoo()) {
_configSet = false;
- _config = ReplicaSetConfig();
+ _config = ReplSetConfig();
return Status::OK();
} else if (rsConfigElement.type() != Object) {
return Status(ErrorCodes::TypeMismatch,
@@ -368,7 +368,7 @@ Seconds ReplSetHeartbeatResponse::getTime() const {
return _time;
}
-const ReplicaSetConfig& ReplSetHeartbeatResponse::getConfig() const {
+const ReplSetConfig& ReplSetHeartbeatResponse::getConfig() const {
invariant(_configSet);
return _config;
}
diff --git a/src/mongo/db/repl/repl_set_heartbeat_response.h b/src/mongo/db/repl/repl_set_heartbeat_response.h
index 2b968bbb17d..25e56c15179 100644
--- a/src/mongo/db/repl/repl_set_heartbeat_response.h
+++ b/src/mongo/db/repl/repl_set_heartbeat_response.h
@@ -32,7 +32,7 @@
#include "mongo/db/repl/member_state.h"
#include "mongo/db/repl/optime.h"
-#include "mongo/db/repl/replica_set_config.h"
+#include "mongo/db/repl/repl_set_config.h"
#include "mongo/util/time_support.h"
namespace mongo {
@@ -117,7 +117,7 @@ public:
bool hasConfig() const {
return _configSet;
}
- const ReplicaSetConfig& getConfig() const;
+ const ReplSetConfig& getConfig() const;
bool hasPrimaryId() const {
return _primaryIdSet;
}
@@ -227,7 +227,7 @@ public:
/**
* Initializes _config with "config".
*/
- void setConfig(const ReplicaSetConfig& config) {
+ void setConfig(const ReplSetConfig& config) {
_configSet = true;
_config = config;
}
@@ -280,7 +280,7 @@ private:
HostAndPort _syncingTo;
bool _configSet = false;
- ReplicaSetConfig _config;
+ ReplSetConfig _config;
bool _primaryIdSet = false;
long long _primaryId = -1;
diff --git a/src/mongo/db/repl/repl_set_heartbeat_response_test.cpp b/src/mongo/db/repl/repl_set_heartbeat_response_test.cpp
index 80548c1aacf..259c17379fc 100644
--- a/src/mongo/db/repl/repl_set_heartbeat_response_test.cpp
+++ b/src/mongo/db/repl/repl_set_heartbeat_response_test.cpp
@@ -295,7 +295,7 @@ TEST(ReplSetHeartbeatResponse, DefaultConstructThenSlowlyBuildToFullObj) {
ASSERT_EQUALS(hbResponseObj.toString(), hbResponseObjRoundTripChecker.toBSON(false).toString());
// set config
- ReplicaSetConfig config;
+ ReplSetConfig config;
hbResponse.setConfig(config);
++fieldsSet;
ASSERT_EQUALS(false, hbResponse.hasState());
diff --git a/src/mongo/db/repl/repl_set_html_summary.h b/src/mongo/db/repl/repl_set_html_summary.h
index 70e3c3eae3b..97034dbb47f 100644
--- a/src/mongo/db/repl/repl_set_html_summary.h
+++ b/src/mongo/db/repl/repl_set_html_summary.h
@@ -33,7 +33,7 @@
#include "mongo/db/repl/member_heartbeat_data.h"
#include "mongo/db/repl/optime.h"
-#include "mongo/db/repl/replica_set_config.h"
+#include "mongo/db/repl/repl_set_config.h"
namespace mongo {
@@ -49,7 +49,7 @@ public:
const std::string toHtmlString() const;
- void setConfig(const ReplicaSetConfig& config) {
+ void setConfig(const ReplSetConfig& config) {
_config = config;
}
@@ -86,7 +86,7 @@ public:
}
private:
- ReplicaSetConfig _config;
+ ReplSetConfig _config;
std::vector<MemberHeartbeatData> _hbData;
Date_t _now;
int _selfIndex;
diff --git a/src/mongo/db/repl/replica_set_tag.cpp b/src/mongo/db/repl/repl_set_tag.cpp
index ed6781cfc95..40ed43c7783 100644
--- a/src/mongo/db/repl/replica_set_tag.cpp
+++ b/src/mongo/db/repl/repl_set_tag.cpp
@@ -28,7 +28,7 @@
#include "mongo/platform/basic.h"
-#include "mongo/db/repl/replica_set_tag.h"
+#include "mongo/db/repl/repl_set_tag.h"
#include <algorithm>
@@ -41,15 +41,15 @@
namespace mongo {
namespace repl {
-bool ReplicaSetTag::operator==(const ReplicaSetTag& other) const {
+bool ReplSetTag::operator==(const ReplSetTag& other) const {
return _keyIndex == other._keyIndex && _valueIndex == other._valueIndex;
}
-bool ReplicaSetTag::operator!=(const ReplicaSetTag& other) const {
+bool ReplSetTag::operator!=(const ReplSetTag& other) const {
return !(*this == other);
}
-void ReplicaSetTagPattern::addTagCountConstraint(int32_t keyIndex, int32_t minCount) {
+void ReplSetTagPattern::addTagCountConstraint(int32_t keyIndex, int32_t minCount) {
const std::vector<TagCountConstraint>::iterator iter = std::find_if(
_constraints.begin(),
_constraints.end(),
@@ -63,18 +63,18 @@ void ReplicaSetTagPattern::addTagCountConstraint(int32_t keyIndex, int32_t minCo
}
}
-ReplicaSetTagPattern::TagCountConstraint::TagCountConstraint(int32_t keyIndex, int32_t minCount)
+ReplSetTagPattern::TagCountConstraint::TagCountConstraint(int32_t keyIndex, int32_t minCount)
: _keyIndex(keyIndex), _minCount(minCount) {}
-ReplicaSetTagMatch::ReplicaSetTagMatch(const ReplicaSetTagPattern& pattern) {
- for (ReplicaSetTagPattern::ConstraintIterator iter = pattern.constraintsBegin();
+ReplSetTagMatch::ReplSetTagMatch(const ReplSetTagPattern& pattern) {
+ for (ReplSetTagPattern::ConstraintIterator iter = pattern.constraintsBegin();
iter != pattern.constraintsEnd();
++iter) {
_boundTagValues.push_back(BoundTagValue(*iter));
}
}
-bool ReplicaSetTagMatch::update(const ReplicaSetTag& tag) {
+bool ReplSetTagMatch::update(const ReplSetTag& tag) {
const std::vector<BoundTagValue>::iterator iter =
std::find_if(_boundTagValues.begin(),
_boundTagValues.end(),
@@ -89,7 +89,7 @@ bool ReplicaSetTagMatch::update(const ReplicaSetTag& tag) {
return isSatisfied();
}
-bool ReplicaSetTagMatch::isSatisfied() const {
+bool ReplSetTagMatch::isSatisfied() const {
const std::vector<BoundTagValue>::const_iterator iter =
std::find_if(_boundTagValues.begin(),
_boundTagValues.end(),
@@ -98,11 +98,11 @@ bool ReplicaSetTagMatch::isSatisfied() const {
return iter == _boundTagValues.end();
}
-bool ReplicaSetTagMatch::BoundTagValue::isSatisfied() const {
+bool ReplSetTagMatch::BoundTagValue::isSatisfied() const {
return constraint.getMinCount() <= int32_t(boundValues.size());
}
-ReplicaSetTag ReplicaSetTagConfig::makeTag(StringData key, StringData value) {
+ReplSetTag ReplSetTagConfig::makeTag(StringData key, StringData value) {
int32_t keyIndex = _findKeyIndex(key);
if (size_t(keyIndex) == _tagData.size()) {
_tagData.push_back(make_pair(key.toString(), ValueVector()));
@@ -111,32 +111,32 @@ ReplicaSetTag ReplicaSetTagConfig::makeTag(StringData key, StringData value) {
for (size_t valueIndex = 0; valueIndex < values.size(); ++valueIndex) {
if (values[valueIndex] != value)
continue;
- return ReplicaSetTag(keyIndex, int32_t(valueIndex));
+ return ReplSetTag(keyIndex, int32_t(valueIndex));
}
values.push_back(value.toString());
- return ReplicaSetTag(keyIndex, int32_t(values.size()) - 1);
+ return ReplSetTag(keyIndex, int32_t(values.size()) - 1);
}
-ReplicaSetTag ReplicaSetTagConfig::findTag(StringData key, StringData value) const {
+ReplSetTag ReplSetTagConfig::findTag(StringData key, StringData value) const {
int32_t keyIndex = _findKeyIndex(key);
if (size_t(keyIndex) == _tagData.size())
- return ReplicaSetTag(-1, -1);
+ return ReplSetTag(-1, -1);
const ValueVector& values = _tagData[keyIndex].second;
for (size_t valueIndex = 0; valueIndex < values.size(); ++valueIndex) {
if (values[valueIndex] == value) {
- return ReplicaSetTag(keyIndex, int32_t(valueIndex));
+ return ReplSetTag(keyIndex, int32_t(valueIndex));
}
}
- return ReplicaSetTag(-1, -1);
+ return ReplSetTag(-1, -1);
}
-ReplicaSetTagPattern ReplicaSetTagConfig::makePattern() const {
- return ReplicaSetTagPattern();
+ReplSetTagPattern ReplSetTagConfig::makePattern() const {
+ return ReplSetTagPattern();
}
-Status ReplicaSetTagConfig::addTagCountConstraintToPattern(ReplicaSetTagPattern* pattern,
- StringData tagKey,
- int32_t minCount) const {
+Status ReplSetTagConfig::addTagCountConstraintToPattern(ReplSetTagPattern* pattern,
+ StringData tagKey,
+ int32_t minCount) const {
int32_t keyIndex = _findKeyIndex(tagKey);
if (size_t(keyIndex) == _tagData.size()) {
return Status(ErrorCodes::NoSuchKey,
@@ -146,7 +146,7 @@ Status ReplicaSetTagConfig::addTagCountConstraintToPattern(ReplicaSetTagPattern*
return Status::OK();
}
-int32_t ReplicaSetTagConfig::_findKeyIndex(StringData key) const {
+int32_t ReplSetTagConfig::_findKeyIndex(StringData key) const {
size_t i;
for (i = 0; i < _tagData.size(); ++i) {
if (_tagData[i].first == key) {
@@ -156,29 +156,29 @@ int32_t ReplicaSetTagConfig::_findKeyIndex(StringData key) const {
return int32_t(i);
}
-std::string ReplicaSetTagConfig::getTagKey(const ReplicaSetTag& tag) const {
+std::string ReplSetTagConfig::getTagKey(const ReplSetTag& tag) const {
invariant(tag.isValid() && size_t(tag.getKeyIndex()) < _tagData.size());
return _tagData[tag.getKeyIndex()].first;
}
-std::string ReplicaSetTagConfig::getTagValue(const ReplicaSetTag& tag) const {
+std::string ReplSetTagConfig::getTagValue(const ReplSetTag& tag) const {
invariant(tag.isValid() && size_t(tag.getKeyIndex()) < _tagData.size());
const ValueVector& values = _tagData[tag.getKeyIndex()].second;
invariant(tag.getValueIndex() >= 0 && size_t(tag.getValueIndex()) < values.size());
return values[tag.getValueIndex()];
}
-void ReplicaSetTagConfig::put(const ReplicaSetTag& tag, std::ostream& os) const {
+void ReplSetTagConfig::put(const ReplSetTag& tag, std::ostream& os) const {
BSONObjBuilder builder;
_appendTagKey(tag.getKeyIndex(), &builder);
_appendTagValue(tag.getKeyIndex(), tag.getValueIndex(), &builder);
os << builder.done();
}
-void ReplicaSetTagConfig::put(const ReplicaSetTagPattern& pattern, std::ostream& os) const {
+void ReplSetTagConfig::put(const ReplSetTagPattern& pattern, std::ostream& os) const {
BSONObjBuilder builder;
BSONArrayBuilder allConstraintsBuilder(builder.subarrayStart("constraints"));
- for (ReplicaSetTagPattern::ConstraintIterator iter = pattern.constraintsBegin();
+ for (ReplSetTagPattern::ConstraintIterator iter = pattern.constraintsBegin();
iter != pattern.constraintsEnd();
++iter) {
BSONObjBuilder constraintBuilder(allConstraintsBuilder.subobjStart());
@@ -188,7 +188,7 @@ void ReplicaSetTagConfig::put(const ReplicaSetTagPattern& pattern, std::ostream&
os << builder.done();
}
-void ReplicaSetTagConfig::put(const ReplicaSetTagMatch& matcher, std::ostream& os) const {
+void ReplSetTagConfig::put(const ReplSetTagMatch& matcher, std::ostream& os) const {
BSONObjBuilder builder;
BSONArrayBuilder allBindingsBuilder(builder.subarrayStart("bindings"));
for (size_t i = 0; i < matcher._boundTagValues.size(); ++i) {
@@ -206,7 +206,7 @@ void ReplicaSetTagConfig::put(const ReplicaSetTagMatch& matcher, std::ostream& o
os << builder.done();
}
-void ReplicaSetTagConfig::_appendTagKey(int32_t keyIndex, BSONObjBuilder* builder) const {
+void ReplSetTagConfig::_appendTagKey(int32_t keyIndex, BSONObjBuilder* builder) const {
if (keyIndex < 0 || size_t(keyIndex) >= _tagData.size()) {
builder->append("tagKey", int(keyIndex));
} else {
@@ -214,9 +214,9 @@ void ReplicaSetTagConfig::_appendTagKey(int32_t keyIndex, BSONObjBuilder* builde
}
}
-void ReplicaSetTagConfig::_appendTagValue(int32_t keyIndex,
- int32_t valueIndex,
- BSONObjBuilder* builder) const {
+void ReplSetTagConfig::_appendTagValue(int32_t keyIndex,
+ int32_t valueIndex,
+ BSONObjBuilder* builder) const {
if (keyIndex < 0 || size_t(keyIndex) >= _tagData.size()) {
builder->append("tagValue", valueIndex);
return;
@@ -228,8 +228,8 @@ void ReplicaSetTagConfig::_appendTagValue(int32_t keyIndex,
builder->append("tagValue", keyEntry.second[valueIndex]);
}
-void ReplicaSetTagConfig::_appendConstraint(
- const ReplicaSetTagPattern::TagCountConstraint& constraint, BSONObjBuilder* builder) const {
+void ReplSetTagConfig::_appendConstraint(const ReplSetTagPattern::TagCountConstraint& constraint,
+ BSONObjBuilder* builder) const {
_appendTagKey(constraint.getKeyIndex(), builder);
builder->append("minCount", int(constraint.getMinCount()));
}
diff --git a/src/mongo/db/repl/replica_set_tag.h b/src/mongo/db/repl/repl_set_tag.h
index beee7e70ab4..0e6e44f43c3 100644
--- a/src/mongo/db/repl/replica_set_tag.h
+++ b/src/mongo/db/repl/repl_set_tag.h
@@ -45,21 +45,21 @@ namespace repl {
/**
* Representation of a tag on a replica set node.
*
- * Tags are only meaningful when used with a copy of the ReplicaSetTagConfig that
+ * Tags are only meaningful when used with a copy of the ReplSetTagConfig that
* created them.
*/
-class ReplicaSetTag {
+class ReplSetTag {
public:
/**
* Default constructor, produces an uninitialized tag.
*/
- ReplicaSetTag() {}
+ ReplSetTag() {}
/**
* Constructs a tag with the given key and value indexes.
- * Do not call directly; used by ReplicaSetTagConfig.
+ * Do not call directly; used by ReplSetTagConfig.
*/
- ReplicaSetTag(int32_t keyIndex, int32_t valueIndex)
+ ReplSetTag(int32_t keyIndex, int32_t valueIndex)
: _keyIndex(keyIndex), _valueIndex(valueIndex) {}
/**
@@ -84,20 +84,20 @@ public:
}
/**
- * Compares two tags from the *same* ReplicaSetTagConfig for equality.
+ * Compares two tags from the *same* ReplSetTagConfig for equality.
*/
- bool operator==(const ReplicaSetTag& other) const;
+ bool operator==(const ReplSetTag& other) const;
/**
- * Compares two tags from the *same* ReplicaSetTagConfig for inequality.
+ * Compares two tags from the *same* ReplSetTagConfig for inequality.
*/
- bool operator!=(const ReplicaSetTag& other) const;
+ bool operator!=(const ReplSetTag& other) const;
private:
- // The index of the key in the associated ReplicaSetTagConfig.
+ // The index of the key in the associated ReplSetTagConfig.
int32_t _keyIndex;
- // The index of the value in the entry for the key in the associated ReplicaSetTagConfig.
+ // The index of the value in the entry for the key in the associated ReplSetTagConfig.
int32_t _valueIndex;
};
@@ -105,7 +105,7 @@ private:
* Representation of a tag matching pattern, like { "dc": 2, "rack": 3 }, of the form
* used for tagged replica set writes.
*/
-class ReplicaSetTagPattern {
+class ReplSetTagPattern {
public:
/**
* Representation of a single tag's minimum count constraint in a pattern.
@@ -132,7 +132,7 @@ public:
* Adds a count constraint for the given key index with the given count.
*
* Do not call directly, but use the addTagCountConstraintToPattern method
- * of ReplicaSetTagConfig.
+ * of ReplSetTagConfig.
*/
void addTagCountConstraint(int32_t keyIndex, int32_t minCount);
@@ -155,7 +155,7 @@ private:
};
/**
- * State object for progressive detection of ReplicaSetTagPattern constraint satisfaction.
+ * State object for progressive detection of ReplSetTagPattern constraint satisfaction.
*
* This is an abstraction of the replica set write tag satisfaction problem.
*
@@ -164,27 +164,27 @@ private:
* progressively updated with tags. After processing a sequence of tags sufficient to satisfy
* the pattern, isSatisfied() becomes true.
*/
-class ReplicaSetTagMatch {
- friend class ReplicaSetTagConfig;
+class ReplSetTagMatch {
+ friend class ReplSetTagConfig;
public:
/**
* Constructs an empty match object, equivalent to one that matches an
* empty pattern.
*/
- ReplicaSetTagMatch() {}
+ ReplSetTagMatch() {}
/**
* Constructs a clean match object for the given pattern.
*/
- explicit ReplicaSetTagMatch(const ReplicaSetTagPattern& pattern);
+ explicit ReplSetTagMatch(const ReplSetTagPattern& pattern);
/**
* Updates the match state based on the data for the given tag.
*
* Returns true if, after this update, isSatisfied() is true.
*/
- bool update(const ReplicaSetTag& tag);
+ bool update(const ReplSetTag& tag);
/**
* Returns true if the match has received a sequence of tags sufficient to satisfy the
@@ -203,7 +203,7 @@ private:
*/
struct BoundTagValue {
BoundTagValue() {}
- explicit BoundTagValue(const ReplicaSetTagPattern::TagCountConstraint& aConstraint)
+ explicit BoundTagValue(const ReplSetTagPattern::TagCountConstraint& aConstraint)
: constraint(aConstraint) {}
int32_t getKeyIndex() const {
@@ -211,7 +211,7 @@ private:
}
bool isSatisfied() const;
- ReplicaSetTagPattern::TagCountConstraint constraint;
+ ReplSetTagPattern::TagCountConstraint constraint;
std::vector<int32_t> boundValues;
};
std::vector<BoundTagValue> _boundTagValues;
@@ -224,23 +224,23 @@ private:
* class are compatible with other instances of this class that are *copies* of the original
* instance.
*/
-class ReplicaSetTagConfig {
+class ReplSetTagConfig {
public:
/**
* Finds or allocates a tag with the given "key" and "value" strings.
*/
- ReplicaSetTag makeTag(StringData key, StringData value);
+ ReplSetTag makeTag(StringData key, StringData value);
/**
* Finds a tag with the given key and value strings, or returns a tag whose isValid() method
* returns false if the configuration has never allocated such a tag via makeTag().
*/
- ReplicaSetTag findTag(StringData key, StringData value) const;
+ ReplSetTag findTag(StringData key, StringData value) const;
/**
* Makes a new, empty pattern object.
*/
- ReplicaSetTagPattern makePattern() const;
+ ReplSetTagPattern makePattern() const;
/**
* Adds a constraint clause to the given "pattern". This particular
@@ -248,7 +248,7 @@ public:
* be observed. Two tags "t1" and "t2" are distinct if "t1 != t2", so this constraint
* means that we must see at least "minCount" tags with the specified "tagKey".
*/
- Status addTagCountConstraintToPattern(ReplicaSetTagPattern* pattern,
+ Status addTagCountConstraintToPattern(ReplSetTagPattern* pattern,
StringData tagKey,
int32_t minCount) const;
@@ -258,7 +258,7 @@ public:
* Behavior is undefined if "tag" is not valid or was not from this
* config or one of its copies.
*/
- std::string getTagKey(const ReplicaSetTag& tag) const;
+ std::string getTagKey(const ReplSetTag& tag) const;
/**
* Gets the string value for the given "tag".
@@ -266,22 +266,22 @@ public:
* Like getTagKey, above, behavior is undefined if "tag" is not valid or was not from this
* config or one of its copies.
*/
- std::string getTagValue(const ReplicaSetTag& tag) const;
+ std::string getTagValue(const ReplSetTag& tag) const;
/**
* Helper that writes a string debugging representation of "tag" to "os".
*/
- void put(const ReplicaSetTag& tag, std::ostream& os) const;
+ void put(const ReplSetTag& tag, std::ostream& os) const;
/**
* Helper that writes a string debugging representation of "pattern" to "os".
*/
- void put(const ReplicaSetTagPattern& pattern, std::ostream& os) const;
+ void put(const ReplSetTagPattern& pattern, std::ostream& os) const;
/**
* Helper that writes a string debugging representation of "matcher" to "os".
*/
- void put(const ReplicaSetTagMatch& matcher, std::ostream& os) const;
+ void put(const ReplSetTagMatch& matcher, std::ostream& os) const;
private:
typedef std::vector<std::string> ValueVector;
@@ -307,7 +307,7 @@ private:
/**
* Helper that writes a constraint object to "builder".
*/
- void _appendConstraint(const ReplicaSetTagPattern::TagCountConstraint& constraint,
+ void _appendConstraint(const ReplSetTagPattern::TagCountConstraint& constraint,
BSONObjBuilder* builder) const;
// Data about known tags. Conceptually, it maps between keys and their indexes,
diff --git a/src/mongo/db/repl/replica_set_tag_test.cpp b/src/mongo/db/repl/repl_set_tag_test.cpp
index 1d70ee39bbe..3f624cf87b8 100644
--- a/src/mongo/db/repl/replica_set_tag_test.cpp
+++ b/src/mongo/db/repl/repl_set_tag_test.cpp
@@ -26,7 +26,7 @@
* it in the license file.
*/
-#include "mongo/db/repl/replica_set_tag.h"
+#include "mongo/db/repl/repl_set_tag.h"
#include "mongo/unittest/unittest.h"
namespace mongo {
@@ -36,19 +36,19 @@ namespace {
template <typename T>
class StreamPutter {
public:
- StreamPutter(const ReplicaSetTagConfig& tagConfig, const T& item)
+ StreamPutter(const ReplSetTagConfig& tagConfig, const T& item)
: _tagConfig(&tagConfig), _item(&item) {}
void put(std::ostream& os) const {
_tagConfig->put(*_item, os);
}
private:
- const ReplicaSetTagConfig* _tagConfig;
+ const ReplSetTagConfig* _tagConfig;
const T* _item;
};
template <typename T>
-StreamPutter<T> streamput(const ReplicaSetTagConfig& tagConfig, const T& item) {
+StreamPutter<T> streamput(const ReplSetTagConfig& tagConfig, const T& item) {
return StreamPutter<T>(tagConfig, item);
}
@@ -58,12 +58,12 @@ std::ostream& operator<<(std::ostream& os, const StreamPutter<T>& putter) {
return os;
}
-TEST(ReplicaSetTagConfigTest, MakeAndFindTags) {
- ReplicaSetTagConfig tagConfig;
- ReplicaSetTag dcNY = tagConfig.makeTag("dc", "ny");
- ReplicaSetTag dcRI = tagConfig.makeTag("dc", "ri");
- ReplicaSetTag rack1 = tagConfig.makeTag("rack", "1");
- ReplicaSetTag rack2 = tagConfig.makeTag("rack", "2");
+TEST(ReplSetTagConfigTest, MakeAndFindTags) {
+ ReplSetTagConfig tagConfig;
+ ReplSetTag dcNY = tagConfig.makeTag("dc", "ny");
+ ReplSetTag dcRI = tagConfig.makeTag("dc", "ri");
+ ReplSetTag rack1 = tagConfig.makeTag("rack", "1");
+ ReplSetTag rack2 = tagConfig.makeTag("rack", "2");
ASSERT_TRUE(dcNY.isValid());
ASSERT_EQUALS("dc", tagConfig.getTagKey(dcNY));
ASSERT_EQUALS("ny", tagConfig.getTagValue(dcNY));
@@ -84,7 +84,7 @@ TEST(ReplicaSetTagConfigTest, MakeAndFindTags) {
ASSERT_FALSE(tagConfig.findTag("country", "us").isValid());
}
-class ReplicaSetTagMatchTest : public unittest::Test {
+class ReplSetTagMatchTest : public unittest::Test {
public:
void setUp() {
dcNY = tagConfig.makeTag("dc", "ny");
@@ -97,27 +97,27 @@ public:
}
protected:
- ReplicaSetTagConfig tagConfig;
- ReplicaSetTag dcNY;
- ReplicaSetTag dcVA;
- ReplicaSetTag dcRI;
- ReplicaSetTag rack1;
- ReplicaSetTag rack2;
- ReplicaSetTag rack3;
- ReplicaSetTag rack4;
+ ReplSetTagConfig tagConfig;
+ ReplSetTag dcNY;
+ ReplSetTag dcVA;
+ ReplSetTag dcRI;
+ ReplSetTag rack1;
+ ReplSetTag rack2;
+ ReplSetTag rack3;
+ ReplSetTag rack4;
};
-TEST_F(ReplicaSetTagMatchTest, EmptyPatternAlwaysSatisfied) {
- ReplicaSetTagPattern pattern = tagConfig.makePattern();
- ASSERT_TRUE(ReplicaSetTagMatch(pattern).isSatisfied());
+TEST_F(ReplSetTagMatchTest, EmptyPatternAlwaysSatisfied) {
+ ReplSetTagPattern pattern = tagConfig.makePattern();
+ ASSERT_TRUE(ReplSetTagMatch(pattern).isSatisfied());
ASSERT_OK(tagConfig.addTagCountConstraintToPattern(&pattern, "dc", 0));
- ASSERT_TRUE(ReplicaSetTagMatch(pattern).isSatisfied());
+ ASSERT_TRUE(ReplSetTagMatch(pattern).isSatisfied());
}
-TEST_F(ReplicaSetTagMatchTest, SingleTagConstraint) {
- ReplicaSetTagPattern pattern = tagConfig.makePattern();
+TEST_F(ReplSetTagMatchTest, SingleTagConstraint) {
+ ReplSetTagPattern pattern = tagConfig.makePattern();
ASSERT_OK(tagConfig.addTagCountConstraintToPattern(&pattern, "dc", 2));
- ReplicaSetTagMatch matcher(pattern);
+ ReplSetTagMatch matcher(pattern);
ASSERT_FALSE(matcher.isSatisfied());
ASSERT_FALSE(matcher.update(dcVA)); // One DC alone won't satisfy "dc: 2".
ASSERT_FALSE(matcher.update(rack2)); // Adding one rack won't satisfy.
@@ -129,12 +129,12 @@ TEST_F(ReplicaSetTagMatchTest, SingleTagConstraint) {
ASSERT_TRUE(matcher.update(rack1)); // Once matcher is satisfied, it stays satisfied.
}
-TEST_F(ReplicaSetTagMatchTest, MaskingConstraints) {
+TEST_F(ReplSetTagMatchTest, MaskingConstraints) {
// The highest count constraint for a tag key is the only one that matters.
- ReplicaSetTagPattern pattern = tagConfig.makePattern();
+ ReplSetTagPattern pattern = tagConfig.makePattern();
ASSERT_OK(tagConfig.addTagCountConstraintToPattern(&pattern, "rack", 2));
ASSERT_OK(tagConfig.addTagCountConstraintToPattern(&pattern, "rack", 3));
- ReplicaSetTagMatch matcher(pattern);
+ ReplSetTagMatch matcher(pattern);
ASSERT_FALSE(matcher.isSatisfied());
ASSERT_FALSE(matcher.update(rack2));
ASSERT_FALSE(matcher.update(rack3));
@@ -142,11 +142,11 @@ TEST_F(ReplicaSetTagMatchTest, MaskingConstraints) {
ASSERT_TRUE(matcher.update(rack1));
}
-TEST_F(ReplicaSetTagMatchTest, MultipleConstraints) {
- ReplicaSetTagPattern pattern = tagConfig.makePattern();
+TEST_F(ReplSetTagMatchTest, MultipleConstraints) {
+ ReplSetTagPattern pattern = tagConfig.makePattern();
ASSERT_OK(tagConfig.addTagCountConstraintToPattern(&pattern, "dc", 3));
ASSERT_OK(tagConfig.addTagCountConstraintToPattern(&pattern, "rack", 2));
- ReplicaSetTagMatch matcher(pattern);
+ ReplSetTagMatch matcher(pattern);
ASSERT_FALSE(matcher.isSatisfied());
ASSERT_FALSE(matcher.update(dcVA));
ASSERT_FALSE(matcher.update(rack2));
diff --git a/src/mongo/db/repl/replset_web_handler.cpp b/src/mongo/db/repl/repl_set_web_handler.cpp
index 3f67cd9a45c..3f67cd9a45c 100644
--- a/src/mongo/db/repl/replset_web_handler.cpp
+++ b/src/mongo/db/repl/repl_set_web_handler.cpp
diff --git a/src/mongo/db/repl/replication_coordinator.h b/src/mongo/db/repl/replication_coordinator.h
index 53087d88b65..fd7f0df661d 100644
--- a/src/mongo/db/repl/replication_coordinator.h
+++ b/src/mongo/db/repl/replication_coordinator.h
@@ -72,7 +72,7 @@ class OldUpdatePositionArgs;
class OplogReader;
class OpTime;
class ReadConcernArgs;
-class ReplicaSetConfig;
+class ReplSetConfig;
class ReplicationExecutor;
class ReplSetHeartbeatArgs;
class ReplSetHeartbeatArgsV1;
@@ -519,9 +519,9 @@ public:
virtual void appendSlaveInfoData(BSONObjBuilder* result) = 0;
/**
- * Returns a copy of the current ReplicaSetConfig.
+ * Returns a copy of the current ReplSetConfig.
*/
- virtual ReplicaSetConfig getConfig() const = 0;
+ virtual ReplSetConfig getConfig() const = 0;
/**
* Handles an incoming replSetGetConfig command. Adds BSON to 'result'.
diff --git a/src/mongo/db/repl/replication_coordinator_impl.cpp b/src/mongo/db/repl/replication_coordinator_impl.cpp
index eeac4f79c1a..4226ed2fd91 100644
--- a/src/mongo/db/repl/replication_coordinator_impl.cpp
+++ b/src/mongo/db/repl/replication_coordinator_impl.cpp
@@ -54,13 +54,13 @@
#include "mongo/db/repl/old_update_position_args.h"
#include "mongo/db/repl/read_concern_args.h"
#include "mongo/db/repl/repl_client_info.h"
+#include "mongo/db/repl/repl_set_config_checks.h"
#include "mongo/db/repl/repl_set_heartbeat_args.h"
#include "mongo/db/repl/repl_set_heartbeat_args_v1.h"
#include "mongo/db/repl/repl_set_heartbeat_response.h"
#include "mongo/db/repl/repl_set_html_summary.h"
#include "mongo/db/repl/repl_set_request_votes_args.h"
#include "mongo/db/repl/repl_settings.h"
-#include "mongo/db/repl/replica_set_config_checks.h"
#include "mongo/db/repl/replication_executor.h"
#include "mongo/db/repl/rslog.h"
#include "mongo/db/repl/storage_interface.h"
@@ -122,10 +122,10 @@ BSONObj incrementConfigVersionByRandom(BSONObj config) {
BSONObjBuilder builder;
for (BSONObjIterator iter(config); iter.more(); iter.next()) {
BSONElement elem = *iter;
- if (elem.fieldNameStringData() == ReplicaSetConfig::kVersionFieldName && elem.isNumber()) {
+ if (elem.fieldNameStringData() == ReplSetConfig::kVersionFieldName && elem.isNumber()) {
std::unique_ptr<SecureRandom> generator(SecureRandom::create());
const int random = std::abs(static_cast<int>(generator->nextInt64()) % 100000);
- builder.appendIntOrLL(ReplicaSetConfig::kVersionFieldName,
+ builder.appendIntOrLL(ReplSetConfig::kVersionFieldName,
elem.numberLong() + 10000 + random);
} else {
builder.append(elem);
@@ -395,7 +395,7 @@ void ReplicationCoordinatorImpl::_waitForStartUpComplete() {
}
}
-ReplicaSetConfig ReplicationCoordinatorImpl::getReplicaSetConfig_forTest() {
+ReplSetConfig ReplicationCoordinatorImpl::getReplicaSetConfig_forTest() {
stdx::lock_guard<stdx::mutex> lk(_mutex);
return _rsConfig;
}
@@ -457,7 +457,7 @@ bool ReplicationCoordinatorImpl::_startLoadLocalConfig(OperationContext* txn) {
<< cfg.getStatus();
return true;
}
- ReplicaSetConfig localConfig;
+ ReplSetConfig localConfig;
Status status = localConfig.initialize(cfg.getValue());
if (!status.isOK()) {
error() << "Locally stored replica set configuration does not parse; See "
@@ -490,7 +490,7 @@ bool ReplicationCoordinatorImpl::_startLoadLocalConfig(OperationContext* txn) {
void ReplicationCoordinatorImpl::_finishLoadLocalConfig(
const ReplicationExecutor::CallbackArgs& cbData,
- const ReplicaSetConfig& localConfig,
+ const ReplSetConfig& localConfig,
const StatusWith<OpTime>& lastOpTimeStatus,
const StatusWith<LastVote>& lastVoteStatus) {
if (!cbData.status.isOK()) {
@@ -1557,12 +1557,12 @@ bool ReplicationCoordinatorImpl::_doneWaitingForReplication_inlock(
}
// Continue and wait for replication to the majority (of voters).
// *** Needed for J:True, writeConcernMajorityShouldJournal:False (appliedOpTime snapshot).
- patternName = ReplicaSetConfig::kMajorityWriteConcernModeName;
+ patternName = ReplSetConfig::kMajorityWriteConcernModeName;
} else {
patternName = writeConcern.wMode;
}
- StatusWith<ReplicaSetTagPattern> tagPattern = _rsConfig.findCustomWriteMode(patternName);
+ StatusWith<ReplSetTagPattern> tagPattern = _rsConfig.findCustomWriteMode(patternName);
if (!tagPattern.isOK()) {
return true;
}
@@ -1594,8 +1594,8 @@ bool ReplicationCoordinatorImpl::_haveNumNodesReachedOpTime_inlock(const OpTime&
}
bool ReplicationCoordinatorImpl::_haveTaggedNodesReachedOpTime_inlock(
- const OpTime& opTime, const ReplicaSetTagPattern& tagPattern, bool durablyWritten) {
- ReplicaSetTagMatch matcher(tagPattern);
+ const OpTime& opTime, const ReplSetTagPattern& tagPattern, bool durablyWritten) {
+ ReplSetTagMatch matcher(tagPattern);
for (SlaveInfoVector::iterator it = _slaveInfo.begin(); it != _slaveInfo.end(); ++it) {
const OpTime& slaveTime = durablyWritten ? it->lastDurableOpTime : it->lastAppliedOpTime;
if (slaveTime >= opTime) {
@@ -2134,7 +2134,7 @@ void ReplicationCoordinatorImpl::_appendSlaveInfoData_inlock(BSONObjBuilder* res
}
}
-ReplicaSetConfig ReplicationCoordinatorImpl::getConfig() const {
+ReplSetConfig ReplicationCoordinatorImpl::getConfig() const {
stdx::lock_guard<stdx::mutex> lock(_mutex);
return _rsConfig;
}
@@ -2341,10 +2341,10 @@ Status ReplicationCoordinatorImpl::processReplSetReconfig(OperationContext* txn,
&lk,
stdx::bind(&ReplicationCoordinatorImpl::_setConfigState_inlock, this, kConfigSteady));
- ReplicaSetConfig oldConfig = _rsConfig;
+ ReplSetConfig oldConfig = _rsConfig;
lk.unlock();
- ReplicaSetConfig newConfig;
+ ReplSetConfig newConfig;
BSONObj newConfigObj = args.newConfigObj;
if (args.force) {
newConfigObj = incrementConfigVersionByRandom(newConfigObj);
@@ -2418,9 +2418,7 @@ Status ReplicationCoordinatorImpl::processReplSetReconfig(OperationContext* txn,
}
void ReplicationCoordinatorImpl::_finishReplSetReconfig(
- const ReplicationExecutor::CallbackArgs& cbData,
- const ReplicaSetConfig& newConfig,
- int myIndex) {
+ const ReplicationExecutor::CallbackArgs& cbData, const ReplSetConfig& newConfig, int myIndex) {
LockGuard topoLock(_topoMutex);
stdx::unique_lock<stdx::mutex> lk(_mutex);
@@ -2450,7 +2448,7 @@ void ReplicationCoordinatorImpl::_finishReplSetReconfig(
}
- const ReplicaSetConfig oldConfig = _rsConfig;
+ const ReplSetConfig oldConfig = _rsConfig;
const PostMemberStateUpdateAction action = _setCurrentRSConfig_inlock(newConfig, myIndex);
// On a reconfig we drop all snapshots so we don't mistakenely read from the wrong one.
@@ -2497,7 +2495,7 @@ Status ReplicationCoordinatorImpl::processReplSetInitiate(OperationContext* txn,
&ReplicationCoordinatorImpl::_setConfigState_inlock, this, kConfigUninitialized));
lk.unlock();
- ReplicaSetConfig newConfig;
+ ReplSetConfig newConfig;
Status status = newConfig.initializeForInitiate(configObj, true);
if (!status.isOK()) {
error() << "replSet initiate got " << status << " while parsing " << configObj;
@@ -2555,7 +2553,7 @@ Status ReplicationCoordinatorImpl::processReplSetInitiate(OperationContext* txn,
return Status::OK();
}
-void ReplicationCoordinatorImpl::_finishReplSetInitiate(const ReplicaSetConfig& newConfig,
+void ReplicationCoordinatorImpl::_finishReplSetInitiate(const ReplSetConfig& newConfig,
int myIndex) {
stdx::unique_lock<stdx::mutex> lk(_mutex);
invariant(_rsConfigState == kConfigInitiating);
@@ -2842,7 +2840,7 @@ Status ReplicationCoordinatorImpl::processReplSetElect(const ReplSetElectArgs& a
}
ReplicationCoordinatorImpl::PostMemberStateUpdateAction
-ReplicationCoordinatorImpl::_setCurrentRSConfig_inlock(const ReplicaSetConfig& newConfig,
+ReplicationCoordinatorImpl::_setCurrentRSConfig_inlock(const ReplSetConfig& newConfig,
int myIndex) {
invariant(_settings.usingReplSets());
_cancelHeartbeats_inlock();
@@ -2852,7 +2850,7 @@ ReplicationCoordinatorImpl::_setCurrentRSConfig_inlock(const ReplicaSetConfig& n
OpTime myOptime = _getMyLastAppliedOpTime_inlock();
_topCoord->updateConfig(newConfig, myIndex, _replExecutor.now(), myOptime);
_cachedTerm = _topCoord->getTerm();
- const ReplicaSetConfig oldConfig = _rsConfig;
+ const ReplSetConfig oldConfig = _rsConfig;
_rsConfig = newConfig;
_protVersion.store(_rsConfig.getProtocolVersion());
log() << "New replica set config in use: " << _rsConfig.toBSON() << rsLog;
@@ -3567,7 +3565,7 @@ void ReplicationCoordinatorImpl::waitForElectionDryRunFinish_forTest() {
}
EventHandle ReplicationCoordinatorImpl::_resetElectionInfoOnProtocolVersionUpgrade(
- const ReplicaSetConfig& oldConfig, const ReplicaSetConfig& newConfig) {
+ const ReplSetConfig& oldConfig, const ReplSetConfig& newConfig) {
// On protocol version upgrade, reset last vote as if I just learned the term 0 from other
// nodes.
if (!oldConfig.isInitialized() ||
diff --git a/src/mongo/db/repl/replication_coordinator_impl.h b/src/mongo/db/repl/replication_coordinator_impl.h
index 66086fcc370..d9b65e0bc0d 100644
--- a/src/mongo/db/repl/replication_coordinator_impl.h
+++ b/src/mongo/db/repl/replication_coordinator_impl.h
@@ -39,7 +39,7 @@
#include "mongo/db/repl/member_state.h"
#include "mongo/db/repl/old_update_position_args.h"
#include "mongo/db/repl/optime.h"
-#include "mongo/db/repl/replica_set_config.h"
+#include "mongo/db/repl/repl_set_config.h"
#include "mongo/db/repl/replication_coordinator.h"
#include "mongo/db/repl/replication_coordinator_external_state.h"
#include "mongo/db/repl/replication_executor.h"
@@ -79,7 +79,7 @@ class HeartbeatResponseAction;
class LastVote;
class OplogReader;
class ReplSetRequestVotesArgs;
-class ReplicaSetConfig;
+class ReplSetConfig;
class SyncSourceFeedback;
class StorageInterface;
class TopologyCoordinator;
@@ -202,7 +202,7 @@ public:
virtual void appendSlaveInfoData(BSONObjBuilder* result) override;
- virtual ReplicaSetConfig getConfig() const override;
+ virtual ReplSetConfig getConfig() const override;
virtual void processReplSetGetConfig(BSONObjBuilder* result) override;
@@ -337,7 +337,7 @@ public:
/**
* Gets the replica set configuration in use by the node.
*/
- ReplicaSetConfig getReplicaSetConfig_forTest();
+ ReplSetConfig getReplicaSetConfig_forTest();
/**
* Returns scheduled time of election timeout callback.
@@ -601,7 +601,7 @@ private:
* Returns an action to be performed after unlocking _mutex, via
* _performPostMemberStateUpdateAction.
*/
- PostMemberStateUpdateAction _setCurrentRSConfig_inlock(const ReplicaSetConfig& newConfig,
+ PostMemberStateUpdateAction _setCurrentRSConfig_inlock(const ReplSetConfig& newConfig,
int myIndex);
/**
@@ -654,7 +654,7 @@ private:
* "durablyWritten" indicates whether the operation has to be durably applied.
*/
bool _haveTaggedNodesReachedOpTime_inlock(const OpTime& opTime,
- const ReplicaSetTagPattern& tagPattern,
+ const ReplSetTagPattern& tagPattern,
bool durablyWritten);
Status _checkIfWriteConcernCanBeSatisfied_inlock(const WriteConcernOptions& writeConcern) const;
@@ -805,7 +805,7 @@ private:
* to kConfigSteady, so that we can begin processing heartbeats and reconfigs.
*/
void _finishLoadLocalConfig(const ReplicationExecutor::CallbackArgs& cbData,
- const ReplicaSetConfig& localConfig,
+ const ReplSetConfig& localConfig,
const StatusWith<OpTime>& lastOpTimeStatus,
const StatusWith<LastVote>& lastVoteStatus);
@@ -824,14 +824,14 @@ private:
* Finishes the work of processReplSetInitiate() while holding _topoMutex, in the event of
* a successful quorum check.
*/
- void _finishReplSetInitiate(const ReplicaSetConfig& newConfig, int myIndex);
+ void _finishReplSetInitiate(const ReplSetConfig& newConfig, int myIndex);
/**
* Finishes the work of processReplSetReconfig while holding _topoMutex, in the event of
* a successful quorum check.
*/
void _finishReplSetReconfig(const ReplicationExecutor::CallbackArgs& cbData,
- const ReplicaSetConfig& newConfig,
+ const ReplSetConfig& newConfig,
int myIndex);
/**
@@ -949,26 +949,26 @@ private:
/**
* Schedules a replica set config change.
*/
- void _scheduleHeartbeatReconfig(const ReplicaSetConfig& newConfig);
+ void _scheduleHeartbeatReconfig(const ReplSetConfig& newConfig);
/**
* Callback that continues a heartbeat-initiated reconfig after a running election
* completes.
*/
void _heartbeatReconfigAfterElectionCanceled(const ReplicationExecutor::CallbackArgs& cbData,
- const ReplicaSetConfig& newConfig);
+ const ReplSetConfig& newConfig);
/**
* Method to write a configuration transmitted via heartbeat message to stable storage.
*/
void _heartbeatReconfigStore(const ReplicationExecutor::CallbackArgs& cbd,
- const ReplicaSetConfig& newConfig);
+ const ReplSetConfig& newConfig);
/**
* Conclusion actions of a heartbeat-triggered reconfiguration.
*/
void _heartbeatReconfigFinish(const ReplicationExecutor::CallbackArgs& cbData,
- const ReplicaSetConfig& newConfig,
+ const ReplSetConfig& newConfig,
StatusWith<int> myIndex);
/**
@@ -1079,8 +1079,8 @@ private:
* Resets the term of last vote to 0 to prevent any node from voting for term 0.
* Returns the event handle that indicates when last vote write finishes.
*/
- EventHandle _resetElectionInfoOnProtocolVersionUpgrade(const ReplicaSetConfig& oldConfig,
- const ReplicaSetConfig& newConfig);
+ EventHandle _resetElectionInfoOnProtocolVersionUpgrade(const ReplSetConfig& oldConfig,
+ const ReplSetConfig& newConfig);
/**
* Schedules work and returns handle to callback.
@@ -1280,7 +1280,7 @@ private:
// The current ReplicaSet configuration object, including the information about tag groups
// that is used to satisfy write concern requests with named gle modes.
- ReplicaSetConfig _rsConfig; // (MX)
+ ReplSetConfig _rsConfig; // (MX)
// This member's index position in the current config.
int _selfIndex; // (MX)
diff --git a/src/mongo/db/repl/replication_coordinator_impl_elect_test.cpp b/src/mongo/db/repl/replication_coordinator_impl_elect_test.cpp
index 5d3514af2e1..89325f7f424 100644
--- a/src/mongo/db/repl/replication_coordinator_impl_elect_test.cpp
+++ b/src/mongo/db/repl/replication_coordinator_impl_elect_test.cpp
@@ -33,9 +33,9 @@
#include "mongo/db/jsobj.h"
#include "mongo/db/operation_context_noop.h"
#include "mongo/db/repl/is_master_response.h"
+#include "mongo/db/repl/repl_set_config.h"
#include "mongo/db/repl/repl_set_heartbeat_args.h"
#include "mongo/db/repl/repl_set_heartbeat_response.h"
-#include "mongo/db/repl/replica_set_config.h"
#include "mongo/db/repl/replication_coordinator_external_state_mock.h"
#include "mongo/db/repl/replication_coordinator_impl.h"
#include "mongo/db/repl/replication_coordinator_test_fixture.h"
@@ -64,7 +64,7 @@ void ReplCoordElectTest::assertStartSuccess(const BSONObj& configDoc, const Host
void ReplCoordElectTest::simulateFreshEnoughForElectability() {
ReplicationCoordinatorImpl* replCoord = getReplCoord();
- ReplicaSetConfig rsConfig = replCoord->getReplicaSetConfig_forTest();
+ ReplSetConfig rsConfig = replCoord->getReplicaSetConfig_forTest();
NetworkInterfaceMock* net = getNet();
net->enterNetwork();
for (int i = 0; i < rsConfig.getNumMembers() - 1; ++i) {
@@ -244,7 +244,7 @@ TEST_F(ReplCoordElectTest, ElectionFailsWhenOneNodeVotesNay) {
<< BSON("_id" << 3 << "host"
<< "node3:12345")));
assertStartSuccess(configObj, HostAndPort("node1", 12345));
- ReplicaSetConfig config = assertMakeRSConfig(configObj);
+ ReplSetConfig config = assertMakeRSConfig(configObj);
OperationContextNoop txn;
OpTime time1(Timestamp(100, 1), 0);
@@ -291,7 +291,7 @@ TEST_F(ReplCoordElectTest, VotesWithStringValuesAreNotCountedAsYeas) {
<< BSON("_id" << 3 << "host"
<< "node3:12345")));
assertStartSuccess(configObj, HostAndPort("node1", 12345));
- ReplicaSetConfig config = assertMakeRSConfig(configObj);
+ ReplSetConfig config = assertMakeRSConfig(configObj);
OperationContextNoop txn;
OpTime time1(Timestamp(100, 1), 0);
@@ -339,7 +339,7 @@ TEST_F(ReplCoordElectTest, ElectionsAbortWhenNodeTransitionsToRollbackState) {
<< BSON("_id" << 3 << "host"
<< "node3:12345")));
assertStartSuccess(configObj, HostAndPort("node1", 12345));
- ReplicaSetConfig config = assertMakeRSConfig(configObj);
+ ReplSetConfig config = assertMakeRSConfig(configObj);
OperationContextNoop txn;
OpTime time1(Timestamp(100, 1), 0);
@@ -390,7 +390,7 @@ TEST_F(ReplCoordElectTest, NodeWillNotStandForElectionDuringHeartbeatReconfig) {
NetworkInterfaceMock* net = getNet();
net->enterNetwork();
ReplSetHeartbeatResponse hbResp2;
- ReplicaSetConfig config;
+ ReplSetConfig config;
config.initialize(BSON("_id"
<< "mySet"
<< "version"
@@ -426,7 +426,7 @@ TEST_F(ReplCoordElectTest, NodeWillNotStandForElectionDuringHeartbeatReconfig) {
// receive sufficient heartbeats to trigger an election
ReplicationCoordinatorImpl* replCoord = getReplCoord();
- ReplicaSetConfig rsConfig = replCoord->getReplicaSetConfig_forTest();
+ ReplSetConfig rsConfig = replCoord->getReplicaSetConfig_forTest();
net->enterNetwork();
for (int i = 0; i < 2; ++i) {
const NetworkInterfaceMock::NetworkOperationIterator noi = net->getNextReadyRequest();
@@ -473,7 +473,7 @@ TEST_F(ReplCoordElectTest, StepsDownRemoteIfNodeHasHigherPriorityThanCurrentPrim
<< BSON("_id" << 3 << "host"
<< "node3:12345")));
assertStartSuccess(configObj, HostAndPort("node1", 12345));
- ReplicaSetConfig config = assertMakeRSConfig(configObj);
+ ReplSetConfig config = assertMakeRSConfig(configObj);
auto replCoord = getReplCoord();
diff --git a/src/mongo/db/repl/replication_coordinator_impl_elect_v1_test.cpp b/src/mongo/db/repl/replication_coordinator_impl_elect_v1_test.cpp
index 8fd94ed8d00..e5fa8aa73d1 100644
--- a/src/mongo/db/repl/replication_coordinator_impl_elect_v1_test.cpp
+++ b/src/mongo/db/repl/replication_coordinator_impl_elect_v1_test.cpp
@@ -33,9 +33,9 @@
#include "mongo/db/jsobj.h"
#include "mongo/db/operation_context_noop.h"
#include "mongo/db/repl/is_master_response.h"
+#include "mongo/db/repl/repl_set_config.h"
#include "mongo/db/repl/repl_set_heartbeat_args_v1.h"
#include "mongo/db/repl/repl_set_heartbeat_response.h"
-#include "mongo/db/repl/replica_set_config.h"
#include "mongo/db/repl/replication_coordinator_external_state_mock.h"
#include "mongo/db/repl/replication_coordinator_impl.h"
#include "mongo/db/repl/replication_coordinator_test_fixture.h"
@@ -66,7 +66,7 @@ TEST_F(ReplCoordTest, RandomizedElectionOffsetWithinProperBounds) {
<< BSON("_id" << 3 << "host"
<< "node3:12345")));
assertStartSuccess(configObj, HostAndPort("node1", 12345));
- ReplicaSetConfig config = assertMakeRSConfig(configObj);
+ ReplSetConfig config = assertMakeRSConfig(configObj);
Milliseconds electionTimeout = config.getElectionTimeoutPeriod();
long long randomOffsetUpperBound = durationCount<Milliseconds>(electionTimeout) *
@@ -330,7 +330,7 @@ TEST_F(ReplCoordTest, ElectionFailsWhenInsufficientVotesAreReceivedDuringDryRun)
<< "protocolVersion"
<< 1);
assertStartSuccess(configObj, HostAndPort("node1", 12345));
- ReplicaSetConfig config = assertMakeRSConfig(configObj);
+ ReplSetConfig config = assertMakeRSConfig(configObj);
OperationContextNoop txn;
OpTime time1(Timestamp(100, 1), 0);
@@ -389,7 +389,7 @@ TEST_F(ReplCoordTest, ElectionFailsWhenDryRunResponseContainsANewerTerm) {
<< "protocolVersion"
<< 1);
assertStartSuccess(configObj, HostAndPort("node1", 12345));
- ReplicaSetConfig config = assertMakeRSConfig(configObj);
+ ReplSetConfig config = assertMakeRSConfig(configObj);
OperationContextNoop txn;
OpTime time1(Timestamp(100, 1), 0);
@@ -469,7 +469,7 @@ TEST_F(ReplCoordTest, NodeWillNotStandForElectionDuringHeartbeatReconfig) {
NetworkInterfaceMock* net = getNet();
net->enterNetwork();
ReplSetHeartbeatResponse hbResp2;
- ReplicaSetConfig config;
+ ReplSetConfig config;
config.initialize(BSON("_id"
<< "mySet"
<< "version"
@@ -504,7 +504,7 @@ TEST_F(ReplCoordTest, NodeWillNotStandForElectionDuringHeartbeatReconfig) {
// receive sufficient heartbeats to allow the node to see a majority.
ReplicationCoordinatorImpl* replCoord = getReplCoord();
- ReplicaSetConfig rsConfig = replCoord->getReplicaSetConfig_forTest();
+ ReplSetConfig rsConfig = replCoord->getReplicaSetConfig_forTest();
net->enterNetwork();
for (int i = 0; i < 2; ++i) {
const NetworkInterfaceMock::NetworkOperationIterator noi = net->getNextReadyRequest();
@@ -566,7 +566,7 @@ TEST_F(ReplCoordTest, ElectionFailsWhenInsufficientVotesAreReceivedDuringRequest
<< "protocolVersion"
<< 1);
assertStartSuccess(configObj, HostAndPort("node1", 12345));
- ReplicaSetConfig config = assertMakeRSConfig(configObj);
+ ReplSetConfig config = assertMakeRSConfig(configObj);
OperationContextNoop txn;
OpTime time1(Timestamp(100, 1), 0);
@@ -617,7 +617,7 @@ TEST_F(ReplCoordTest, ElectionsAbortWhenNodeTransitionsToRollbackState) {
<< "protocolVersion"
<< 1);
assertStartSuccess(configObj, HostAndPort("node1", 12345));
- ReplicaSetConfig config = assertMakeRSConfig(configObj);
+ ReplSetConfig config = assertMakeRSConfig(configObj);
OperationContextNoop txn;
OpTime time1(Timestamp(100, 1), 0);
@@ -655,7 +655,7 @@ TEST_F(ReplCoordTest, ElectionFailsWhenVoteRequestResponseContainsANewerTerm) {
<< "protocolVersion"
<< 1);
assertStartSuccess(configObj, HostAndPort("node1", 12345));
- ReplicaSetConfig config = assertMakeRSConfig(configObj);
+ ReplSetConfig config = assertMakeRSConfig(configObj);
OperationContextNoop txn;
OpTime time1(Timestamp(100, 1), 0);
@@ -711,7 +711,7 @@ TEST_F(ReplCoordTest, ElectionFailsWhenTermChangesDuringDryRun) {
<< 1);
assertStartSuccess(configObj, HostAndPort("node1", 12345));
- ReplicaSetConfig config = assertMakeRSConfig(configObj);
+ ReplSetConfig config = assertMakeRSConfig(configObj);
OperationContextNoop txn;
OpTime time1(Timestamp(100, 1), 0);
@@ -750,7 +750,7 @@ TEST_F(ReplCoordTest, ElectionFailsWhenTermChangesDuringActualElection) {
<< "protocolVersion"
<< 1);
assertStartSuccess(configObj, HostAndPort("node1", 12345));
- ReplicaSetConfig config = assertMakeRSConfig(configObj);
+ ReplSetConfig config = assertMakeRSConfig(configObj);
OperationContextNoop txn;
OpTime time1(Timestamp(100, 1), 0);
@@ -795,7 +795,7 @@ public:
* Verify that a given priority takeover delay is valid. Takeover delays are
* verified in terms of bounds since the delay value is randomized.
*/
- void assertValidTakeoverDelay(ReplicaSetConfig config,
+ void assertValidTakeoverDelay(ReplSetConfig config,
Date_t now,
Date_t priorityTakeoverTime,
int nodeIndex) {
@@ -828,7 +828,7 @@ public:
*
* Returns the time that it ran until, which should always be equal to 'until'.
*/
- Date_t respondToHeartbeatsUntil(const ReplicaSetConfig& config,
+ Date_t respondToHeartbeatsUntil(const ReplSetConfig& config,
Date_t until,
const HostAndPort& primaryHostAndPort,
const OpTime& otherNodesOpTime) {
@@ -883,7 +883,7 @@ private:
*
* Intended as a helper function only.
*/
- void _respondToHeartbeatsNow(const ReplicaSetConfig& config,
+ void _respondToHeartbeatsNow(const ReplSetConfig& config,
const HostAndPort& primaryHostAndPort,
const OpTime& otherNodesOpTime) {
@@ -937,7 +937,7 @@ TEST_F(PriorityTakeoverTest, SchedulesPriorityTakeoverIfNodeHasHigherPriorityTha
<< "protocolVersion"
<< 1);
assertStartSuccess(configObj, HostAndPort("node1", 12345));
- ReplicaSetConfig config = assertMakeRSConfig(configObj);
+ ReplSetConfig config = assertMakeRSConfig(configObj);
auto replCoord = getReplCoord();
auto now = getNet()->now();
@@ -984,7 +984,7 @@ TEST_F(PriorityTakeoverTest, SuccessfulPriorityTakeover) {
<< "protocolVersion"
<< 1);
assertStartSuccess(configObj, HostAndPort("node1", 12345));
- ReplicaSetConfig config = assertMakeRSConfig(configObj);
+ ReplSetConfig config = assertMakeRSConfig(configObj);
auto replCoord = getReplCoord();
auto now = getNet()->now();
@@ -1036,7 +1036,7 @@ TEST_F(PriorityTakeoverTest, DontCallForPriorityTakeoverWhenLaggedSameSecond) {
<< "protocolVersion"
<< 1);
assertStartSuccess(configObj, HostAndPort("node1", 12345));
- ReplicaSetConfig config = assertMakeRSConfig(configObj);
+ ReplSetConfig config = assertMakeRSConfig(configObj);
HostAndPort primaryHostAndPort("node2", 12345);
auto replCoord = getReplCoord();
@@ -1112,7 +1112,7 @@ TEST_F(PriorityTakeoverTest, DontCallForPriorityTakeoverWhenLaggedDifferentSecon
<< "protocolVersion"
<< 1);
assertStartSuccess(configObj, HostAndPort("node1", 12345));
- ReplicaSetConfig config = assertMakeRSConfig(configObj);
+ ReplSetConfig config = assertMakeRSConfig(configObj);
HostAndPort primaryHostAndPort("node2", 12345);
auto replCoord = getReplCoord();
@@ -1279,7 +1279,7 @@ protected:
using FreshnessScanFn = stdx::function<void(const NetworkOpIter)>;
void replyToHeartbeatRequestAsSecondaries(const NetworkOpIter noi) {
- ReplicaSetConfig rsConfig = getReplCoord()->getReplicaSetConfig_forTest();
+ ReplSetConfig rsConfig = getReplCoord()->getReplicaSetConfig_forTest();
ReplSetHeartbeatResponse hbResp;
hbResp.setSetName(rsConfig.getReplSetName());
hbResp.setState(MemberState::RS_SECONDARY);
@@ -1337,7 +1337,7 @@ protected:
}
}
- ReplicaSetConfig setUp3NodeReplSetAndRunForElection(OpTime opTime) {
+ ReplSetConfig setUp3NodeReplSetAndRunForElection(OpTime opTime) {
BSONObj configObj = BSON("_id"
<< "mySet"
<< "version"
@@ -1354,7 +1354,7 @@ protected:
<< "settings"
<< BSON("catchUpTimeoutMillis" << 5000));
assertStartSuccess(configObj, HostAndPort("node1", 12345));
- ReplicaSetConfig config = assertMakeRSConfig(configObj);
+ ReplSetConfig config = assertMakeRSConfig(configObj);
getReplCoord()->setMyLastAppliedOpTime(opTime);
getReplCoord()->setMyLastDurableOpTime(opTime);
@@ -1421,7 +1421,7 @@ protected:
TEST_F(PrimaryCatchUpTest, PrimaryDoNotNeedToCatchUp) {
startCapturingLogMessages();
OpTime time1(Timestamp(100, 1), 0);
- ReplicaSetConfig config = setUp3NodeReplSetAndRunForElection(time1);
+ ReplSetConfig config = setUp3NodeReplSetAndRunForElection(time1);
processFreshnessScanRequests([this](const NetworkOpIter noi) {
getNet()->scheduleResponse(noi, getNet()->now(), makeFreshnessScanResponse(OpTime()));
@@ -1438,7 +1438,7 @@ TEST_F(PrimaryCatchUpTest, PrimaryFreshnessScanTimeout) {
startCapturingLogMessages();
OpTime time1(Timestamp(100, 1), 0);
- ReplicaSetConfig config = setUp3NodeReplSetAndRunForElection(time1);
+ ReplSetConfig config = setUp3NodeReplSetAndRunForElection(time1);
processFreshnessScanRequests([this](const NetworkOpIter noi) {
auto request = noi->getRequest();
@@ -1462,7 +1462,7 @@ TEST_F(PrimaryCatchUpTest, PrimaryCatchUpSucceeds) {
OpTime time1(Timestamp(100, 1), 0);
OpTime time2(Timestamp(100, 2), 0);
- ReplicaSetConfig config = setUp3NodeReplSetAndRunForElection(time1);
+ ReplSetConfig config = setUp3NodeReplSetAndRunForElection(time1);
processFreshnessScanRequests([this, time2](const NetworkOpIter noi) {
auto net = getNet();
@@ -1491,7 +1491,7 @@ TEST_F(PrimaryCatchUpTest, PrimaryCatchUpTimeout) {
OpTime time1(Timestamp(100, 1), 0);
OpTime time2(Timestamp(100, 2), 0);
- ReplicaSetConfig config = setUp3NodeReplSetAndRunForElection(time1);
+ ReplSetConfig config = setUp3NodeReplSetAndRunForElection(time1);
// The new primary learns of the latest OpTime.
processFreshnessScanRequests([this, time2](const NetworkOpIter noi) {
@@ -1514,7 +1514,7 @@ TEST_F(PrimaryCatchUpTest, PrimaryStepsDownDuringFreshnessScan) {
OpTime time1(Timestamp(100, 1), 0);
OpTime time2(Timestamp(100, 2), 0);
- ReplicaSetConfig config = setUp3NodeReplSetAndRunForElection(time1);
+ ReplSetConfig config = setUp3NodeReplSetAndRunForElection(time1);
processFreshnessScanRequests([this, time2](const NetworkOpIter noi) {
auto request = noi->getRequest();
@@ -1540,7 +1540,7 @@ TEST_F(PrimaryCatchUpTest, PrimaryStepsDownDuringCatchUp) {
OpTime time1(Timestamp(100, 1), 0);
OpTime time2(Timestamp(100, 2), 0);
- ReplicaSetConfig config = setUp3NodeReplSetAndRunForElection(time1);
+ ReplSetConfig config = setUp3NodeReplSetAndRunForElection(time1);
processFreshnessScanRequests([this, time2](const NetworkOpIter noi) {
auto net = getNet();
@@ -1573,7 +1573,7 @@ TEST_F(PrimaryCatchUpTest, PrimaryStepsDownDuringDrainMode) {
OpTime time1(Timestamp(100, 1), 0);
OpTime time2(Timestamp(100, 2), 0);
- ReplicaSetConfig config = setUp3NodeReplSetAndRunForElection(time1);
+ ReplSetConfig config = setUp3NodeReplSetAndRunForElection(time1);
processFreshnessScanRequests([this, time2](const NetworkOpIter noi) {
auto net = getNet();
diff --git a/src/mongo/db/repl/replication_coordinator_impl_heartbeat.cpp b/src/mongo/db/repl/replication_coordinator_impl_heartbeat.cpp
index b1c2f4a474a..dfff8f92030 100644
--- a/src/mongo/db/repl/replication_coordinator_impl_heartbeat.cpp
+++ b/src/mongo/db/repl/replication_coordinator_impl_heartbeat.cpp
@@ -37,10 +37,10 @@
#include "mongo/db/repl/elect_cmd_runner.h"
#include "mongo/db/repl/freshness_checker.h"
#include "mongo/db/repl/heartbeat_response_action.h"
+#include "mongo/db/repl/repl_set_config_checks.h"
#include "mongo/db/repl/repl_set_heartbeat_args.h"
#include "mongo/db/repl/repl_set_heartbeat_args_v1.h"
#include "mongo/db/repl/repl_set_heartbeat_response.h"
-#include "mongo/db/repl/replica_set_config_checks.h"
#include "mongo/db/repl/replication_coordinator_impl.h"
#include "mongo/db/repl/replication_executor.h"
#include "mongo/db/repl/topology_coordinator.h"
@@ -398,7 +398,7 @@ void ReplicationCoordinatorImpl::_stepDownFinish(
_replExecutor.signalEvent(finishedEvent);
}
-void ReplicationCoordinatorImpl::_scheduleHeartbeatReconfig(const ReplicaSetConfig& newConfig) {
+void ReplicationCoordinatorImpl::_scheduleHeartbeatReconfig(const ReplSetConfig& newConfig) {
stdx::lock_guard<stdx::mutex> lk(_mutex);
if (_inShutdown) {
return;
@@ -446,7 +446,7 @@ void ReplicationCoordinatorImpl::_scheduleHeartbeatReconfig(const ReplicaSetConf
}
void ReplicationCoordinatorImpl::_heartbeatReconfigAfterElectionCanceled(
- const ReplicationExecutor::CallbackArgs& cbData, const ReplicaSetConfig& newConfig) {
+ const ReplicationExecutor::CallbackArgs& cbData, const ReplSetConfig& newConfig) {
if (cbData.status == ErrorCodes::CallbackCanceled) {
return;
}
@@ -465,7 +465,7 @@ void ReplicationCoordinatorImpl::_heartbeatReconfigAfterElectionCanceled(
}
void ReplicationCoordinatorImpl::_heartbeatReconfigStore(
- const ReplicationExecutor::CallbackArgs& cbd, const ReplicaSetConfig& newConfig) {
+ const ReplicationExecutor::CallbackArgs& cbd, const ReplSetConfig& newConfig) {
if (cbd.status.code() == ErrorCodes::CallbackCanceled) {
log() << "The callback to persist the replica set configuration was canceled - "
<< "the configuration was not persisted but was used: " << newConfig.toBSON();
@@ -546,7 +546,7 @@ void ReplicationCoordinatorImpl::_heartbeatReconfigStore(
void ReplicationCoordinatorImpl::_heartbeatReconfigFinish(
const ReplicationExecutor::CallbackArgs& cbData,
- const ReplicaSetConfig& newConfig,
+ const ReplSetConfig& newConfig,
StatusWith<int> myIndex) {
if (cbData.status == ErrorCodes::CallbackCanceled) {
return;
@@ -615,7 +615,7 @@ void ReplicationCoordinatorImpl::_heartbeatReconfigFinish(
}
myIndex = StatusWith<int>(-1);
}
- const ReplicaSetConfig oldConfig = _rsConfig;
+ const ReplSetConfig oldConfig = _rsConfig;
// If we do not have an index, we should pass -1 as our index to avoid falsely adding ourself to
// the data structures inside of the TopologyCoordinator.
const int myIndexValue = myIndex.getStatus().isOK() ? myIndex.getValue() : -1;
diff --git a/src/mongo/db/repl/replication_coordinator_impl_heartbeat_test.cpp b/src/mongo/db/repl/replication_coordinator_impl_heartbeat_test.cpp
index 91697d5ad01..69c9b6541c6 100644
--- a/src/mongo/db/repl/replication_coordinator_impl_heartbeat_test.cpp
+++ b/src/mongo/db/repl/replication_coordinator_impl_heartbeat_test.cpp
@@ -32,9 +32,9 @@
#include "mongo/db/jsobj.h"
#include "mongo/db/operation_context_noop.h"
+#include "mongo/db/repl/repl_set_config.h"
#include "mongo/db/repl/repl_set_heartbeat_args.h"
#include "mongo/db/repl/repl_set_heartbeat_response.h"
-#include "mongo/db/repl/replica_set_config.h"
#include "mongo/db/repl/replication_coordinator_external_state_mock.h"
#include "mongo/db/repl/replication_coordinator_impl.h"
#include "mongo/db/repl/replication_coordinator_test_fixture.h"
@@ -55,7 +55,7 @@ class ReplCoordHBTest : public ReplCoordTest {
protected:
void assertStartSuccess(const BSONObj& configDoc, const HostAndPort& selfHost);
void assertMemberState(MemberState expected, std::string msg = "");
- ReplSetHeartbeatResponse receiveHeartbeatFrom(const ReplicaSetConfig& rsConfig,
+ ReplSetHeartbeatResponse receiveHeartbeatFrom(const ReplSetConfig& rsConfig,
int sourceId,
const HostAndPort& source);
};
@@ -70,7 +70,7 @@ void ReplCoordHBTest::assertMemberState(const MemberState expected, std::string
<< " but found " << actual.toString() << " - " << msg;
}
-ReplSetHeartbeatResponse ReplCoordHBTest::receiveHeartbeatFrom(const ReplicaSetConfig& rsConfig,
+ReplSetHeartbeatResponse ReplCoordHBTest::receiveHeartbeatFrom(const ReplSetConfig& rsConfig,
int sourceId,
const HostAndPort& source) {
ReplSetHeartbeatArgs hbArgs;
@@ -88,17 +88,17 @@ ReplSetHeartbeatResponse ReplCoordHBTest::receiveHeartbeatFrom(const ReplicaSetC
TEST_F(ReplCoordHBTest, NodeJoinsExistingReplSetWhenReceivingAConfigContainingTheNodeViaHeartbeat) {
logger::globalLogDomain()->setMinimumLoggedSeverity(logger::LogSeverity::Debug(3));
- ReplicaSetConfig rsConfig = assertMakeRSConfigV0(BSON("_id"
- << "mySet"
- << "version"
- << 3
- << "members"
- << BSON_ARRAY(BSON("_id" << 1 << "host"
- << "h1:1")
- << BSON("_id" << 2 << "host"
- << "h2:1")
- << BSON("_id" << 3 << "host"
- << "h3:1"))));
+ ReplSetConfig rsConfig = assertMakeRSConfigV0(BSON("_id"
+ << "mySet"
+ << "version"
+ << 3
+ << "members"
+ << BSON_ARRAY(BSON("_id" << 1 << "host"
+ << "h1:1")
+ << BSON("_id" << 2 << "host"
+ << "h2:1")
+ << BSON("_id" << 3 << "host"
+ << "h3:1"))));
init("mySet");
addSelf(HostAndPort("h2", 1));
const Date_t startDate = getNet()->now();
@@ -140,7 +140,7 @@ TEST_F(ReplCoordHBTest, NodeJoinsExistingReplSetWhenReceivingAConfigContainingTh
assertMemberState(MemberState::RS_STARTUP2);
OperationContextNoop txn;
- ReplicaSetConfig storedConfig;
+ ReplSetConfig storedConfig;
ASSERT_OK(storedConfig.initialize(
unittest::assertGet(getExternalState()->loadLocalConfigDocument(&txn))));
ASSERT_OK(storedConfig.validate());
@@ -154,17 +154,17 @@ TEST_F(ReplCoordHBTest,
// Tests that a node in RS_STARTUP will not transition to RS_REMOVED if it receives a
// configuration that does not contain it.
logger::globalLogDomain()->setMinimumLoggedSeverity(logger::LogSeverity::Debug(3));
- ReplicaSetConfig rsConfig = assertMakeRSConfigV0(BSON("_id"
- << "mySet"
- << "version"
- << 3
- << "members"
- << BSON_ARRAY(BSON("_id" << 1 << "host"
- << "h1:1")
- << BSON("_id" << 2 << "host"
- << "h2:1")
- << BSON("_id" << 3 << "host"
- << "h3:1"))));
+ ReplSetConfig rsConfig = assertMakeRSConfigV0(BSON("_id"
+ << "mySet"
+ << "version"
+ << 3
+ << "members"
+ << BSON_ARRAY(BSON("_id" << 1 << "host"
+ << "h1:1")
+ << BSON("_id" << 2 << "host"
+ << "h2:1")
+ << BSON("_id" << 3 << "host"
+ << "h3:1"))));
init("mySet");
addSelf(HostAndPort("h4", 1));
const Date_t startDate = getNet()->now();
diff --git a/src/mongo/db/repl/replication_coordinator_impl_heartbeat_v1_test.cpp b/src/mongo/db/repl/replication_coordinator_impl_heartbeat_v1_test.cpp
index 1cc20369998..ccc53d0bff9 100644
--- a/src/mongo/db/repl/replication_coordinator_impl_heartbeat_v1_test.cpp
+++ b/src/mongo/db/repl/replication_coordinator_impl_heartbeat_v1_test.cpp
@@ -33,9 +33,9 @@
#include "mongo/bson/json.h"
#include "mongo/db/jsobj.h"
#include "mongo/db/operation_context_noop.h"
+#include "mongo/db/repl/repl_set_config.h"
#include "mongo/db/repl/repl_set_heartbeat_args.h"
#include "mongo/db/repl/repl_set_heartbeat_args_v1.h"
-#include "mongo/db/repl/replica_set_config.h"
#include "mongo/db/repl/replication_coordinator_external_state_mock.h"
#include "mongo/db/repl/replication_coordinator_impl.h"
#include "mongo/db/repl/replication_coordinator_test_fixture.h"
@@ -56,7 +56,7 @@ using executor::RemoteCommandResponse;
class ReplCoordHBV1Test : public ReplCoordTest {
protected:
void assertMemberState(MemberState expected, std::string msg = "");
- ReplSetHeartbeatResponse receiveHeartbeatFrom(const ReplicaSetConfig& rsConfig,
+ ReplSetHeartbeatResponse receiveHeartbeatFrom(const ReplSetConfig& rsConfig,
int sourceId,
const HostAndPort& source);
};
@@ -67,7 +67,7 @@ void ReplCoordHBV1Test::assertMemberState(const MemberState expected, std::strin
<< " but found " << actual.toString() << " - " << msg;
}
-ReplSetHeartbeatResponse ReplCoordHBV1Test::receiveHeartbeatFrom(const ReplicaSetConfig& rsConfig,
+ReplSetHeartbeatResponse ReplCoordHBV1Test::receiveHeartbeatFrom(const ReplSetConfig& rsConfig,
int sourceId,
const HostAndPort& source) {
ReplSetHeartbeatArgsV1 hbArgs;
@@ -86,19 +86,19 @@ ReplSetHeartbeatResponse ReplCoordHBV1Test::receiveHeartbeatFrom(const ReplicaSe
TEST_F(ReplCoordHBV1Test,
NodeJoinsExistingReplSetWhenReceivingAConfigContainingTheNodeViaHeartbeat) {
logger::globalLogDomain()->setMinimumLoggedSeverity(logger::LogSeverity::Debug(3));
- ReplicaSetConfig rsConfig = assertMakeRSConfig(BSON("_id"
- << "mySet"
- << "version"
- << 3
- << "members"
- << BSON_ARRAY(BSON("_id" << 1 << "host"
- << "h1:1")
- << BSON("_id" << 2 << "host"
- << "h2:1")
- << BSON("_id" << 3 << "host"
- << "h3:1"))
- << "protocolVersion"
- << 1));
+ ReplSetConfig rsConfig = assertMakeRSConfig(BSON("_id"
+ << "mySet"
+ << "version"
+ << 3
+ << "members"
+ << BSON_ARRAY(BSON("_id" << 1 << "host"
+ << "h1:1")
+ << BSON("_id" << 2 << "host"
+ << "h2:1")
+ << BSON("_id" << 3 << "host"
+ << "h3:1"))
+ << "protocolVersion"
+ << 1));
init("mySet");
addSelf(HostAndPort("h2", 1));
const Date_t startDate = getNet()->now();
@@ -139,7 +139,7 @@ TEST_F(ReplCoordHBV1Test,
assertMemberState(MemberState::RS_STARTUP2);
OperationContextNoop txn;
- ReplicaSetConfig storedConfig;
+ ReplSetConfig storedConfig;
ASSERT_OK(storedConfig.initialize(
unittest::assertGet(getExternalState()->loadLocalConfigDocument(&txn))));
ASSERT_OK(storedConfig.validate());
@@ -153,21 +153,21 @@ TEST_F(ReplCoordHBV1Test,
TEST_F(ReplCoordHBV1Test,
ArbiterJoinsExistingReplSetWhenReceivingAConfigContainingTheArbiterViaHeartbeat) {
logger::globalLogDomain()->setMinimumLoggedSeverity(logger::LogSeverity::Debug(3));
- ReplicaSetConfig rsConfig = assertMakeRSConfig(BSON("_id"
- << "mySet"
- << "version"
- << 3
- << "members"
- << BSON_ARRAY(BSON("_id" << 1 << "host"
- << "h1:1")
- << BSON("_id" << 2 << "host"
- << "h2:1"
- << "arbiterOnly"
- << true)
- << BSON("_id" << 3 << "host"
- << "h3:1"))
- << "protocolVersion"
- << 1));
+ ReplSetConfig rsConfig = assertMakeRSConfig(BSON("_id"
+ << "mySet"
+ << "version"
+ << 3
+ << "members"
+ << BSON_ARRAY(BSON("_id" << 1 << "host"
+ << "h1:1")
+ << BSON("_id" << 2 << "host"
+ << "h2:1"
+ << "arbiterOnly"
+ << true)
+ << BSON("_id" << 3 << "host"
+ << "h3:1"))
+ << "protocolVersion"
+ << 1));
init("mySet");
addSelf(HostAndPort("h2", 1));
const Date_t startDate = getNet()->now();
@@ -208,7 +208,7 @@ TEST_F(ReplCoordHBV1Test,
assertMemberState(MemberState::RS_ARBITER);
OperationContextNoop txn;
- ReplicaSetConfig storedConfig;
+ ReplSetConfig storedConfig;
ASSERT_OK(storedConfig.initialize(
unittest::assertGet(getExternalState()->loadLocalConfigDocument(&txn))));
ASSERT_OK(storedConfig.validate());
@@ -224,19 +224,19 @@ TEST_F(ReplCoordHBV1Test,
// Tests that a node in RS_STARTUP will not transition to RS_REMOVED if it receives a
// configuration that does not contain it.
logger::globalLogDomain()->setMinimumLoggedSeverity(logger::LogSeverity::Debug(3));
- ReplicaSetConfig rsConfig = assertMakeRSConfig(BSON("_id"
- << "mySet"
- << "version"
- << 3
- << "members"
- << BSON_ARRAY(BSON("_id" << 1 << "host"
- << "h1:1")
- << BSON("_id" << 2 << "host"
- << "h2:1")
- << BSON("_id" << 3 << "host"
- << "h3:1"))
- << "protocolVersion"
- << 1));
+ ReplSetConfig rsConfig = assertMakeRSConfig(BSON("_id"
+ << "mySet"
+ << "version"
+ << 3
+ << "members"
+ << BSON_ARRAY(BSON("_id" << 1 << "host"
+ << "h1:1")
+ << BSON("_id" << 2 << "host"
+ << "h2:1")
+ << BSON("_id" << 3 << "host"
+ << "h3:1"))
+ << "protocolVersion"
+ << 1));
init("mySet");
addSelf(HostAndPort("h4", 1));
const Date_t startDate = getNet()->now();
diff --git a/src/mongo/db/repl/replication_coordinator_impl_reconfig_test.cpp b/src/mongo/db/repl/replication_coordinator_impl_reconfig_test.cpp
index c6ca9bf9800..69c5f2c6fb9 100644
--- a/src/mongo/db/repl/replication_coordinator_impl_reconfig_test.cpp
+++ b/src/mongo/db/repl/replication_coordinator_impl_reconfig_test.cpp
@@ -32,9 +32,9 @@
#include "mongo/db/jsobj.h"
#include "mongo/db/operation_context_noop.h"
+#include "mongo/db/repl/repl_set_config.h"
#include "mongo/db/repl/repl_set_heartbeat_args.h"
#include "mongo/db/repl/repl_set_heartbeat_response.h"
-#include "mongo/db/repl/replica_set_config.h"
#include "mongo/db/repl/replication_coordinator.h" // ReplSetReconfigArgs
#include "mongo/db/repl/replication_coordinator_external_state_mock.h"
#include "mongo/db/repl/replication_coordinator_impl.h"
@@ -129,7 +129,7 @@ TEST_F(ReplCoordTest, NodeReturnsInvalidReplicaSetConfigWhenReconfigReceivedWith
<< "arbiterOnly"
<< true)));
const auto txn = makeOperationContext();
- // ErrorCodes::BadValue should be propagated from ReplicaSetConfig::initialize()
+ // ErrorCodes::BadValue should be propagated from ReplSetConfig::initialize()
ASSERT_EQUALS(ErrorCodes::InvalidReplicaSetConfig,
getReplCoord()->processReplSetReconfig(txn.get(), args, &result));
ASSERT_TRUE(result.obj().isEmpty());
@@ -513,7 +513,7 @@ TEST_F(
NetworkInterfaceMock* net = getNet();
net->enterNetwork();
ReplSetHeartbeatResponse hbResp2;
- ReplicaSetConfig config;
+ ReplSetConfig config;
config.initialize(BSON("_id"
<< "mySet"
<< "version"
@@ -581,7 +581,7 @@ TEST_F(ReplCoordTest, NodeDoesNotAcceptHeartbeatReconfigWhileInTheMidstOfReconfi
net->runUntil(net->now() + Seconds(10)); // run until we've sent a heartbeat request
const NetworkInterfaceMock::NetworkOperationIterator noi = net->getNextReadyRequest();
ReplSetHeartbeatResponse hbResp;
- ReplicaSetConfig config;
+ ReplSetConfig config;
config.initialize(BSON("_id"
<< "mySet"
<< "version"
diff --git a/src/mongo/db/repl/replication_coordinator_impl_test.cpp b/src/mongo/db/repl/replication_coordinator_impl_test.cpp
index 5cea5d37c1b..b44dc3b4e40 100644
--- a/src/mongo/db/repl/replication_coordinator_impl_test.cpp
+++ b/src/mongo/db/repl/replication_coordinator_impl_test.cpp
@@ -44,11 +44,11 @@
#include "mongo/db/repl/optime.h"
#include "mongo/db/repl/read_concern_args.h"
#include "mongo/db/repl/repl_client_info.h"
+#include "mongo/db/repl/repl_set_config.h"
#include "mongo/db/repl/repl_set_heartbeat_args.h"
#include "mongo/db/repl/repl_set_heartbeat_args_v1.h"
#include "mongo/db/repl/repl_set_request_votes_args.h"
#include "mongo/db/repl/repl_settings.h"
-#include "mongo/db/repl/replica_set_config.h"
#include "mongo/db/repl/replication_coordinator.h"
#include "mongo/db/repl/replication_coordinator_external_state_mock.h"
#include "mongo/db/repl/replication_coordinator_impl.h"
@@ -4349,7 +4349,7 @@ TEST_F(ReplCoordTest,
// Respond to node1's heartbeat command with a config that excludes node1.
ReplSetHeartbeatResponse hbResp;
- ReplicaSetConfig config;
+ ReplSetConfig config;
config.initialize(BSON("_id"
<< "mySet"
<< "protocolVersion"
diff --git a/src/mongo/db/repl/replication_coordinator_mock.cpp b/src/mongo/db/repl/replication_coordinator_mock.cpp
index fc6144cff60..f6ee65745fc 100644
--- a/src/mongo/db/repl/replication_coordinator_mock.cpp
+++ b/src/mongo/db/repl/replication_coordinator_mock.cpp
@@ -233,11 +233,11 @@ StatusWith<BSONObj> ReplicationCoordinatorMock::prepareReplSetUpdatePositionComm
return cmdBuilder.obj();
}
-ReplicaSetConfig ReplicationCoordinatorMock::getConfig() const {
+ReplSetConfig ReplicationCoordinatorMock::getConfig() const {
return _getConfigReturnValue;
}
-void ReplicationCoordinatorMock::setGetConfigReturnValue(ReplicaSetConfig returnValue) {
+void ReplicationCoordinatorMock::setGetConfigReturnValue(ReplSetConfig returnValue) {
_getConfigReturnValue = std::move(returnValue);
}
diff --git a/src/mongo/db/repl/replication_coordinator_mock.h b/src/mongo/db/repl/replication_coordinator_mock.h
index 4542ce95004..c75702e73fa 100644
--- a/src/mongo/db/repl/replication_coordinator_mock.h
+++ b/src/mongo/db/repl/replication_coordinator_mock.h
@@ -30,7 +30,7 @@
#include "mongo/base/status.h"
#include "mongo/db/repl/optime.h"
-#include "mongo/db/repl/replica_set_config.h"
+#include "mongo/db/repl/repl_set_config.h"
#include "mongo/db/repl/replication_coordinator.h"
#include "mongo/platform/atomic_word.h"
@@ -149,7 +149,7 @@ public:
void appendConnectionStats(executor::ConnectionPoolStats* stats) const override;
- virtual ReplicaSetConfig getConfig() const;
+ virtual ReplSetConfig getConfig() const;
virtual void processReplSetGetConfig(BSONObjBuilder* result);
@@ -266,7 +266,7 @@ public:
/**
* Sets the return value for calls to getConfig.
*/
- void setGetConfigReturnValue(ReplicaSetConfig returnValue);
+ void setGetConfigReturnValue(ReplSetConfig returnValue);
/**
* Always allow writes even if this node is not master. Used by sharding unit tests.
@@ -279,7 +279,7 @@ private:
MemberState _memberState;
OpTime _myLastDurableOpTime;
OpTime _myLastAppliedOpTime;
- ReplicaSetConfig _getConfigReturnValue;
+ ReplSetConfig _getConfigReturnValue;
bool _alwaysAllowWrites = false;
};
diff --git a/src/mongo/db/repl/replication_coordinator_test_fixture.cpp b/src/mongo/db/repl/replication_coordinator_test_fixture.cpp
index 2a8435c19b2..ffc64712d8a 100644
--- a/src/mongo/db/repl/replication_coordinator_test_fixture.cpp
+++ b/src/mongo/db/repl/replication_coordinator_test_fixture.cpp
@@ -54,14 +54,14 @@ using executor::NetworkInterfaceMock;
using executor::RemoteCommandRequest;
using executor::RemoteCommandResponse;
-ReplicaSetConfig ReplCoordTest::assertMakeRSConfig(const BSONObj& configBson) {
- ReplicaSetConfig config;
+ReplSetConfig ReplCoordTest::assertMakeRSConfig(const BSONObj& configBson) {
+ ReplSetConfig config;
ASSERT_OK(config.initialize(configBson));
ASSERT_OK(config.validate());
return config;
}
-ReplicaSetConfig ReplCoordTest::assertMakeRSConfigV0(const BSONObj& configBson) {
+ReplSetConfig ReplCoordTest::assertMakeRSConfigV0(const BSONObj& configBson) {
return assertMakeRSConfig(addProtocolVersion(configBson, 0));
}
@@ -199,7 +199,7 @@ ResponseStatus ReplCoordTest::makeResponseStatus(const BSONObj& doc,
void ReplCoordTest::simulateEnoughHeartbeatsForAllNodesUp() {
ReplicationCoordinatorImpl* replCoord = getReplCoord();
- ReplicaSetConfig rsConfig = replCoord->getReplicaSetConfig_forTest();
+ ReplSetConfig rsConfig = replCoord->getReplicaSetConfig_forTest();
NetworkInterfaceMock* net = getNet();
net->enterNetwork();
for (int i = 0; i < rsConfig.getNumMembers() - 1; ++i) {
@@ -230,7 +230,7 @@ void ReplCoordTest::simulateEnoughHeartbeatsForAllNodesUp() {
void ReplCoordTest::simulateSuccessfulDryRun(
stdx::function<void(const RemoteCommandRequest& request)> onDryRunRequest) {
ReplicationCoordinatorImpl* replCoord = getReplCoord();
- ReplicaSetConfig rsConfig = replCoord->getReplicaSetConfig_forTest();
+ ReplSetConfig rsConfig = replCoord->getReplicaSetConfig_forTest();
NetworkInterfaceMock* net = getNet();
auto electionTimeoutWhen = replCoord->getElectionTimeout_forTest();
@@ -292,7 +292,7 @@ void ReplCoordTest::simulateSuccessfulV1ElectionAt(Date_t electionTime) {
ReplicationCoordinatorImpl* replCoord = getReplCoord();
NetworkInterfaceMock* net = getNet();
- ReplicaSetConfig rsConfig = replCoord->getReplicaSetConfig_forTest();
+ ReplSetConfig rsConfig = replCoord->getReplicaSetConfig_forTest();
ASSERT(replCoord->getMemberState().secondary()) << replCoord->getMemberState().toString();
bool hasReadyRequests = true;
// Process requests until we're primary and consume the heartbeats for the notification
@@ -363,7 +363,7 @@ void ReplCoordTest::simulateSuccessfulV1ElectionAt(Date_t electionTime) {
void ReplCoordTest::simulateSuccessfulElection() {
ReplicationCoordinatorImpl* replCoord = getReplCoord();
NetworkInterfaceMock* net = getNet();
- ReplicaSetConfig rsConfig = replCoord->getReplicaSetConfig_forTest();
+ ReplSetConfig rsConfig = replCoord->getReplicaSetConfig_forTest();
ASSERT(replCoord->getMemberState().secondary()) << replCoord->getMemberState().toString();
bool hasReadyRequests = true;
// Process requests until we're primary and consume the heartbeats for the notification
@@ -434,7 +434,7 @@ void ReplCoordTest::replyToReceivedHeartbeat() {
net->enterNetwork();
const NetworkInterfaceMock::NetworkOperationIterator noi = net->getNextReadyRequest();
const RemoteCommandRequest& request = noi->getRequest();
- const ReplicaSetConfig rsConfig = getReplCoord()->getReplicaSetConfig_forTest();
+ const ReplSetConfig rsConfig = getReplCoord()->getReplicaSetConfig_forTest();
repl::ReplSetHeartbeatArgs hbArgs;
ASSERT_OK(hbArgs.initialize(request.cmdObj));
repl::ReplSetHeartbeatResponse hbResp;
@@ -454,7 +454,7 @@ void ReplCoordTest::replyToReceivedHeartbeatV1() {
net->enterNetwork();
const NetworkInterfaceMock::NetworkOperationIterator noi = net->getNextReadyRequest();
const RemoteCommandRequest& request = noi->getRequest();
- const ReplicaSetConfig rsConfig = getReplCoord()->getReplicaSetConfig_forTest();
+ const ReplSetConfig rsConfig = getReplCoord()->getReplicaSetConfig_forTest();
repl::ReplSetHeartbeatArgsV1 hbArgs;
ASSERT_OK(hbArgs.initialize(request.cmdObj));
repl::ReplSetHeartbeatResponse hbResp;
diff --git a/src/mongo/db/repl/replication_coordinator_test_fixture.h b/src/mongo/db/repl/replication_coordinator_test_fixture.h
index fc34114cd0d..6fe8b14803e 100644
--- a/src/mongo/db/repl/replication_coordinator_test_fixture.h
+++ b/src/mongo/db/repl/replication_coordinator_test_fixture.h
@@ -47,7 +47,7 @@ class NetworkInterfaceMock;
namespace repl {
-class ReplicaSetConfig;
+class ReplSetConfig;
class ReplicationCoordinatorExternalStateMock;
class ReplicationCoordinatorImpl;
class StorageInterfaceMock;
@@ -73,10 +73,10 @@ public:
Milliseconds millis = Milliseconds(0));
/**
- * Constructs a ReplicaSetConfig from the given BSON, or raises a test failure exception.
+ * Constructs a ReplSetConfig from the given BSON, or raises a test failure exception.
*/
- static ReplicaSetConfig assertMakeRSConfig(const BSONObj& configBSON);
- static ReplicaSetConfig assertMakeRSConfigV0(const BSONObj& configBson);
+ static ReplSetConfig assertMakeRSConfig(const BSONObj& configBSON);
+ static ReplSetConfig assertMakeRSConfigV0(const BSONObj& configBson);
/**
* Adds { protocolVersion: 0 or 1 } to the config.
diff --git a/src/mongo/db/repl/sync_source_feedback.cpp b/src/mongo/db/repl/sync_source_feedback.cpp
index 0778c407948..9ce0a24c2d7 100644
--- a/src/mongo/db/repl/sync_source_feedback.cpp
+++ b/src/mongo/db/repl/sync_source_feedback.cpp
@@ -34,7 +34,7 @@
#include "mongo/db/client.h"
#include "mongo/db/repl/bgsync.h"
-#include "mongo/db/repl/replica_set_config.h"
+#include "mongo/db/repl/repl_set_config.h"
#include "mongo/db/repl/replication_coordinator.h"
#include "mongo/db/repl/reporter.h"
#include "mongo/executor/task_executor.h"
diff --git a/src/mongo/db/repl/sync_tail.cpp b/src/mongo/db/repl/sync_tail.cpp
index cfabc5586d0..dac9d44957f 100644
--- a/src/mongo/db/repl/sync_tail.cpp
+++ b/src/mongo/db/repl/sync_tail.cpp
@@ -61,7 +61,7 @@
#include "mongo/db/repl/oplog.h"
#include "mongo/db/repl/oplogreader.h"
#include "mongo/db/repl/repl_client_info.h"
-#include "mongo/db/repl/replica_set_config.h"
+#include "mongo/db/repl/repl_set_config.h"
#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/repl/storage_interface.h"
#include "mongo/db/server_parameters.h"
diff --git a/src/mongo/db/repl/topology_coordinator.h b/src/mongo/db/repl/topology_coordinator.h
index 0761b800b38..01ed33cb168 100644
--- a/src/mongo/db/repl/topology_coordinator.h
+++ b/src/mongo/db/repl/topology_coordinator.h
@@ -48,7 +48,7 @@ namespace repl {
class HeartbeatResponseAction;
class OpTime;
class ReplSetHeartbeatArgs;
-class ReplicaSetConfig;
+class ReplSetConfig;
class TagSubgroup;
class LastVote;
struct MemberState;
@@ -295,7 +295,7 @@ public:
* newConfig.isInitialized() should be true, though implementations may accept
* configurations where this is not true, for testing purposes.
*/
- virtual void updateConfig(const ReplicaSetConfig& newConfig,
+ virtual void updateConfig(const ReplSetConfig& newConfig,
int selfIndex,
Date_t now,
const OpTime& lastOpApplied) = 0;
diff --git a/src/mongo/db/repl/topology_coordinator_impl.cpp b/src/mongo/db/repl/topology_coordinator_impl.cpp
index 79dba110db4..732dedf8742 100644
--- a/src/mongo/db/repl/topology_coordinator_impl.cpp
+++ b/src/mongo/db/repl/topology_coordinator_impl.cpp
@@ -413,10 +413,9 @@ void TopologyCoordinatorImpl::prepareSyncFromResponse(const HostAndPort& target,
return;
}
- ReplicaSetConfig::MemberIterator targetConfig = _rsConfig.membersEnd();
+ ReplSetConfig::MemberIterator targetConfig = _rsConfig.membersEnd();
int targetIndex = 0;
- for (ReplicaSetConfig::MemberIterator it = _rsConfig.membersBegin();
- it != _rsConfig.membersEnd();
+ for (ReplSetConfig::MemberIterator it = _rsConfig.membersBegin(); it != _rsConfig.membersEnd();
++it) {
if (it->getHostAndPort() == target) {
targetConfig = it;
@@ -869,8 +868,7 @@ Status TopologyCoordinatorImpl::prepareHeartbeatResponseV1(Date_t now,
int TopologyCoordinatorImpl::_getMemberIndex(int id) const {
int index = 0;
- for (ReplicaSetConfig::MemberIterator it = _rsConfig.membersBegin();
- it != _rsConfig.membersEnd();
+ for (ReplSetConfig::MemberIterator it = _rsConfig.membersBegin(); it != _rsConfig.membersEnd();
++it, ++index) {
if (it->getId() == id) {
return index;
@@ -909,7 +907,7 @@ std::pair<ReplSetHeartbeatArgs, Milliseconds> TopologyCoordinatorImpl::prepareHe
const Milliseconds timeoutPeriod(
_rsConfig.isInitialized() ? _rsConfig.getHeartbeatTimeoutPeriodMillis()
- : Milliseconds{ReplicaSetConfig::kDefaultHeartbeatTimeoutPeriod});
+ : Milliseconds{ReplSetConfig::kDefaultHeartbeatTimeoutPeriod});
const Milliseconds timeout = timeoutPeriod - alreadyElapsed;
return std::make_pair(hbArgs, timeout);
}
@@ -945,7 +943,7 @@ std::pair<ReplSetHeartbeatArgsV1, Milliseconds> TopologyCoordinatorImpl::prepare
const Milliseconds timeoutPeriod(
_rsConfig.isInitialized() ? _rsConfig.getHeartbeatTimeoutPeriodMillis()
- : Milliseconds{ReplicaSetConfig::kDefaultHeartbeatTimeoutPeriod});
+ : Milliseconds{ReplSetConfig::kDefaultHeartbeatTimeoutPeriod});
const Milliseconds timeout(timeoutPeriod - alreadyElapsed);
return std::make_pair(hbArgs, timeout);
}
@@ -1004,7 +1002,7 @@ HeartbeatResponseAction TopologyCoordinatorImpl::processHeartbeatResponse(
if (hbResponse.isOK() && hbResponse.getValue().hasConfig()) {
const long long currentConfigVersion =
_rsConfig.isInitialized() ? _rsConfig.getConfigVersion() : -2;
- const ReplicaSetConfig& newConfig = hbResponse.getValue().getConfig();
+ const ReplSetConfig& newConfig = hbResponse.getValue().getConfig();
if (newConfig.getConfigVersion() > currentConfigVersion) {
HeartbeatResponseAction nextAction = HeartbeatResponseAction::makeReconfigAction();
nextAction.setNextHeartbeatStartDate(nextHeartbeatStartDate);
@@ -1555,7 +1553,7 @@ void TopologyCoordinatorImpl::changeMemberState_forTest(const MemberState& newMe
}
break;
case MemberState::RS_STARTUP:
- updateConfig(ReplicaSetConfig(), -1, Date_t(), OpTime());
+ updateConfig(ReplSetConfig(), -1, Date_t(), OpTime());
break;
default:
severe() << "Cannot switch to state " << newMemberState;
@@ -1776,8 +1774,7 @@ void TopologyCoordinatorImpl::fillIsMasterForReplSet(IsMasterResponse* response)
return;
}
- for (ReplicaSetConfig::MemberIterator it = _rsConfig.membersBegin();
- it != _rsConfig.membersEnd();
+ for (ReplSetConfig::MemberIterator it = _rsConfig.membersBegin(); it != _rsConfig.membersEnd();
++it) {
if (it->isHidden() || it->getSlaveDelay() > Seconds{0}) {
continue;
@@ -1822,7 +1819,7 @@ void TopologyCoordinatorImpl::fillIsMasterForReplSet(IsMasterResponse* response)
if (!selfConfig.shouldBuildIndexes()) {
response->setShouldBuildIndexes(false);
}
- const ReplicaSetTagConfig tagConfig = _rsConfig.getTagConfig();
+ const ReplSetTagConfig tagConfig = _rsConfig.getTagConfig();
if (selfConfig.hasTags(tagConfig)) {
for (MemberConfig::TagIterator tag = selfConfig.tagsBegin(); tag != selfConfig.tagsEnd();
++tag) {
@@ -1913,15 +1910,14 @@ Date_t TopologyCoordinatorImpl::getStepDownTime() const {
return _stepDownUntil;
}
-void TopologyCoordinatorImpl::_updateHeartbeatDataForReconfig(const ReplicaSetConfig& newConfig,
+void TopologyCoordinatorImpl::_updateHeartbeatDataForReconfig(const ReplSetConfig& newConfig,
int selfIndex,
Date_t now) {
std::vector<MemberHeartbeatData> oldHeartbeats;
_hbdata.swap(oldHeartbeats);
int index = 0;
- for (ReplicaSetConfig::MemberIterator it = newConfig.membersBegin();
- it != newConfig.membersEnd();
+ for (ReplSetConfig::MemberIterator it = newConfig.membersBegin(); it != newConfig.membersEnd();
++it, ++index) {
const MemberConfig& newMemberConfig = *it;
// TODO: C++11: use emplace_back()
@@ -1947,7 +1943,7 @@ void TopologyCoordinatorImpl::_updateHeartbeatDataForReconfig(const ReplicaSetCo
// This function installs a new config object and recreates MemberHeartbeatData objects
// that reflect the new config.
-void TopologyCoordinatorImpl::updateConfig(const ReplicaSetConfig& newConfig,
+void TopologyCoordinatorImpl::updateConfig(const ReplSetConfig& newConfig,
int selfIndex,
Date_t now,
const OpTime& lastOpApplied) {
diff --git a/src/mongo/db/repl/topology_coordinator_impl.h b/src/mongo/db/repl/topology_coordinator_impl.h
index 96708c90b48..bbf4562604d 100644
--- a/src/mongo/db/repl/topology_coordinator_impl.h
+++ b/src/mongo/db/repl/topology_coordinator_impl.h
@@ -36,7 +36,7 @@
#include "mongo/db/repl/member_heartbeat_data.h"
#include "mongo/db/repl/member_state.h"
#include "mongo/db/repl/optime.h"
-#include "mongo/db/repl/replica_set_config.h"
+#include "mongo/db/repl/repl_set_config.h"
#include "mongo/db/repl/replication_coordinator.h"
#include "mongo/db/repl/topology_coordinator.h"
#include "mongo/db/server_options.h"
@@ -198,7 +198,7 @@ public:
virtual StatusWith<PrepareFreezeResponseResult> prepareFreezeResponse(Date_t now,
int secs,
BSONObjBuilder* response);
- virtual void updateConfig(const ReplicaSetConfig& newConfig,
+ virtual void updateConfig(const ReplSetConfig& newConfig,
int selfIndex,
Date_t now,
const OpTime& lastOpApplied);
@@ -371,9 +371,7 @@ private:
* _currentConfig, copies their heartbeat info into the corresponding entry in the updated
* _hbdata vector.
*/
- void _updateHeartbeatDataForReconfig(const ReplicaSetConfig& newConfig,
- int selfIndex,
- Date_t now);
+ void _updateHeartbeatDataForReconfig(const ReplSetConfig& newConfig, int selfIndex, Date_t now);
void _stepDownSelfAndReplaceWith(int newPrimary);
@@ -423,7 +421,7 @@ private:
int _selfIndex; // this node's index in _members and _currentConfig
- ReplicaSetConfig _rsConfig; // The current config, including a vector of MemberConfigs
+ ReplSetConfig _rsConfig; // The current config, including a vector of MemberConfigs
// heartbeat data for each member. It is guaranteed that this vector will be maintained
// in the same order as the MemberConfigs in _currentConfig, therefore the member config
diff --git a/src/mongo/db/repl/topology_coordinator_impl_test.cpp b/src/mongo/db/repl/topology_coordinator_impl_test.cpp
index 3519dd5e8d5..bd617b2dfa6 100644
--- a/src/mongo/db/repl/topology_coordinator_impl_test.cpp
+++ b/src/mongo/db/repl/topology_coordinator_impl_test.cpp
@@ -131,7 +131,7 @@ protected:
int selfIndex,
Date_t now = Date_t::fromMillisSinceEpoch(-1),
const OpTime& lastOp = OpTime()) {
- ReplicaSetConfig config;
+ ReplSetConfig config;
ASSERT_OK(config.initialize(cfg));
ASSERT_OK(config.validate());
@@ -189,7 +189,7 @@ protected:
ErrorCodes::Error errcode = ErrorCodes::HostUnreachable) {
// timed out heartbeat to mark a node as down
- Milliseconds roundTripTime{ReplicaSetConfig::kDefaultHeartbeatTimeoutPeriod};
+ Milliseconds roundTripTime{ReplSetConfig::kDefaultHeartbeatTimeoutPeriod};
return _receiveHeartbeatHelper(Status(errcode, ""),
member,
setName,
@@ -244,7 +244,7 @@ private:
private:
unique_ptr<TopologyCoordinatorImpl> _topo;
unique_ptr<ReplicationExecutor::CallbackArgs> _cbData;
- ReplicaSetConfig _currentConfig;
+ ReplSetConfig _currentConfig;
Date_t _now;
int _selfIndex;
TopologyCoordinatorImpl::Options _options;
@@ -1571,7 +1571,7 @@ TEST_F(TopoCoordTest, ReplSetGetStatus) {
startupTime + Milliseconds(2), Milliseconds(1), member, hbResponseGood, OpTime());
getTopoCoord().prepareHeartbeatRequest(startupTime + Milliseconds(3), setName, member);
Date_t timeoutTime =
- startupTime + Milliseconds(3) + ReplicaSetConfig::kDefaultHeartbeatTimeoutPeriod;
+ startupTime + Milliseconds(3) + ReplSetConfig::kDefaultHeartbeatTimeoutPeriod;
StatusWith<ReplSetHeartbeatResponse> hbResponseDown =
StatusWith<ReplSetHeartbeatResponse>(Status(ErrorCodes::HostUnreachable, ""));
@@ -2632,7 +2632,7 @@ TEST_F(HeartbeatResponseHighVerbosityTest, UpdateHeartbeatDataSameConfig) {
// construct a copy of the original config for log message checking later
// see HeartbeatResponseTest for the origin of the original config
- ReplicaSetConfig originalConfig;
+ ReplSetConfig originalConfig;
originalConfig.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -2696,7 +2696,7 @@ TEST_F(HeartbeatResponseHighVerbosityTest, UpdateHeartbeatDataOldConfig) {
TEST_F(HeartbeatResponseTestOneRetry, ReconfigWhenHeartbeatResponseContainsAConfig) {
// Confirm that action responses can come back from retries; in this, expect a Reconfig
// action.
- ReplicaSetConfig newConfig;
+ ReplSetConfig newConfig;
ASSERT_OK(newConfig.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -2881,7 +2881,7 @@ TEST_F(HeartbeatResponseTestTwoRetries, NodeDoesNotRetryHeartbeatsAfterFailingTw
TEST_F(HeartbeatResponseTestTwoRetries, ReconfigWhenHeartbeatResponseContainsAConfig) {
// Confirm that action responses can come back from retries; in this, expect a Reconfig
// action.
- ReplicaSetConfig newConfig;
+ ReplSetConfig newConfig;
ASSERT_OK(newConfig.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -4954,7 +4954,7 @@ TEST_F(TopoCoordTest, BecomeCandidateWhenBecomingSecondaryInSingleNodeSet) {
TEST_F(TopoCoordTest, BecomeCandidateWhenReconfigToBeElectableInSingleNodeSet) {
ASSERT_TRUE(TopologyCoordinator::Role::follower == getTopoCoord().getRole());
ASSERT_EQUALS(MemberState::RS_STARTUP, getTopoCoord().getMemberState().s);
- ReplicaSetConfig cfg;
+ ReplSetConfig cfg;
cfg.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -4988,7 +4988,7 @@ TEST_F(TopoCoordTest, BecomeCandidateWhenReconfigToBeElectableInSingleNodeSet) {
TEST_F(TopoCoordTest, NodeDoesNotBecomeCandidateWhenBecomingSecondaryInSingleNodeSetIfUnelectable) {
ASSERT_TRUE(TopologyCoordinator::Role::follower == getTopoCoord().getRole());
ASSERT_EQUALS(MemberState::RS_STARTUP, getTopoCoord().getMemberState().s);
- ReplicaSetConfig cfg;
+ ReplSetConfig cfg;
cfg.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -6523,7 +6523,7 @@ TEST_F(TopoCoordTest, CSRSConfigServerRejectsPV0Config) {
<< "h2")
<< BSON("_id" << 30 << "host"
<< "h3")));
- ReplicaSetConfig config;
+ ReplSetConfig config;
ASSERT_OK(config.initialize(configObj, false));
ASSERT_EQ(ErrorCodes::BadValue, config.validate());
}
diff --git a/src/mongo/db/repl/topology_coordinator_impl_v1_test.cpp b/src/mongo/db/repl/topology_coordinator_impl_v1_test.cpp
index a171f7ca89e..72e81caba7f 100644
--- a/src/mongo/db/repl/topology_coordinator_impl_v1_test.cpp
+++ b/src/mongo/db/repl/topology_coordinator_impl_v1_test.cpp
@@ -132,7 +132,7 @@ protected:
int selfIndex,
Date_t now = Date_t::fromMillisSinceEpoch(-1),
const OpTime& lastOp = OpTime()) {
- ReplicaSetConfig config;
+ ReplSetConfig config;
// Use Protocol version 1 by default.
ASSERT_OK(config.initialize(cfg, true));
ASSERT_OK(config.validate());
@@ -196,7 +196,7 @@ protected:
ErrorCodes::Error errcode = ErrorCodes::HostUnreachable) {
// timed out heartbeat to mark a node as down
- Milliseconds roundTripTime{ReplicaSetConfig::kDefaultHeartbeatTimeoutPeriod};
+ Milliseconds roundTripTime{ReplSetConfig::kDefaultHeartbeatTimeoutPeriod};
return _receiveHeartbeatHelper(Status(errcode, ""),
member,
setName,
@@ -252,7 +252,7 @@ private:
private:
unique_ptr<TopologyCoordinatorImpl> _topo;
unique_ptr<ReplicationExecutor::CallbackArgs> _cbData;
- ReplicaSetConfig _currentConfig;
+ ReplSetConfig _currentConfig;
Date_t _now;
int _selfIndex;
TopologyCoordinatorImpl::Options _options;
@@ -1631,7 +1631,7 @@ TEST_F(TopoCoordTest, ReplSetGetStatus) {
startupTime + Milliseconds(2), Milliseconds(1), member, hbResponseGood, OpTime());
getTopoCoord().prepareHeartbeatRequestV1(startupTime + Milliseconds(3), setName, member);
Date_t timeoutTime =
- startupTime + Milliseconds(3) + ReplicaSetConfig::kDefaultHeartbeatTimeoutPeriod;
+ startupTime + Milliseconds(3) + ReplSetConfig::kDefaultHeartbeatTimeoutPeriod;
StatusWith<ReplSetHeartbeatResponse> hbResponseDown =
StatusWith<ReplSetHeartbeatResponse>(Status(ErrorCodes::HostUnreachable, ""));
@@ -2076,7 +2076,7 @@ TEST_F(TopoCoordTest, BecomeCandidateWhenBecomingSecondaryInSingleNodeSet) {
TEST_F(TopoCoordTest, BecomeCandidateWhenReconfigToBeElectableInSingleNodeSet) {
ASSERT_TRUE(TopologyCoordinator::Role::follower == getTopoCoord().getRole());
ASSERT_EQUALS(MemberState::RS_STARTUP, getTopoCoord().getMemberState().s);
- ReplicaSetConfig cfg;
+ ReplSetConfig cfg;
cfg.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -2110,7 +2110,7 @@ TEST_F(TopoCoordTest, BecomeCandidateWhenReconfigToBeElectableInSingleNodeSet) {
TEST_F(TopoCoordTest, NodeDoesNotBecomeCandidateWhenBecomingSecondaryInSingleNodeSetIfUnelectable) {
ASSERT_TRUE(TopologyCoordinator::Role::follower == getTopoCoord().getRole());
ASSERT_EQUALS(MemberState::RS_STARTUP, getTopoCoord().getMemberState().s);
- ReplicaSetConfig cfg;
+ ReplSetConfig cfg;
cfg.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -4538,7 +4538,7 @@ TEST_F(HeartbeatResponseTestV1, NodeDoesNotRetryHeartbeatIfTheFirstFailureTakesT
ASSERT_TRUE(TopologyCoordinator::Role::follower == getTopoCoord().getRole());
// Because the heartbeat timed out, we'll retry in half of the election timeout.
ASSERT_EQUALS(firstRequestDate + Milliseconds(5000) +
- ReplicaSetConfig::kDefaultElectionTimeoutPeriod / 2,
+ ReplSetConfig::kDefaultElectionTimeoutPeriod / 2,
action.getNextHeartbeatStartDate());
}
@@ -4742,7 +4742,7 @@ TEST_F(HeartbeatResponseTestOneRetryV1,
ASSERT_TRUE(TopologyCoordinator::Role::follower == getTopoCoord().getRole());
// Because the heartbeat timed out, we'll retry in half of the election timeout.
ASSERT_EQUALS(firstRequestDate() + Milliseconds(5010) +
- ReplicaSetConfig::kDefaultElectionTimeoutPeriod / 2,
+ ReplSetConfig::kDefaultElectionTimeoutPeriod / 2,
action.getNextHeartbeatStartDate());
}
@@ -4816,7 +4816,7 @@ TEST_F(HeartbeatResponseTestTwoRetriesV1, NodeDoesNotRetryHeartbeatsAfterFailing
// Because this is the second retry, rather than retry again, we expect to wait for half
// of the election timeout interval of 2 seconds to elapse.
ASSERT_EQUALS(firstRequestDate() + Milliseconds(4800) +
- ReplicaSetConfig::kDefaultElectionTimeoutPeriod / 2,
+ ReplSetConfig::kDefaultElectionTimeoutPeriod / 2,
action.getNextHeartbeatStartDate());
// Ensure a third failed heartbeat caused the node to be marked down
@@ -4863,7 +4863,7 @@ TEST_F(HeartbeatResponseTestTwoRetriesV1, HeartbeatThreeNonconsecutiveFailures)
ASSERT_TRUE(TopologyCoordinator::Role::follower == getTopoCoord().getRole());
// Because the heartbeat succeeded, we'll retry in half of the election timeout.
ASSERT_EQUALS(firstRequestDate() + Milliseconds(4500) +
- ReplicaSetConfig::kDefaultElectionTimeoutPeriod / 2,
+ ReplSetConfig::kDefaultElectionTimeoutPeriod / 2,
action.getNextHeartbeatStartDate());
// request next heartbeat
@@ -4952,7 +4952,7 @@ TEST_F(HeartbeatResponseHighVerbosityTestV1, UpdateHeartbeatDataSameConfig) {
// construct a copy of the original config for log message checking later
// see HeartbeatResponseTest for the origin of the original config
- ReplicaSetConfig originalConfig;
+ ReplSetConfig originalConfig;
originalConfig.initialize(BSON("_id"
<< "rs0"
<< "version"
diff --git a/src/mongo/db/repl/vote_requester.cpp b/src/mongo/db/repl/vote_requester.cpp
index ad7b4594e71..bac35602398 100644
--- a/src/mongo/db/repl/vote_requester.cpp
+++ b/src/mongo/db/repl/vote_requester.cpp
@@ -44,7 +44,7 @@ namespace repl {
using executor::RemoteCommandRequest;
-VoteRequester::Algorithm::Algorithm(const ReplicaSetConfig& rsConfig,
+VoteRequester::Algorithm::Algorithm(const ReplSetConfig& rsConfig,
long long candidateIndex,
long long term,
bool dryRun,
@@ -141,7 +141,7 @@ VoteRequester::VoteRequester() : _isCanceled(false) {}
VoteRequester::~VoteRequester() {}
StatusWith<ReplicationExecutor::EventHandle> VoteRequester::start(ReplicationExecutor* executor,
- const ReplicaSetConfig& rsConfig,
+ const ReplSetConfig& rsConfig,
long long candidateIndex,
long long term,
bool dryRun,
diff --git a/src/mongo/db/repl/vote_requester.h b/src/mongo/db/repl/vote_requester.h
index 7c8c8ae414e..8560491fc13 100644
--- a/src/mongo/db/repl/vote_requester.h
+++ b/src/mongo/db/repl/vote_requester.h
@@ -34,7 +34,7 @@
#include "mongo/base/disallow_copying.h"
#include "mongo/bson/timestamp.h"
#include "mongo/db/repl/optime.h"
-#include "mongo/db/repl/replica_set_config.h"
+#include "mongo/db/repl/repl_set_config.h"
#include "mongo/db/repl/replication_executor.h"
#include "mongo/db/repl/scatter_gather_algorithm.h"
#include "mongo/platform/unordered_set.h"
@@ -60,7 +60,7 @@ public:
class Algorithm : public ScatterGatherAlgorithm {
public:
- Algorithm(const ReplicaSetConfig& rsConfig,
+ Algorithm(const ReplSetConfig& rsConfig,
long long candidateIndex,
long long term,
bool dryRun,
@@ -84,7 +84,7 @@ public:
unordered_set<HostAndPort> getResponders() const;
private:
- const ReplicaSetConfig _rsConfig;
+ const ReplSetConfig _rsConfig;
const long long _candidateIndex;
const long long _term;
bool _dryRun = false; // this bool indicates this is a mock election when true
@@ -107,7 +107,7 @@ public:
* If this function returns Status::OK(), evh is then guaranteed to be signaled.
**/
StatusWith<ReplicationExecutor::EventHandle> start(ReplicationExecutor* executor,
- const ReplicaSetConfig& rsConfig,
+ const ReplSetConfig& rsConfig,
long long candidateIndex,
long long term,
bool dryRun,
diff --git a/src/mongo/db/repl/vote_requester_test.cpp b/src/mongo/db/repl/vote_requester_test.cpp
index 8b158609fea..1dd97c456ea 100644
--- a/src/mongo/db/repl/vote_requester_test.cpp
+++ b/src/mongo/db/repl/vote_requester_test.cpp
@@ -57,7 +57,7 @@ bool stringContains(const std::string& haystack, const std::string& needle) {
class VoteRequesterTest : public mongo::unittest::Test {
public:
virtual void setUp() {
- ReplicaSetConfig config;
+ ReplSetConfig config;
ASSERT_OK(config.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -191,7 +191,7 @@ protected:
class VoteRequesterDryRunTest : public VoteRequesterTest {
public:
virtual void setUp() {
- ReplicaSetConfig config;
+ ReplSetConfig config;
ASSERT_OK(config.initialize(BSON("_id"
<< "rs0"
<< "version"
diff --git a/src/mongo/db/s/config/configsvr_add_shard_command.cpp b/src/mongo/db/s/config/configsvr_add_shard_command.cpp
index e3ff1523c69..9f9b349b4df 100644
--- a/src/mongo/db/s/config/configsvr_add_shard_command.cpp
+++ b/src/mongo/db/s/config/configsvr_add_shard_command.cpp
@@ -36,7 +36,7 @@
#include "mongo/db/auth/privilege.h"
#include "mongo/db/commands.h"
#include "mongo/db/namespace_string.h"
-#include "mongo/db/repl/replica_set_config.h"
+#include "mongo/db/repl/repl_set_config.h"
#include "mongo/db/repl/replication_coordinator.h"
#include "mongo/s/catalog/sharding_catalog_manager.h"
#include "mongo/s/catalog/type_shard.h"
diff --git a/src/mongo/dbtests/mock/mock_replica_set.cpp b/src/mongo/dbtests/mock/mock_replica_set.cpp
index 5005aec6f6c..77035a0f8f0 100644
--- a/src/mongo/dbtests/mock/mock_replica_set.cpp
+++ b/src/mongo/dbtests/mock/mock_replica_set.cpp
@@ -65,7 +65,7 @@ MockReplicaSet::MockReplicaSet(const string& setName, size_t nodes) : _setName(s
}
membersBuilder.done();
- ReplicaSetConfig replConfig;
+ ReplSetConfig replConfig;
fassert(28566, replConfig.initialize(configBuilder.obj()));
fassert(28573, replConfig.validate());
setConfig(replConfig);
@@ -129,7 +129,7 @@ void MockReplicaSet::setPrimary(const string& hostAndPort) {
vector<string> MockReplicaSet::getSecondaries() const {
vector<string> secondaries;
- for (ReplicaSetConfig::MemberIterator member = _replConfig.membersBegin();
+ for (ReplSetConfig::MemberIterator member = _replConfig.membersBegin();
member != _replConfig.membersEnd();
++member) {
if (member->getHostAndPort() != HostAndPort(_primaryHost)) {
@@ -144,11 +144,11 @@ MockRemoteDBServer* MockReplicaSet::getNode(const string& hostAndPort) {
return mapFindWithDefault(_nodeMap, hostAndPort, static_cast<MockRemoteDBServer*>(NULL));
}
-repl::ReplicaSetConfig MockReplicaSet::getReplConfig() const {
+repl::ReplSetConfig MockReplicaSet::getReplConfig() const {
return _replConfig;
}
-void MockReplicaSet::setConfig(const repl::ReplicaSetConfig& newConfig) {
+void MockReplicaSet::setConfig(const repl::ReplSetConfig& newConfig) {
_replConfig = newConfig;
mockIsMasterCmd();
mockReplSetGetStatusCmd();
@@ -228,7 +228,7 @@ void MockReplicaSet::mockIsMasterCmd() {
builder.append("buildIndexes", false);
}
- const ReplicaSetTagConfig tagConfig = _replConfig.getTagConfig();
+ const ReplSetTagConfig tagConfig = _replConfig.getTagConfig();
if (member->hasTags(tagConfig)) {
BSONObjBuilder tagBuilder;
for (MemberConfig::TagIterator tag = member->tagsBegin(); tag != member->tagsEnd();
@@ -282,7 +282,7 @@ void MockReplicaSet::mockReplSetGetStatusCmd() {
hostsField.push_back(selfStatBuilder.obj());
}
- for (ReplicaSetConfig::MemberIterator member = _replConfig.membersBegin();
+ for (ReplSetConfig::MemberIterator member = _replConfig.membersBegin();
member != _replConfig.membersEnd();
++member) {
MockRemoteDBServer* hostNode = getNode(member->getHostAndPort().toString());
diff --git a/src/mongo/dbtests/mock/mock_replica_set.h b/src/mongo/dbtests/mock/mock_replica_set.h
index b2b48747d8e..f6573be07b4 100644
--- a/src/mongo/dbtests/mock/mock_replica_set.h
+++ b/src/mongo/dbtests/mock/mock_replica_set.h
@@ -28,7 +28,7 @@
#pragma once
#include "mongo/db/repl/member_config.h"
-#include "mongo/db/repl/replica_set_config.h"
+#include "mongo/db/repl/repl_set_config.h"
#include "mongo/dbtests/mock/mock_remote_db_server.h"
#include <map>
@@ -68,7 +68,7 @@ public:
std::string getSetName() const;
std::string getConnectionString() const;
std::vector<HostAndPort> getHosts() const;
- repl::ReplicaSetConfig getReplConfig() const;
+ repl::ReplSetConfig getReplConfig() const;
std::string getPrimary() const;
std::vector<std::string> getSecondaries() const;
@@ -80,7 +80,7 @@ public:
* Note: does not automatically select a new primary. Can be done manually by
* calling setPrimary.
*/
- void setConfig(const repl::ReplicaSetConfig& newConfig);
+ void setConfig(const repl::ReplSetConfig& newConfig);
void setPrimary(const std::string& hostAndPort);
@@ -133,7 +133,7 @@ private:
const std::string _setName;
ReplNodeMap _nodeMap;
- repl::ReplicaSetConfig _replConfig;
+ repl::ReplSetConfig _replConfig;
std::string _primaryHost;
};
diff --git a/src/mongo/dbtests/mock_replica_set_test.cpp b/src/mongo/dbtests/mock_replica_set_test.cpp
index 0ead3d418ab..8256cfaadc6 100644
--- a/src/mongo/dbtests/mock_replica_set_test.cpp
+++ b/src/mongo/dbtests/mock_replica_set_test.cpp
@@ -43,7 +43,7 @@ using mongo::ConnectionString;
using mongo::HostAndPort;
using mongo::MockRemoteDBServer;
using mongo::MockReplicaSet;
-using mongo::repl::ReplicaSetConfig;
+using mongo::repl::ReplSetConfig;
using std::set;
using std::string;
@@ -257,18 +257,18 @@ TEST(MockReplicaSetTest, ReplSetGetStatusNode2) {
namespace {
/**
- * Takes a ReplicaSetConfig and a node to remove and returns a new config with equivalent
+ * Takes a ReplSetConfig and a node to remove and returns a new config with equivalent
* members minus the one specified to be removed. NOTE: Does not copy over properties of the
* members other than their id and host.
*/
-ReplicaSetConfig _getConfigWithMemberRemoved(const ReplicaSetConfig& oldConfig,
- const HostAndPort& toRemove) {
+ReplSetConfig _getConfigWithMemberRemoved(const ReplSetConfig& oldConfig,
+ const HostAndPort& toRemove) {
BSONObjBuilder newConfigBuilder;
newConfigBuilder.append("_id", oldConfig.getReplSetName());
newConfigBuilder.append("version", oldConfig.getConfigVersion());
BSONArrayBuilder membersBuilder(newConfigBuilder.subarrayStart("members"));
- for (ReplicaSetConfig::MemberIterator member = oldConfig.membersBegin();
+ for (ReplSetConfig::MemberIterator member = oldConfig.membersBegin();
member != oldConfig.membersEnd();
++member) {
if (member->getHostAndPort() == toRemove) {
@@ -280,7 +280,7 @@ ReplicaSetConfig _getConfigWithMemberRemoved(const ReplicaSetConfig& oldConfig,
}
membersBuilder.done();
- ReplicaSetConfig newConfig;
+ ReplSetConfig newConfig;
ASSERT_OK(newConfig.initialize(newConfigBuilder.obj()));
ASSERT_OK(newConfig.validate());
return newConfig;
@@ -290,9 +290,9 @@ ReplicaSetConfig _getConfigWithMemberRemoved(const ReplicaSetConfig& oldConfig,
TEST(MockReplicaSetTest, IsMasterReconfigNodeRemoved) {
MockReplicaSet replSet("n", 3);
- ReplicaSetConfig oldConfig = replSet.getReplConfig();
+ ReplSetConfig oldConfig = replSet.getReplConfig();
const string hostToRemove("$n1:27017");
- ReplicaSetConfig newConfig = _getConfigWithMemberRemoved(oldConfig, HostAndPort(hostToRemove));
+ ReplSetConfig newConfig = _getConfigWithMemberRemoved(oldConfig, HostAndPort(hostToRemove));
replSet.setConfig(newConfig);
{
@@ -341,9 +341,9 @@ TEST(MockReplicaSetTest, IsMasterReconfigNodeRemoved) {
TEST(MockReplicaSetTest, replSetGetStatusReconfigNodeRemoved) {
MockReplicaSet replSet("n", 3);
- ReplicaSetConfig oldConfig = replSet.getReplConfig();
+ ReplSetConfig oldConfig = replSet.getReplConfig();
const string hostToRemove("$n1:27017");
- ReplicaSetConfig newConfig = _getConfigWithMemberRemoved(oldConfig, HostAndPort(hostToRemove));
+ ReplSetConfig newConfig = _getConfigWithMemberRemoved(oldConfig, HostAndPort(hostToRemove));
replSet.setConfig(newConfig);
{
diff --git a/src/mongo/dbtests/replica_set_monitor_test.cpp b/src/mongo/dbtests/replica_set_monitor_test.cpp
index 69cbe39e1d6..ce231ae7d57 100644
--- a/src/mongo/dbtests/replica_set_monitor_test.cpp
+++ b/src/mongo/dbtests/replica_set_monitor_test.cpp
@@ -103,18 +103,18 @@ TEST_F(ReplicaSetMonitorTest, SeedWithPriOnlySecDown) {
namespace {
/**
- * Takes a repl::ReplicaSetConfig and a node to remove and returns a new config with equivalent
+ * Takes a repl::ReplSetConfig and a node to remove and returns a new config with equivalent
* members minus the one specified to be removed. NOTE: Does not copy over properties of the
* members other than their id and host.
*/
-repl::ReplicaSetConfig _getConfigWithMemberRemoved(const repl::ReplicaSetConfig& oldConfig,
- const HostAndPort& toRemove) {
+repl::ReplSetConfig _getConfigWithMemberRemoved(const repl::ReplSetConfig& oldConfig,
+ const HostAndPort& toRemove) {
BSONObjBuilder newConfigBuilder;
newConfigBuilder.append("_id", oldConfig.getReplSetName());
newConfigBuilder.append("version", oldConfig.getConfigVersion());
BSONArrayBuilder membersBuilder(newConfigBuilder.subarrayStart("members"));
- for (repl::ReplicaSetConfig::MemberIterator member = oldConfig.membersBegin();
+ for (repl::ReplSetConfig::MemberIterator member = oldConfig.membersBegin();
member != oldConfig.membersEnd();
++member) {
if (member->getHostAndPort() == toRemove) {
@@ -126,7 +126,7 @@ repl::ReplicaSetConfig _getConfigWithMemberRemoved(const repl::ReplicaSetConfig&
}
membersBuilder.done();
- repl::ReplicaSetConfig newConfig;
+ repl::ReplSetConfig newConfig;
ASSERT_OK(newConfig.initialize(newConfigBuilder.obj()));
ASSERT_OK(newConfig.validate());
return newConfig;
@@ -148,7 +148,7 @@ TEST(ReplicaSetMonitorTest, PrimaryRemovedFromSetStress) {
seedList.insert(HostAndPort(replSet.getPrimary()));
auto replMonitor = ReplicaSetMonitor::createIfNeeded(replSetName, seedList);
- const repl::ReplicaSetConfig& origConfig = replSet.getReplConfig();
+ const repl::ReplSetConfig& origConfig = replSet.getReplConfig();
for (size_t idxToRemove = 0; idxToRemove < NODE_COUNT; idxToRemove++) {
replSet.setConfig(origConfig);
@@ -170,7 +170,7 @@ TEST(ReplicaSetMonitorTest, PrimaryRemovedFromSetStress) {
// Make sure the monitor sees the new primary
replMonitor->startOrContinueRefresh().refreshAll();
- repl::ReplicaSetConfig newConfig =
+ repl::ReplSetConfig newConfig =
_getConfigWithMemberRemoved(origConfig, HostAndPort(hostToRemove));
replSet.setConfig(newConfig);
replSet.setPrimary(newConfig.getMemberAt(0).getHostAndPort().toString());
@@ -195,7 +195,7 @@ protected:
_originalConnectionHook = ConnectionString::getConnectionHook();
ConnectionString::setConnectionHook(mongo::MockConnRegistry::get()->getConnStrHook());
- repl::ReplicaSetConfig oldConfig = _replSet->getReplConfig();
+ repl::ReplSetConfig oldConfig = _replSet->getReplConfig();
mongo::BSONObjBuilder newConfigBuilder;
newConfigBuilder.append("_id", oldConfig.getReplSetName());
@@ -227,7 +227,7 @@ protected:
membersBuilder.done();
- repl::ReplicaSetConfig newConfig;
+ repl::ReplSetConfig newConfig;
fassert(28572, newConfig.initialize(newConfigBuilder.done()));
fassert(28571, newConfig.validate());
_replSet->setConfig(newConfig);
diff --git a/src/mongo/s/catalog/sharding_catalog_client.cpp b/src/mongo/s/catalog/sharding_catalog_client.cpp
index b9e0b8ec384..35befd0a6b8 100644
--- a/src/mongo/s/catalog/sharding_catalog_client.cpp
+++ b/src/mongo/s/catalog/sharding_catalog_client.cpp
@@ -36,7 +36,7 @@ const WriteConcernOptions ShardingCatalogClient::kMajorityWriteConcern(
WriteConcernOptions::kMajority,
// Note: Even though we're setting UNSET here, kMajority implies JOURNAL if journaling is
// supported by mongod and writeConcernMajorityJournalDefault is set to true in the
- // ReplicaSetConfig.
+ // ReplSetConfig.
WriteConcernOptions::SyncMode::UNSET,
Seconds(15));
diff --git a/src/mongo/s/client/shard_local.cpp b/src/mongo/s/client/shard_local.cpp
index 9a3d2114588..bb313cec4ef 100644
--- a/src/mongo/s/client/shard_local.cpp
+++ b/src/mongo/s/client/shard_local.cpp
@@ -40,7 +40,7 @@
#include "mongo/db/curop.h"
#include "mongo/db/dbdirectclient.h"
#include "mongo/db/repl/repl_client_info.h"
-#include "mongo/db/repl/replica_set_config.h"
+#include "mongo/db/repl/repl_set_config.h"
#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/rpc/get_status_from_command_result.h"
#include "mongo/rpc/unique_message.h"
diff --git a/src/mongo/s/commands/cluster_add_shard_to_zone_cmd.cpp b/src/mongo/s/commands/cluster_add_shard_to_zone_cmd.cpp
index 1a5559e52ec..6ab4e01cd54 100644
--- a/src/mongo/s/commands/cluster_add_shard_to_zone_cmd.cpp
+++ b/src/mongo/s/commands/cluster_add_shard_to_zone_cmd.cpp
@@ -55,7 +55,7 @@ const WriteConcernOptions kMajorityWriteConcern(WriteConcernOptions::kMajority,
// kMajority implies JOURNAL if journaling is
// supported by mongod and
// writeConcernMajorityJournalDefault is set to true
- // in the ReplicaSetConfig.
+ // in the ReplSetConfig.
WriteConcernOptions::SyncMode::UNSET,
Seconds(15));
diff --git a/src/mongo/s/commands/cluster_remove_shard_from_zone_cmd.cpp b/src/mongo/s/commands/cluster_remove_shard_from_zone_cmd.cpp
index 89902d3bde0..028f79e32ae 100644
--- a/src/mongo/s/commands/cluster_remove_shard_from_zone_cmd.cpp
+++ b/src/mongo/s/commands/cluster_remove_shard_from_zone_cmd.cpp
@@ -55,7 +55,7 @@ const WriteConcernOptions kMajorityWriteConcern(WriteConcernOptions::kMajority,
// kMajority implies JOURNAL if journaling is
// supported by mongod and
// writeConcernMajorityJournalDefault is set to true
- // in the ReplicaSetConfig.
+ // in the ReplSetConfig.
WriteConcernOptions::SyncMode::UNSET,
Seconds(15));
diff --git a/src/mongo/s/commands/cluster_update_zone_key_range_cmd.cpp b/src/mongo/s/commands/cluster_update_zone_key_range_cmd.cpp
index 7c1e55eaf5d..bd4c28dc8f8 100644
--- a/src/mongo/s/commands/cluster_update_zone_key_range_cmd.cpp
+++ b/src/mongo/s/commands/cluster_update_zone_key_range_cmd.cpp
@@ -56,7 +56,7 @@ const WriteConcernOptions kMajorityWriteConcern(WriteConcernOptions::kMajority,
// kMajority implies JOURNAL if journaling is
// supported by mongod and
// writeConcernMajorityJournalDefault is set to true
- // in the ReplicaSetConfig.
+ // in the ReplSetConfig.
WriteConcernOptions::SyncMode::UNSET,
Seconds(15));
diff --git a/src/mongo/s/sharding_mongod_test_fixture.cpp b/src/mongo/s/sharding_mongod_test_fixture.cpp
index 6ec49389d93..2a9679610b6 100644
--- a/src/mongo/s/sharding_mongod_test_fixture.cpp
+++ b/src/mongo/s/sharding_mongod_test_fixture.cpp
@@ -116,7 +116,7 @@ void ShardingMongodTestFixture::setUp() {
for (size_t i = 0; i < _servers.size(); ++i) {
serversBob.append(BSON("host" << _servers[i].toString() << "_id" << static_cast<int>(i)));
}
- repl::ReplicaSetConfig replSetConfig;
+ repl::ReplSetConfig replSetConfig;
replSetConfig.initialize(BSON("_id" << _setName << "protocolVersion" << 1 << "version" << 3
<< "members"
<< serversBob.arr()));