summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2015-11-13 17:20:09 -0500
committerBenety Goh <benety@mongodb.com>2015-11-13 17:20:09 -0500
commit04fbc0b6279e5a1f474d1afbfd102efb3a8c0bfd (patch)
tree39eec2f0f575b807e55283fb52cd91ad7120b19c /src/mongo
parent9515adae0c41fb3ab6585d5e71e61b1d063ea336 (diff)
downloadmongo-04fbc0b6279e5a1f474d1afbfd102efb3a8c0bfd.tar.gz
Revert "SERVER-21452 hearbeat response from secondary should not schedule a priority takeover"
This reverts commit bddbae79b4733dbd392215c38beccab5daa0109c.
Diffstat (limited to 'src/mongo')
-rw-r--r--src/mongo/db/repl/topology_coordinator_impl.cpp3
-rw-r--r--src/mongo/db/repl/topology_coordinator_impl_v1_test.cpp10
2 files changed, 1 insertions, 12 deletions
diff --git a/src/mongo/db/repl/topology_coordinator_impl.cpp b/src/mongo/db/repl/topology_coordinator_impl.cpp
index d05792395bb..479f8bc1181 100644
--- a/src/mongo/db/repl/topology_coordinator_impl.cpp
+++ b/src/mongo/db/repl/topology_coordinator_impl.cpp
@@ -1079,10 +1079,9 @@ HeartbeatResponseAction TopologyCoordinatorImpl::_updatePrimaryFromHBDataV1(
// Priority takeover when the replset is stable.
//
// Take over the primary only if the remote primary is in the latest term I know.
- // This is done only when we get a heartbeat response from the primary.
// Otherwise, there must be an outstanding election, which may succeed or not, but
// the remote primary will become aware of that election eventually and step down.
- if (_hbdata[primaryIndex].getTerm() == _term && updatedConfigIndex == primaryIndex &&
+ if (_hbdata[primaryIndex].getTerm() == _term &&
_rsConfig.getMemberAt(primaryIndex).getPriority() <
_rsConfig.getMemberAt(_selfIndex).getPriority()) {
LOG(4) << "I can take over the primary due to higher priority."
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 10dcad1ad5f..32e258ee2b0 100644
--- a/src/mongo/db/repl/topology_coordinator_impl_v1_test.cpp
+++ b/src/mongo/db/repl/topology_coordinator_impl_v1_test.cpp
@@ -2757,16 +2757,6 @@ TEST_F(HeartbeatResponseTestV1, UpdateHeartbeatDataTermPreventsPriorityTakeover)
ASSERT_EQUALS(HeartbeatResponseAction::PriorityTakeover, nextAction.getAction());
ASSERT_EQUALS(2, getCurrentPrimaryIndex());
- // Heartbeat from a secondary node shouldn't schedule a priority takeover.
- nextAction = receiveUpHeartbeat(HostAndPort("host1"),
- "rs0",
- MemberState::RS_SECONDARY,
- election,
- election,
- lastOpTimeApplied);
- ASSERT_NO_ACTION(nextAction.getAction());
- ASSERT_EQUALS(2, getCurrentPrimaryIndex());
-
now()++;
// Host 1 starts an election due to higher priority by sending vote requests.
// Vote request updates my term.