summaryrefslogtreecommitdiff
path: root/src/mongo/db
diff options
context:
space:
mode:
authorJudah Schvimer <judah@mongodb.com>2017-03-06 16:02:10 -0500
committerJudah Schvimer <judah@mongodb.com>2017-03-06 16:02:10 -0500
commit5b5cf72ed9e52d71ed9f41b2219080fe46f62a3a (patch)
tree9fb58b23f66748b64369316c766a4fa693fd76e2 /src/mongo/db
parent59681ee6603fc43f0f3209ec0f9c6a09476edfcc (diff)
downloadmongo-5b5cf72ed9e52d71ed9f41b2219080fe46f62a3a.tar.gz
SERVER-27995 make repl_set* naming convention consistent
Diffstat (limited to 'src/mongo/db')
-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)41
-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)106
-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/balancer/migration_manager.cpp2
-rw-r--r--src/mongo/db/s/config/configsvr_add_shard_command.cpp2
68 files changed, 985 insertions, 1001 deletions
diff --git a/src/mongo/db/SConscript b/src/mongo/db/SConscript
index 7a43c188625..ab81deafa1f 100644
--- a/src/mongo/db/SConscript
+++ b/src/mongo/db/SConscript
@@ -426,7 +426,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/background',
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 dd7233cd6b3..3603a33704d 100644
--- a/src/mongo/db/repl/SConscript
+++ b/src/mongo/db/repl/SConscript
@@ -415,7 +415,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',
@@ -471,9 +471,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',
@@ -641,8 +641,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',
],
@@ -658,11 +658,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',
@@ -679,9 +679,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 9354c9c5f32..dc1ac7c722e 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;
@@ -108,7 +108,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(
@@ -126,7 +126,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;
@@ -134,46 +134,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());
}
@@ -182,21 +182,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();
@@ -220,7 +220,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());
@@ -236,7 +236,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"
@@ -283,7 +283,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"
@@ -349,7 +349,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"
@@ -411,7 +411,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"
@@ -492,7 +492,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"
@@ -558,7 +558,7 @@ TEST_F(CheckQuorumForInitiate, QuorumCheckFailedDueToInitializedNodeOnlyOneRespo
//
// Compare to QuorumCheckFailedDueToInitializedNode, above.
- const ReplicaSetConfig rsConfig =
+ const ReplSetConfig rsConfig =
assertMakeRSConfig(BSON("_id"
<< "rs0"
<< "version"
@@ -619,7 +619,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"
@@ -677,7 +677,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"
@@ -732,7 +732,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"
@@ -786,7 +786,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"
@@ -851,7 +851,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"
@@ -908,7 +908,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 790dfede040..9a6efec3f83 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 dc644874d5b..1361c544b6e 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);
@@ -90,14 +90,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()
@@ -126,7 +126,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());
@@ -136,7 +136,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");
@@ -161,13 +161,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;
@@ -178,16 +178,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());
@@ -217,15 +216,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());
@@ -254,11 +253,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 40cd0786e9d..5bc3fd48984 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();
@@ -110,14 +110,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);
@@ -135,7 +135,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());
@@ -147,7 +147,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(
@@ -162,15 +162,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());
@@ -207,15 +207,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());
@@ -232,15 +232,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());
@@ -285,15 +285,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());
@@ -335,15 +335,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());
@@ -388,15 +388,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());
@@ -443,7 +443,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();
@@ -452,24 +452,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());
}
@@ -512,24 +512,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;
@@ -585,24 +585,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());
}
@@ -647,24 +647,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());
}
@@ -709,24 +709,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;
@@ -787,24 +787,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());
}
@@ -851,7 +851,7 @@ public:
int selfConfigIndex = 0;
Timestamp lastOpTimeApplied(100, 0);
- ReplicaSetConfig config;
+ ReplSetConfig config;
config.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -865,7 +865,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 9e34741c70a..b1778d002ea 100644
--- a/src/mongo/db/repl/freshness_scanner_test.cpp
+++ b/src/mongo/db/repl/freshness_scanner_test.cpp
@@ -120,7 +120,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 b7d4dd45cdd..2a0646d02fc 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())
@@ -271,9 +271,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
@@ -284,7 +283,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());
@@ -294,8 +293,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 90d3fc7e074..60a70599ba2 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"
@@ -137,7 +137,7 @@ TEST(MemberConfig, ParseArbiterOnly) {
}
TEST(MemberConfig, ParseHidden) {
- ReplicaSetTagConfig tagConfig;
+ ReplSetTagConfig tagConfig;
MemberConfig mc;
ASSERT_OK(mc.initialize(BSON("_id" << 0 << "host"
<< "h"
@@ -160,7 +160,7 @@ TEST(MemberConfig, ParseHidden) {
}
TEST(MemberConfig, ParseBuildIndexes) {
- ReplicaSetTagConfig tagConfig;
+ ReplSetTagConfig tagConfig;
MemberConfig mc;
ASSERT_OK(mc.initialize(BSON("_id" << 0 << "host"
<< "h"
@@ -177,7 +177,7 @@ TEST(MemberConfig, ParseBuildIndexes) {
}
TEST(MemberConfig, ParseVotes) {
- ReplicaSetTagConfig tagConfig;
+ ReplSetTagConfig tagConfig;
MemberConfig mc;
ASSERT_OK(mc.initialize(BSON("_id" << 0 << "host"
<< "h"
@@ -228,7 +228,7 @@ TEST(MemberConfig, ParseVotes) {
}
TEST(MemberConfig, ParsePriority) {
- ReplicaSetTagConfig tagConfig;
+ ReplSetTagConfig tagConfig;
MemberConfig mc;
ASSERT_OK(mc.initialize(BSON("_id" << 0 << "host"
<< "h"
@@ -258,7 +258,7 @@ TEST(MemberConfig, ParsePriority) {
}
TEST(MemberConfig, ParseSlaveDelay) {
- ReplicaSetTagConfig tagConfig;
+ ReplSetTagConfig tagConfig;
MemberConfig mc;
ASSERT_OK(mc.initialize(BSON("_id" << 0 << "host"
<< "h"
@@ -269,7 +269,7 @@ TEST(MemberConfig, ParseSlaveDelay) {
}
TEST(MemberConfig, ParseTags) {
- ReplicaSetTagConfig tagConfig;
+ ReplSetTagConfig tagConfig;
MemberConfig mc;
ASSERT_OK(mc.initialize(BSON("_id" << 0 << "host"
<< "h"
@@ -290,7 +290,7 @@ TEST(MemberConfig, ParseTags) {
}
TEST(MemberConfig, ValidateFailsWithIdOutOfRange) {
- ReplicaSetTagConfig tagConfig;
+ ReplSetTagConfig tagConfig;
MemberConfig mc;
ASSERT_OK(mc.initialize(BSON("_id" << -1 << "host"
<< "localhost:12345"),
@@ -303,7 +303,7 @@ TEST(MemberConfig, ValidateFailsWithIdOutOfRange) {
}
TEST(MemberConfig, ValidateVotes) {
- ReplicaSetTagConfig tagConfig;
+ ReplSetTagConfig tagConfig;
MemberConfig mc;
ASSERT_OK(mc.initialize(BSON("_id" << 0 << "host"
@@ -370,7 +370,7 @@ TEST(MemberConfig, ValidateVotes) {
}
TEST(MemberConfig, ValidatePriorityRanges) {
- ReplicaSetTagConfig tagConfig;
+ ReplSetTagConfig tagConfig;
MemberConfig mc;
ASSERT_OK(mc.initialize(BSON("_id" << 0 << "host"
<< "h"
@@ -399,7 +399,7 @@ TEST(MemberConfig, ValidatePriorityRanges) {
}
TEST(MemberConfig, ValidateSlaveDelays) {
- ReplicaSetTagConfig tagConfig;
+ ReplSetTagConfig tagConfig;
MemberConfig mc;
ASSERT_OK(mc.initialize(BSON("_id" << 0 << "host"
<< "h"
@@ -436,7 +436,7 @@ TEST(MemberConfig, ValidateSlaveDelays) {
}
TEST(MemberConfig, ValidatePriorityAndSlaveDelayRelationship) {
- ReplicaSetTagConfig tagConfig;
+ ReplSetTagConfig tagConfig;
MemberConfig mc;
ASSERT_OK(mc.initialize(BSON("_id" << 0 << "host"
<< "h"
@@ -449,7 +449,7 @@ TEST(MemberConfig, ValidatePriorityAndSlaveDelayRelationship) {
}
TEST(MemberConfig, ValidatePriorityAndHiddenRelationship) {
- ReplicaSetTagConfig tagConfig;
+ ReplSetTagConfig tagConfig;
MemberConfig mc;
ASSERT_OK(mc.initialize(BSON("_id" << 0 << "host"
<< "h"
@@ -470,7 +470,7 @@ TEST(MemberConfig, ValidatePriorityAndHiddenRelationship) {
}
TEST(MemberConfig, ValidatePriorityAndBuildIndexesRelationship) {
- ReplicaSetTagConfig tagConfig;
+ ReplSetTagConfig tagConfig;
MemberConfig mc;
ASSERT_OK(mc.initialize(BSON("_id" << 0 << "host"
<< "h"
@@ -492,7 +492,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 5378689027e..d8aacca5a04 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.
@@ -275,7 +275,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 e87e18a41ce..9ed1fdbe63a 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 1bb24aeb1bf..f7140cc56bf 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
@@ -568,21 +568,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();
@@ -613,12 +613,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) {
@@ -628,7 +628,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) {
@@ -640,7 +640,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) {
@@ -651,39 +651,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));
@@ -696,10 +695,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);
@@ -725,7 +724,7 @@ void ReplicaSetConfig::_addInternalWriteConcernModes() {
}
}
-void ReplicaSetConfig::_initializeConnectionString() {
+void ReplSetConfig::_initializeConnectionString() {
std::vector<HostAndPort> visibleMembers;
for (const auto& member : _members) {
if (!member.isHidden() && !member.isArbiter()) {
@@ -742,7 +741,7 @@ void ReplicaSetConfig::_initializeConnectionString() {
}
}
-BSONObj ReplicaSetConfig::toBSON() const {
+BSONObj ReplSetConfig::toBSON() const {
BSONObjBuilder configBuilder;
configBuilder.append(kIdFieldName, _replSetName);
configBuilder.appendIntOrLL(kVersionFieldName, _version);
@@ -752,12 +751,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);
@@ -786,7 +785,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] == '$') {
@@ -794,10 +793,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();
@@ -814,9 +813,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);
@@ -824,13 +823,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 c302aada912..078ed2b77ab 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()) {
@@ -126,8 +126,8 @@ StatusWith<int> findSelfInConfigIfElectable(ReplicationCoordinatorExternalState*
* Checks that the priorities of all the arbiters in the configuration are 0. If they were 1,
* they should have been set to 0 in MemberConfig::initialize(). Otherwise, they are illegal.
*/
-Status validateArbiterPriorities(const ReplicaSetConfig& config) {
- for (ReplicaSetConfig::MemberIterator iter = config.membersBegin(); iter != config.membersEnd();
+Status validateArbiterPriorities(const ReplSetConfig& config) {
+ for (ReplSetConfig::MemberIterator iter = config.membersBegin(); iter != config.membersEnd();
++iter) {
if (iter->isArbiter() && iter->getPriority() != 0) {
return Status(ErrorCodes::InvalidReplicaSetConfig,
@@ -154,8 +154,8 @@ Status validateArbiterPriorities(const ReplicaSetConfig& config) {
* 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());
@@ -190,8 +190,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");
}
@@ -203,10 +202,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();
@@ -257,8 +256,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()) {
@@ -274,7 +273,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()) {
@@ -304,8 +303,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();
@@ -340,7 +339,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 7463cfdf742..c068cdb364a 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"
@@ -116,7 +116,7 @@ TEST(ValidateConfigForInitiate, SelfMustBeElectable) {
}
TEST(ValidateConfigForInitiate, WriteConcernMustBeSatisfiable) {
- ReplicaSetConfig config;
+ ReplSetConfig config;
ASSERT_OK(
config.initializeForInitiate(BSON("_id"
<< "rs0"
@@ -137,9 +137,9 @@ TEST(ValidateConfigForInitiate, WriteConcernMustBeSatisfiable) {
}
TEST(ValidateConfigForInitiate, ArbiterPriorityMustBeZeroOrOne) {
- ReplicaSetConfig zeroConfig;
- ReplicaSetConfig oneConfig;
- ReplicaSetConfig twoConfig;
+ ReplSetConfig zeroConfig;
+ ReplSetConfig oneConfig;
+ ReplSetConfig twoConfig;
ASSERT_OK(zeroConfig.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -206,8 +206,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"
@@ -270,8 +270,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"
@@ -315,8 +315,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"
@@ -366,9 +366,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.
@@ -442,9 +442,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.
@@ -515,10 +515,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"
@@ -611,7 +611,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"
@@ -624,7 +624,7 @@ TEST(ValidateConfigForReconfig, MustFindSelf) {
<< BSON("_id" << 3 << "host"
<< "h3")))));
- ReplicaSetConfig newConfig;
+ ReplSetConfig newConfig;
ASSERT_OK(newConfig.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -679,10 +679,10 @@ TEST(ValidateConfigForReconfig, ArbiterPriorityValueMustBeZeroOrOne) {
ReplicationCoordinatorExternalStateMock externalState;
externalState.addSelf(HostAndPort("h1"));
- ReplicaSetConfig oldConfig;
- ReplicaSetConfig zeroConfig;
- ReplicaSetConfig oneConfig;
- ReplicaSetConfig twoConfig;
+ ReplSetConfig oldConfig;
+ ReplSetConfig zeroConfig;
+ ReplSetConfig oneConfig;
+ ReplSetConfig twoConfig;
ASSERT_OK(oldConfig.initialize(BSON("_id"
<< "rs0"
@@ -768,7 +768,7 @@ TEST(ValidateConfigForReconfig, ArbiterPriorityValueMustBeZeroOrOne) {
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"
@@ -781,7 +781,7 @@ TEST(ValidateConfigForReconfig, SelfMustEndElectable) {
<< BSON("_id" << 3 << "host"
<< "h3")))));
- ReplicaSetConfig newConfig;
+ ReplSetConfig newConfig;
ASSERT_OK(newConfig.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -813,7 +813,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"
@@ -836,7 +836,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"
@@ -845,7 +845,7 @@ TEST(ValidateConfigForReconfig, NewConfigInvalid) {
<< BSON_ARRAY(BSON("_id" << 0 << "host"
<< "h2")))));
- ReplicaSetConfig newConfig;
+ ReplSetConfig newConfig;
ASSERT_OK(newConfig.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -875,7 +875,7 @@ TEST(ValidateConfigForReconfig, NewConfigWriteConcernNotSatisifiable) {
// The new config is not valid due to an unsatisfiable write concern. 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"
@@ -884,7 +884,7 @@ TEST(ValidateConfigForReconfig, NewConfigWriteConcernNotSatisifiable) {
<< BSON_ARRAY(BSON("_id" << 0 << "host"
<< "h2")))));
- ReplicaSetConfig newConfig;
+ ReplSetConfig newConfig;
ASSERT_OK(newConfig.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -914,7 +914,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"
@@ -923,7 +923,7 @@ TEST(ValidateConfigForStartUp, NewConfigInvalid) {
<< BSON_ARRAY(BSON("_id" << 0 << "host"
<< "h2")))));
- ReplicaSetConfig newConfig;
+ ReplSetConfig newConfig;
ASSERT_OK(newConfig.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -946,7 +946,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"
@@ -958,7 +958,7 @@ TEST(ValidateConfigForStartUp, OldAndNewConfigIncompatible) {
<< "h3")))));
- ReplicaSetConfig newConfig;
+ ReplSetConfig newConfig;
ASSERT_OK(newConfig.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -981,7 +981,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"
@@ -993,7 +993,7 @@ TEST(ValidateConfigForStartUp, OldAndNewConfigCompatible) {
<< "h3")))));
- ReplicaSetConfig newConfig;
+ ReplSetConfig newConfig;
ASSERT_OK(newConfig.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -1017,7 +1017,7 @@ TEST(ValidateConfigForStartUp, NewConfigWriteConcernNotSatisfiable) {
// The new config contains an unsatisfiable write concern. We don't allow these configs to be
// created anymore, but we allow any which exist to pass and the database to start up to
// maintain backwards compatibility.
- ReplicaSetConfig oldConfig;
+ ReplSetConfig oldConfig;
ASSERT_OK(oldConfig.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -1026,7 +1026,7 @@ TEST(ValidateConfigForStartUp, NewConfigWriteConcernNotSatisfiable) {
<< BSON_ARRAY(BSON("_id" << 0 << "host"
<< "h2")))));
- ReplicaSetConfig newConfig;
+ ReplSetConfig newConfig;
ASSERT_OK(newConfig.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -1048,7 +1048,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"
@@ -1070,7 +1070,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"
@@ -1091,7 +1091,7 @@ TEST(ValidateConfigForHeartbeatReconfig, NewConfigValid) {
TEST(ValidateConfigForHeartbeatReconfig, NewConfigWriteConcernNotSatisfiable) {
// The new config contains an unsatisfiable write concern. We don't allow these configs to be
// created anymore, but we allow any which exist to be received in a heartbeat.
- ReplicaSetConfig newConfig;
+ ReplSetConfig newConfig;
ASSERT_OK(newConfig.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -1114,7 +1114,7 @@ TEST(ValidateConfigForHeartbeatReconfig, NewConfigWriteConcernNotSatisfiable) {
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"
@@ -1126,7 +1126,7 @@ TEST(ValidateForReconfig, ForceStillNeedsValidConfig) {
<< "h3")))));
- ReplicaSetConfig newConfig;
+ ReplSetConfig newConfig;
ASSERT_OK(newConfig.initialize(BSON("_id"
<< "rs0"
<< "version"
@@ -1149,7 +1149,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"
@@ -1161,7 +1161,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 2fa1f8240ba..1d3dda6f5b6 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;
@@ -542,9 +542,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 b4b2b7cf3db..8ad99d7e24a 100644
--- a/src/mongo/db/repl/replication_coordinator_impl.cpp
+++ b/src/mongo/db/repl/replication_coordinator_impl.cpp
@@ -55,13 +55,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"
@@ -125,10 +125,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);
@@ -370,7 +370,7 @@ void ReplicationCoordinatorImpl::_waitForStartUpComplete() {
}
}
-ReplicaSetConfig ReplicationCoordinatorImpl::getReplicaSetConfig_forTest() {
+ReplSetConfig ReplicationCoordinatorImpl::getReplicaSetConfig_forTest() {
stdx::lock_guard<stdx::mutex> lk(_mutex);
return _rsConfig;
}
@@ -432,7 +432,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 "
@@ -465,7 +465,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()) {
@@ -1532,12 +1532,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;
}
@@ -1569,8 +1569,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) {
@@ -2132,7 +2132,7 @@ void ReplicationCoordinatorImpl::_appendSlaveInfoData_inlock(BSONObjBuilder* res
}
}
-ReplicaSetConfig ReplicationCoordinatorImpl::getConfig() const {
+ReplSetConfig ReplicationCoordinatorImpl::getConfig() const {
stdx::lock_guard<stdx::mutex> lock(_mutex);
return _rsConfig;
}
@@ -2339,10 +2339,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);
@@ -2416,9 +2416,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);
@@ -2448,7 +2446,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.
@@ -2495,7 +2493,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;
@@ -2553,7 +2551,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;
@@ -3569,7 +3567,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 698e3052035..5b2722eaab2 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;
@@ -200,7 +200,7 @@ public:
virtual void appendSlaveInfoData(BSONObjBuilder* result) override;
- virtual ReplicaSetConfig getConfig() const override;
+ virtual ReplSetConfig getConfig() const override;
virtual void processReplSetGetConfig(BSONObjBuilder* result) override;
@@ -340,7 +340,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.
@@ -596,7 +596,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);
/**
@@ -649,7 +649,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;
@@ -800,7 +800,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);
@@ -819,14 +819,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);
/**
@@ -944,26 +944,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);
/**
@@ -1072,8 +1072,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.
@@ -1273,7 +1273,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 c25e4462cb2..e3660682e3c 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()));
@@ -1439,7 +1439,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();
@@ -1464,7 +1464,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();
@@ -1494,7 +1494,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) {
@@ -1518,7 +1518,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();
@@ -1546,7 +1546,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();
@@ -1580,7 +1580,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 ad38191066c..602f3cb5f40 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"
@@ -397,7 +397,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;
@@ -445,7 +445,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;
}
@@ -464,7 +464,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();
@@ -545,7 +545,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;
@@ -614,7 +614,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 3fd13b767a4..3cb0d2d9e3b 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 9bb69775072..e72083ef012 100644
--- a/src/mongo/db/repl/replication_coordinator_mock.cpp
+++ b/src/mongo/db/repl/replication_coordinator_mock.cpp
@@ -253,11 +253,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 296652f5607..4b3fd99d3ce 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"
@@ -156,7 +156,7 @@ public:
void appendConnectionStats(executor::ConnectionPoolStats* stats) const override;
- virtual ReplicaSetConfig getConfig() const;
+ virtual ReplSetConfig getConfig() const;
virtual void processReplSetGetConfig(BSONObjBuilder* result);
@@ -273,7 +273,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.
@@ -293,7 +293,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 8140513c139..43dff9b4c06 100644
--- a/src/mongo/db/repl/replication_coordinator_test_fixture.cpp
+++ b/src/mongo/db/repl/replication_coordinator_test_fixture.cpp
@@ -60,14 +60,14 @@ ReplicationExecutor* ReplCoordTest::getReplExec() {
return _repl->getExecutor();
}
-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));
}
@@ -212,7 +212,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) {
@@ -243,7 +243,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();
@@ -305,7 +305,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
@@ -376,7 +376,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
@@ -447,7 +447,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;
@@ -467,7 +467,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 3d8587ffbd1..b9b05e46172 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 e7bd15455a0..2633e058e44 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 50fbfe820b3..277df2f9a9d 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/balancer/migration_manager.cpp b/src/mongo/db/s/balancer/migration_manager.cpp
index 996249a298a..7882201e8c2 100644
--- a/src/mongo/db/s/balancer/migration_manager.cpp
+++ b/src/mongo/db/s/balancer/migration_manager.cpp
@@ -38,7 +38,7 @@
#include "mongo/bson/util/bson_extract.h"
#include "mongo/client/remote_command_targeter.h"
#include "mongo/db/client.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/s/balancer/scoped_migration_request.h"
#include "mongo/db/s/balancer/type_migration.h"
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"