[
https://issues.apache.org/jira/browse/RATIS-601?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16868836#comment-16868836
]
Mukul Kumar Singh commented on RATIS-601:
-----------------------------------------
Thanks for the comment Nicholas.
a) The problem here is that we have both the client and server guessing the new
leader. When the server gueses the leader using randomID. The client will retry
with no sleep and this will generate unnecessary traffic. The raft server
should only return the correct leader when it is found. The client already has
the random nodeid generation logic anyways.
b) The NotLeaderException is thrown as an exception here, and hence we need to
handle the NotLeaderException in the excpetionally clause. Please refer the
attached patch.
{code}
LOG.info("{}: receive {}", getName(), reply);
final NotLeaderException nle = reply.getNotLeaderException();
if (nle != null) {
completeReplyExceptionally(nle, NotLeaderException.class.getName());
return;
}
{code}
> Fix NotLeaderException handling
> -------------------------------
>
> Key: RATIS-601
> URL: https://issues.apache.org/jira/browse/RATIS-601
> Project: Ratis
> Issue Type: Bug
> Components: server
> Reporter: Mukul Kumar Singh
> Assignee: Mukul Kumar Singh
> Priority: Major
> Attachments: RATIS-601.001.patch
>
>
> There are 3 issues with leader election
> a) OrderedAsync#sendRequest doesn't handle NotLeaderException
> b) RaftServerImpl#generateNotLeaderException should not guess current leader
> when it does not has information about it. This leads to client retrying
> aggressively which leads into RetryException.
> c) RaftClient right now changes leader for AlreadyClosedException and
> TimeoutIOException, these events do not trigger leader election and hence the
> leader should not be changed.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)