You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ratis.apache.org by "Lokesh Jain (JIRA)" <ji...@apache.org> on 2018/01/21 15:42:00 UTC
[jira] [Comment Edited] (RATIS-153) Add continuous heartbeats
between Ratis servers to avoid unnecessary leader elections
[ https://issues.apache.org/jira/browse/RATIS-153?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16333557#comment-16333557 ]
Lokesh Jain edited comment on RATIS-153 at 1/21/18 3:41 PM:
------------------------------------------------------------
[~msingh] Thanks for working on this! The patch looks good to me. We de not need to update the heartbeat with inLogSync value as true twice. We can change the thenApply code to something like this.
{code:java}
.thenApply(v -> {
synchronized (this) {
if (lifeCycle.getCurrentState() == RUNNING && isFollower()
&& getState().getCurrentTerm() == currentTerm) {
// reset election timer to avoid punishing the leader for our own
// long disk writes
heartbeatMonitor.updateLastRpcTime(false);
}
}
return reply;
});
{code}
With this change we can remove the synchronized keyword from updateLastRpcTime as well.
Can you also update the description of the Jira?
was (Author: ljain):
[~msingh] Thanks for working on this! The patch looks good to me. +1. Can you change the description of the Jira as well?
> Add continuous heartbeats between Ratis servers to avoid unnecessary leader elections
> -------------------------------------------------------------------------------------
>
> Key: RATIS-153
> URL: https://issues.apache.org/jira/browse/RATIS-153
> Project: Ratis
> Issue Type: Bug
> Reporter: Mukul Kumar Singh
> Assignee: Mukul Kumar Singh
> Priority: Major
> Attachments: RATIS-153.001.patch
>
>
> Currently the heartbeat monitor on the follower is updated when the last rpc is received from the leader. When this threshold crosses the *raft.server.rpc.timeout*, an election is triggered to elect a new leader.
> However generally it might happen that the leader doesn't had append entries to forward to the follower. This will trigger unnecessary leader elections.
> This also causes the Raft Client to find the new Leader as well which can be time consuming.
> This jira proposes to add a heartbeat mechanism, where the leader will periodically (lets say, raft.server.rpc.timeout/2) will send empty heartbeats to its followers to ensure that leader stays elected as the leader.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)