diff options
author | Benety Goh <benety@mongodb.com> | 2015-11-13 13:53:29 -0500 |
---|---|---|
committer | Benety Goh <benety@mongodb.com> | 2015-11-13 16:19:11 -0500 |
commit | bddbae79b4733dbd392215c38beccab5daa0109c (patch) | |
tree | 55c7ceb2b25f230d3e51b9a32932300d7b098c55 /src/mongo/db/repl/topology_coordinator_impl.cpp | |
parent | cb920169f3c3892fe3b35de30af6552c652adc00 (diff) | |
download | mongo-bddbae79b4733dbd392215c38beccab5daa0109c.tar.gz |
SERVER-21452 hearbeat response from secondary should not schedule a priority takeover
Diffstat (limited to 'src/mongo/db/repl/topology_coordinator_impl.cpp')
-rw-r--r-- | src/mongo/db/repl/topology_coordinator_impl.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/mongo/db/repl/topology_coordinator_impl.cpp b/src/mongo/db/repl/topology_coordinator_impl.cpp index 479f8bc1181..d05792395bb 100644 --- a/src/mongo/db/repl/topology_coordinator_impl.cpp +++ b/src/mongo/db/repl/topology_coordinator_impl.cpp @@ -1079,9 +1079,10 @@ 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 && + if (_hbdata[primaryIndex].getTerm() == _term && updatedConfigIndex == primaryIndex && _rsConfig.getMemberAt(primaryIndex).getPriority() < _rsConfig.getMemberAt(_selfIndex).getPriority()) { LOG(4) << "I can take over the primary due to higher priority." |