summaryrefslogtreecommitdiff
path: root/src/mongo/db
diff options
context:
space:
mode:
authorAndy Schwerin <schwerin@mongodb.com>2014-09-09 17:54:39 -0400
committerAndy Schwerin <schwerin@mongodb.com>2014-09-10 09:32:47 -0400
commitadfc53c325d95826940a60891b11a2199aca4735 (patch)
treeb56711eb406780a4605d9de458461a940c244415 /src/mongo/db
parent05df4fe1e691fcc03369ce64ac6d177d50b7778d (diff)
downloadmongo-adfc53c325d95826940a60891b11a2199aca4735.tar.gz
SERVER-15080 Move HeartbeatResponseAction and TopologyCoordinator::Role for readability.
HeartbeatResponseAction moves to its own file and becomes a top-level type, because it is sometimes useful to have its definition without that of TopologyCoordinator, and because it clutters the TopologyCoordinator class definition. TopologyCoordinator::Role gets defined at the end of the topology_coordinator.h header, so it also does not clutter the TopologyCoordinator class definition.
Diffstat (limited to 'src/mongo/db')
-rw-r--r--src/mongo/db/repl/SConscript1
-rw-r--r--src/mongo/db/repl/heartbeat_response_action.cpp77
-rw-r--r--src/mongo/db/repl/heartbeat_response_action.h120
-rw-r--r--src/mongo/db/repl/topology_coordinator.cpp45
-rw-r--r--src/mongo/db/repl/topology_coordinator.h167
-rw-r--r--src/mongo/db/repl/topology_coordinator_impl.cpp11
-rw-r--r--src/mongo/db/repl/topology_coordinator_impl_test.cpp37
7 files changed, 261 insertions, 197 deletions
diff --git a/src/mongo/db/repl/SConscript b/src/mongo/db/repl/SConscript
index f145368ed45..ac15702fabe 100644
--- a/src/mongo/db/repl/SConscript
+++ b/src/mongo/db/repl/SConscript
@@ -35,6 +35,7 @@ env.CppUnitTest('replication_executor_test',
env.Library('topology_coordinator',
[
+ 'heartbeat_response_action.cpp',
'topology_coordinator.cpp',
],
LIBDEPS=[
diff --git a/src/mongo/db/repl/heartbeat_response_action.cpp b/src/mongo/db/repl/heartbeat_response_action.cpp
new file mode 100644
index 00000000000..4f26bc2953e
--- /dev/null
+++ b/src/mongo/db/repl/heartbeat_response_action.cpp
@@ -0,0 +1,77 @@
+/**
+ * Copyright (C) 2014 MongoDB Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * As a special exception, the copyright holders give permission to link the
+ * code of portions of this program with the OpenSSL library under certain
+ * conditions as described in each individual source file and distribute
+ * linked combinations including the program with the OpenSSL library. You
+ * must comply with the GNU Affero General Public License in all respects for
+ * all of the code used other than as permitted herein. If you modify file(s)
+ * with this exception, you may extend this exception to your version of the
+ * file(s), but you are not obligated to do so. If you do not wish to do so,
+ * delete this exception statement from your version. If you delete this
+ * exception statement from all source files in the program, then also delete
+ * it in the license file.
+ */
+
+#include "mongo/platform/basic.h"
+
+#include "mongo/db/repl/heartbeat_response_action.h"
+
+namespace mongo {
+namespace repl {
+
+ HeartbeatResponseAction HeartbeatResponseAction::makeNoAction() {
+ return HeartbeatResponseAction();
+ }
+
+ HeartbeatResponseAction HeartbeatResponseAction::makeReconfigAction() {
+ HeartbeatResponseAction result;
+ result._action = Reconfig;
+ return result;
+ }
+
+ HeartbeatResponseAction HeartbeatResponseAction::makeElectAction() {
+ HeartbeatResponseAction result;
+ result._action = StartElection;
+ return result;
+ }
+
+ HeartbeatResponseAction HeartbeatResponseAction::makeStepDownSelfAction(int primaryIndex) {
+ HeartbeatResponseAction result;
+ result._action = StepDownSelf;
+ result._primaryIndex = primaryIndex;
+ return result;
+ }
+
+ HeartbeatResponseAction HeartbeatResponseAction::makeStepDownRemoteAction(int primaryIndex) {
+ HeartbeatResponseAction result;
+ result._action = StepDownRemotePrimary;
+ result._primaryIndex = primaryIndex;
+ return result;
+ }
+
+ HeartbeatResponseAction::HeartbeatResponseAction() :
+ _action(NoAction),
+ _primaryIndex(-1),
+ _nextHeartbeatStartDate(0) {
+ }
+
+ void HeartbeatResponseAction::setNextHeartbeatStartDate(Date_t when) {
+ _nextHeartbeatStartDate = when;
+ }
+
+} // namespace repl
+} // namespace mongo
diff --git a/src/mongo/db/repl/heartbeat_response_action.h b/src/mongo/db/repl/heartbeat_response_action.h
new file mode 100644
index 00000000000..55c2d459920
--- /dev/null
+++ b/src/mongo/db/repl/heartbeat_response_action.h
@@ -0,0 +1,120 @@
+/**
+ * Copyright (C) 2014 MongoDB Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * As a special exception, the copyright holders give permission to link the
+ * code of portions of this program with the OpenSSL library under certain
+ * conditions as described in each individual source file and distribute
+ * linked combinations including the program with the OpenSSL library. You
+ * must comply with the GNU Affero General Public License in all respects for
+ * all of the code used other than as permitted herein. If you modify file(s)
+ * with this exception, you may extend this exception to your version of the
+ * file(s), but you are not obligated to do so. If you do not wish to do so,
+ * delete this exception statement from your version. If you delete this
+ * exception statement from all source files in the program, then also delete
+ * it in the license file.
+ */
+
+#pragma once
+
+#include "mongo/util/time_support.h"
+
+namespace mongo {
+namespace repl {
+
+ /**
+ * Description of actions taken in response to a heartbeat.
+ *
+ * This includes when to schedule the next heartbeat to a target, and any other actions to
+ * take, such as scheduling an election or stepping down as primary.
+ */
+ class HeartbeatResponseAction {
+ public:
+ /**
+ * Actions taken based on heartbeat responses
+ */
+ enum Action {
+ NoAction,
+ Reconfig,
+ StartElection,
+ StepDownSelf,
+ StepDownRemotePrimary
+ };
+
+ /**
+ * Makes a new action representing doing nothing.
+ */
+ static HeartbeatResponseAction makeNoAction();
+
+ /**
+ * Makes a new action representing the instruction to reconfigure the current node.
+ */
+ static HeartbeatResponseAction makeReconfigAction();
+
+ /**
+ * Makes a new action telling the current node to attempt to elect itself primary.
+ */
+ static HeartbeatResponseAction makeElectAction();
+
+ /**
+ * Makes a new action telling the current node to step down as primary.
+ *
+ * It is an error to call this with primaryIndex != the index of the current node.
+ */
+ static HeartbeatResponseAction makeStepDownSelfAction(int primaryIndex);
+
+ /**
+ * Makes a new action telling the current node to ask the specified remote node to step
+ * down as primary.
+ *
+ * It is an error to call this with primaryIndex == the index of the current node.
+ */
+ static HeartbeatResponseAction makeStepDownRemoteAction(int primaryIndex);
+
+ /**
+ * Construct an action with unspecified action and a next heartbeat start date in the
+ * past.
+ */
+ HeartbeatResponseAction();
+
+ /**
+ * Sets the date at which the next heartbeat should be scheduled.
+ */
+ void setNextHeartbeatStartDate(Date_t when);
+
+ /**
+ * Gets the action type of this action.
+ */
+ Action getAction() const { return _action; }
+
+ /**
+ * Gets the time at which the next heartbeat should be scheduled. If the
+ * time is not in the future, the next heartbeat should be scheduled immediately.
+ */
+ Date_t getNextHeartbeatStartDate() const { return _nextHeartbeatStartDate; }
+
+ /**
+ * If getAction() returns StepDownSelf or StepDownPrimary, this is the index
+ * in the current replica set config of the node that ought to step down.
+ */
+ int getPrimaryConfigIndex() const { return _primaryIndex; }
+
+ private:
+ Action _action;
+ int _primaryIndex;
+ Date_t _nextHeartbeatStartDate;
+ };
+
+} // namespace repl
+} // namespace mongo
diff --git a/src/mongo/db/repl/topology_coordinator.cpp b/src/mongo/db/repl/topology_coordinator.cpp
index 4d244d2e103..99738a38421 100644
--- a/src/mongo/db/repl/topology_coordinator.cpp
+++ b/src/mongo/db/repl/topology_coordinator.cpp
@@ -64,50 +64,5 @@ namespace {
TopologyCoordinator::~TopologyCoordinator() {}
- TopologyCoordinator::HeartbeatResponseAction
- TopologyCoordinator::HeartbeatResponseAction::makeNoAction() {
- return HeartbeatResponseAction();
- }
-
- TopologyCoordinator::HeartbeatResponseAction
- TopologyCoordinator::HeartbeatResponseAction::makeReconfigAction() {
- HeartbeatResponseAction result;
- result._action = Reconfig;
- return result;
- }
-
- TopologyCoordinator::HeartbeatResponseAction
- TopologyCoordinator::HeartbeatResponseAction::makeElectAction() {
- HeartbeatResponseAction result;
- result._action = StartElection;
- return result;
- }
-
- TopologyCoordinator::HeartbeatResponseAction
- TopologyCoordinator::HeartbeatResponseAction::makeStepDownSelfAction(int primaryIndex) {
- HeartbeatResponseAction result;
- result._action = StepDownSelf;
- result._primaryIndex = primaryIndex;
- return result;
- }
-
- TopologyCoordinator::HeartbeatResponseAction
- TopologyCoordinator::HeartbeatResponseAction::makeStepDownRemoteAction(int primaryIndex) {
- HeartbeatResponseAction result;
- result._action = StepDownRemotePrimary;
- result._primaryIndex = primaryIndex;
- return result;
- }
-
- TopologyCoordinator::HeartbeatResponseAction::HeartbeatResponseAction() :
- _action(NoAction),
- _primaryIndex(-1),
- _nextHeartbeatStartDate(0) {
- }
-
- void TopologyCoordinator::HeartbeatResponseAction::setNextHeartbeatStartDate(Date_t when) {
- _nextHeartbeatStartDate = when;
- }
-
} // namespace repl
} // namespace mongo
diff --git a/src/mongo/db/repl/topology_coordinator.h b/src/mongo/db/repl/topology_coordinator.h
index 2a5edb5da44..4aa76f8e107 100644
--- a/src/mongo/db/repl/topology_coordinator.h
+++ b/src/mongo/db/repl/topology_coordinator.h
@@ -45,10 +45,11 @@ namespace mongo {
namespace repl {
- struct MemberState;
- class ReplicaSetConfig;
+ class HeartbeatResponseAction;
class ReplSetHeartbeatArgs;
+ class ReplicaSetConfig;
class TagSubgroup;
+ struct MemberState;
/**
* Replication Topology Coordinator interface.
@@ -60,127 +61,7 @@ namespace repl {
class TopologyCoordinator {
MONGO_DISALLOW_COPYING(TopologyCoordinator);
public:
- /**
- * Type that denotes the role of a node in the replication protocol.
- *
- * The role is distinct from MemberState, in that it only deals with the
- * roles a node plays in the basic protocol -- leader, follower and candidate.
- * The mapping between MemberState and Role is complex -- several MemberStates
- * map to the follower role, and MemberState::RS_SECONDARY maps to either
- * follower or candidate roles, e.g.
- */
- class Role {
- public:
- /**
- * Constant indicating leader role.
- */
- static const Role leader;
-
- /**
- * Constant indicating follower role.
- */
- static const Role follower;
-
- /**
- * Constant indicating candidate role
- */
- static const Role candidate;
-
- Role() {}
-
- bool operator==(Role other) const { return _value == other._value; }
- bool operator!=(Role other) const { return _value != other._value; }
-
- std::string toString() const;
-
- private:
- explicit Role(int value);
-
- int _value;
- };
-
- /**
- * Description of actions taken in response to a heartbeat.
- *
- * This includes when to schedule the next heartbeat to a target, and any other actions to
- * take, such as scheduling an election or stepping down as primary.
- */
- class HeartbeatResponseAction {
- public:
- /**
- * Actions taken based on heartbeat responses
- */
- enum Action {
- NoAction,
- Reconfig,
- StartElection,
- StepDownSelf,
- StepDownRemotePrimary
- };
-
- /**
- * Makes a new action representing doing nothing.
- */
- static HeartbeatResponseAction makeNoAction();
-
- /**
- * Makes a new action representing the instruction to reconfigure the current node.
- */
- static HeartbeatResponseAction makeReconfigAction();
-
- /**
- * Makes a new action telling the current node to attempt to elect itself primary.
- */
- static HeartbeatResponseAction makeElectAction();
-
- /**
- * Makes a new action telling the current node to step down as primary.
- *
- * It is an error to call this with primaryIndex != the index of the current node.
- */
- static HeartbeatResponseAction makeStepDownSelfAction(int primaryIndex);
-
- /**
- * Makes a new action telling the current node to ask the specified remote node to step
- * down as primary.
- *
- * It is an error to call this with primaryIndex == the index of the current node.
- */
- static HeartbeatResponseAction makeStepDownRemoteAction(int primaryIndex);
-
- /**
- * Construct an action with unspecified action and a next heartbeat start date in the
- * past.
- */
- HeartbeatResponseAction();
-
- /**
- * Sets the date at which the next heartbeat should be scheduled.
- */
- void setNextHeartbeatStartDate(Date_t when);
-
- /**
- * Gets the action type of this action.
- */
- Action getAction() const { return _action; }
-
- /**
- * Gets the time at which the next heartbeat should be scheduled. If the
- * time is not in the future, the next heartbeat should be scheduled immediately.
- */
- Date_t getNextHeartbeatStartDate() const { return _nextHeartbeatStartDate; }
-
- /**
- * If getAction() returns StepDownSelf or StepDownPrimary, this is the index
- * in the current replica set config of the node that ought to step down.
- */
- int getPrimaryConfigIndex() const { return _primaryIndex; }
-
- private:
- Action _action;
- int _primaryIndex;
- Date_t _nextHeartbeatStartDate;
- };
+ class Role;
virtual ~TopologyCoordinator();
@@ -430,5 +311,45 @@ namespace repl {
protected:
TopologyCoordinator() {}
};
+
+ /**
+ * Type that denotes the role of a node in the replication protocol.
+ *
+ * The role is distinct from MemberState, in that it only deals with the
+ * roles a node plays in the basic protocol -- leader, follower and candidate.
+ * The mapping between MemberState and Role is complex -- several MemberStates
+ * map to the follower role, and MemberState::RS_SECONDARY maps to either
+ * follower or candidate roles, e.g.
+ */
+ class TopologyCoordinator::Role {
+ public:
+ /**
+ * Constant indicating leader role.
+ */
+ static const Role leader;
+
+ /**
+ * Constant indicating follower role.
+ */
+ static const Role follower;
+
+ /**
+ * Constant indicating candidate role
+ */
+ static const Role candidate;
+
+ Role() {}
+
+ bool operator==(Role other) const { return _value == other._value; }
+ bool operator!=(Role other) const { return _value != other._value; }
+
+ std::string toString() const;
+
+ private:
+ explicit Role(int value);
+
+ int _value;
+ };
+
} // namespace repl
} // namespace mongo
diff --git a/src/mongo/db/repl/topology_coordinator_impl.cpp b/src/mongo/db/repl/topology_coordinator_impl.cpp
index fa9a4f24ded..1c738e152e2 100644
--- a/src/mongo/db/repl/topology_coordinator_impl.cpp
+++ b/src/mongo/db/repl/topology_coordinator_impl.cpp
@@ -35,6 +35,7 @@
#include <limits>
#include "mongo/db/operation_context.h"
+#include "mongo/db/repl/heartbeat_response_action.h"
#include "mongo/db/repl/isself.h"
#include "mongo/db/repl/repl_set_heartbeat_args.h"
#include "mongo/db/repl/repl_set_heartbeat_response.h"
@@ -678,7 +679,7 @@ namespace {
}
} // namespace
- TopologyCoordinator::HeartbeatResponseAction TopologyCoordinatorImpl::processHeartbeatResponse(
+ HeartbeatResponseAction TopologyCoordinatorImpl::processHeartbeatResponse(
Date_t now,
Milliseconds networkRoundTripTime,
const HostAndPort& target,
@@ -771,8 +772,7 @@ namespace {
return nextAction;
}
- TopologyCoordinatorImpl::HeartbeatResponseAction
- TopologyCoordinatorImpl::_updateHeartbeatDataImpl(
+ HeartbeatResponseAction TopologyCoordinatorImpl::_updateHeartbeatDataImpl(
int updatedConfigIndex,
Date_t now,
const OpTime& lastOpApplied) {
@@ -1511,12 +1511,11 @@ namespace {
}
}
- TopologyCoordinator::HeartbeatResponseAction TopologyCoordinatorImpl::_stepDownSelf() {
+ HeartbeatResponseAction TopologyCoordinatorImpl::_stepDownSelf() {
return _stepDownSelfAndReplaceWith(-1);
}
- TopologyCoordinator::HeartbeatResponseAction
- TopologyCoordinatorImpl::_stepDownSelfAndReplaceWith(int newPrimary) {
+ HeartbeatResponseAction TopologyCoordinatorImpl::_stepDownSelfAndReplaceWith(int newPrimary) {
invariant(_role == Role::leader);
invariant(_selfIndex != -1);
invariant(_selfIndex != newPrimary);
diff --git a/src/mongo/db/repl/topology_coordinator_impl_test.cpp b/src/mongo/db/repl/topology_coordinator_impl_test.cpp
index c8e77127e00..132a0f0889f 100644
--- a/src/mongo/db/repl/topology_coordinator_impl_test.cpp
+++ b/src/mongo/db/repl/topology_coordinator_impl_test.cpp
@@ -28,6 +28,7 @@
#include "mongo/platform/basic.h"
+#include "mongo/db/repl/heartbeat_response_action.h"
#include "mongo/db/repl/member_heartbeat_data.h"
#include "mongo/db/repl/repl_set_heartbeat_args.h"
#include "mongo/db/repl/repl_set_heartbeat_response.h"
@@ -38,14 +39,12 @@
#include "mongo/util/time_support.h"
#define ASSERT_NO_ACTION(EXPRESSION) \
- ASSERT_EQUALS(mongo::repl::TopologyCoordinator::HeartbeatResponseAction::NoAction, (EXPRESSION))
+ ASSERT_EQUALS(mongo::repl::HeartbeatResponseAction::NoAction, (EXPRESSION))
namespace mongo {
namespace repl {
namespace {
- typedef TopologyCoordinator::HeartbeatResponseAction HeartbeatResponseAction;
-
bool stringContains(const std::string &haystack, const std::string& needle) {
return haystack.find(needle) != std::string::npos;
}
@@ -852,7 +851,7 @@ namespace {
ASSERT_EQUALS(5000, request.second.total_milliseconds());
// Initial heartbeat request fails at t + 4000ms
- TopologyCoordinatorImpl::HeartbeatResponseAction action =
+ HeartbeatResponseAction action =
getTopoCoord().processHeartbeatResponse(
firstRequestDate + 4000, // 4 of the 5 seconds elapsed; could still retry.
Milliseconds(3990), // Spent 3.99 of the 4 seconds in the network.
@@ -860,8 +859,7 @@ namespace {
StatusWith<ReplSetHeartbeatResponse>(ErrorCodes::NodeNotFound, "Bad DNS?"),
OpTime(0, 0)); // We've never applied anything.
- ASSERT_EQUALS(TopologyCoordinatorImpl::HeartbeatResponseAction::NoAction,
- action.getAction());
+ ASSERT_EQUALS(HeartbeatResponseAction::NoAction, action.getAction());
// Because the heartbeat failed without timing out, we expect to retry immediately.
ASSERT_EQUALS(Date_t(firstRequestDate + 4000), action.getNextHeartbeatStartDate());
@@ -882,8 +880,7 @@ namespace {
target,
StatusWith<ReplSetHeartbeatResponse>(ErrorCodes::NodeNotFound, "Bad DNS?"),
OpTime(0, 0)); // We've never applied anything.
- ASSERT_EQUALS(TopologyCoordinatorImpl::HeartbeatResponseAction::NoAction,
- action.getAction());
+ ASSERT_EQUALS(HeartbeatResponseAction::NoAction, action.getAction());
// Because the first retry failed without timing out, we expect to retry immediately.
ASSERT_EQUALS(Date_t(firstRequestDate + 4500), action.getNextHeartbeatStartDate());
@@ -904,8 +901,7 @@ namespace {
target,
StatusWith<ReplSetHeartbeatResponse>(ErrorCodes::NodeNotFound, "Bad DNS?"),
OpTime(0, 0)); // We've never applied anything.
- ASSERT_EQUALS(TopologyCoordinatorImpl::HeartbeatResponseAction::NoAction,
- action.getAction());
+ ASSERT_EQUALS(HeartbeatResponseAction::NoAction, action.getAction());
// Because this is the second retry, rather than retry again, we expect to wait for the
// heartbeat interval of 2 seconds to elapse.
ASSERT_EQUALS(Date_t(firstRequestDate + 6800), action.getNextHeartbeatStartDate());
@@ -927,7 +923,7 @@ namespace {
ASSERT_EQUALS(5000, request.second.total_milliseconds());
// Initial heartbeat request fails at t + 5000ms
- TopologyCoordinatorImpl::HeartbeatResponseAction action =
+ HeartbeatResponseAction action =
getTopoCoord().processHeartbeatResponse(
firstRequestDate + 5000, // Entire heartbeat period elapsed; no retry allowed.
Milliseconds(4990), // Spent 4.99 of the 4 seconds in the network.
@@ -936,8 +932,7 @@ namespace {
"Took too long"),
OpTime(0, 0)); // We've never applied anything.
- ASSERT_EQUALS(TopologyCoordinatorImpl::HeartbeatResponseAction::NoAction,
- action.getAction());
+ ASSERT_EQUALS(HeartbeatResponseAction::NoAction, action.getAction());
// Because the heartbeat timed out, we'll retry in 2 seconds.
ASSERT_EQUALS(Date_t(firstRequestDate + 7000), action.getNextHeartbeatStartDate());
}
@@ -958,7 +953,7 @@ namespace {
ASSERT_EQUALS(5000, request.second.total_milliseconds());
// Initial heartbeat request fails at t + 5000ms
- TopologyCoordinatorImpl::HeartbeatResponseAction action =
+ HeartbeatResponseAction action =
getTopoCoord().processHeartbeatResponse(
firstRequestDate + 4000, // 4 seconds elapsed, retry allowed.
Milliseconds(3990), // Spent 3.99 of the 4 seconds in the network.
@@ -967,8 +962,7 @@ namespace {
"Took too long"),
OpTime(0, 0)); // We've never applied anything.
- ASSERT_EQUALS(TopologyCoordinatorImpl::HeartbeatResponseAction::NoAction,
- action.getAction());
+ ASSERT_EQUALS(HeartbeatResponseAction::NoAction, action.getAction());
// Because the heartbeat failed without timing out, we expect to retry immediately.
ASSERT_EQUALS(Date_t(firstRequestDate + 4000), action.getNextHeartbeatStartDate());
@@ -990,8 +984,7 @@ namespace {
"Took too long"),
OpTime(0, 0)); // We've never applied anything.
- ASSERT_EQUALS(TopologyCoordinatorImpl::HeartbeatResponseAction::NoAction,
- action.getAction());
+ ASSERT_EQUALS(HeartbeatResponseAction::NoAction, action.getAction());
// Because the heartbeat timed out, we'll retry in 2 seconds.
ASSERT_EQUALS(Date_t(firstRequestDate + 7010), action.getNextHeartbeatStartDate());
}
@@ -1012,7 +1005,7 @@ namespace {
ASSERT_EQUALS(5000, request.second.total_milliseconds());
// Initial heartbeat request fails at t + 5000ms
- TopologyCoordinatorImpl::HeartbeatResponseAction action =
+ HeartbeatResponseAction action =
getTopoCoord().processHeartbeatResponse(
firstRequestDate + 4000, // 4 seconds elapsed, retry allowed.
Milliseconds(3990), // Spent 3.99 of the 4 seconds in the network.
@@ -1021,8 +1014,7 @@ namespace {
"Took too long"),
OpTime(0, 0)); // We've never applied anything.
- ASSERT_EQUALS(TopologyCoordinatorImpl::HeartbeatResponseAction::NoAction,
- action.getAction());
+ ASSERT_EQUALS(HeartbeatResponseAction::NoAction, action.getAction());
// Because the heartbeat failed without timing out, we expect to retry immediately.
ASSERT_EQUALS(Date_t(firstRequestDate + 4000), action.getNextHeartbeatStartDate());
@@ -1061,8 +1053,7 @@ namespace {
target,
StatusWith<ReplSetHeartbeatResponse>(reconfigResponse),
OpTime(0, 0)); // We've never applied anything.
- ASSERT_EQUALS(TopologyCoordinatorImpl::HeartbeatResponseAction::Reconfig,
- action.getAction());
+ ASSERT_EQUALS(HeartbeatResponseAction::Reconfig, action.getAction());
ASSERT_EQUALS(Date_t(firstRequestDate + 6500), action.getNextHeartbeatStartDate());
}