1
0
Fork 0

Make leader more tolerant w.r.t. incoming AppendEntriesRPC responses.

This commit is contained in:
Max Neunhoeffer 2017-10-02 15:01:11 +02:00
parent e974501446
commit 45d37edfb2
No known key found for this signature in database
GPG Key ID: 89A912AD5E343E1E
1 changed files with 14 additions and 1 deletions

View File

@ -804,7 +804,20 @@ bool Agent::challengeLeadership() {
for (auto const& i : _lastAcked) {
duration<double> m = system_clock::now() - i.second;
if (0.9 * _config.minPing() * _config.timeoutMult() > m.count()) {
// This is rather arbitrary here: We used to have 0.9 here to absolutely
// ensure that a leader resigns before another one even starts an election.
// However, the Raft paper does not mention this at all. Rather, in the
// paper it is written that the leader should resign immediately if it
// sees a higher term from another server. Currently we have not
// implemented to return the follower's term with a response to
// AppendEntriesRPC, so the leader cannot find out a higher term this
// way. The leader can, however, see a higher term in the incoming
// AppendEntriesRPC a new leader sends out, and it will immediately
// resign if it sees that. For the moment, this value here can stay.
// We should soon implement sending the follower's term back with
// each response and probably get rid of this method altogether,
// but this requires a bit more thought.
if (_config.maxPing() * _config.timeoutMult() > m.count()) {
++good;
}
}