summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/check_quorum_for_config_change_test.cpp
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/repl/check_quorum_for_config_change_test.cpp
parent59681ee6603fc43f0f3209ec0f9c6a09476edfcc (diff)
downloadmongo-5b5cf72ed9e52d71ed9f41b2219080fe46f62a3a.tar.gz
SERVER-27995 make repl_set* naming convention consistent
Diffstat (limited to 'src/mongo/db/repl/check_quorum_for_config_change_test.cpp')
-rw-r--r--src/mongo/db/repl/check_quorum_for_config_change_test.cpp104
1 files changed, 52 insertions, 52 deletions
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"