You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@zookeeper.apache.org by "Karolos Antoniadis (Jira)" <ji...@apache.org> on 2019/09/08 02:57:00 UTC

[jira] [Commented] (ZOOKEEPER-3481) The problem of AcceptedEpoch

    [ https://issues.apache.org/jira/browse/ZOOKEEPER-3481?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16925034#comment-16925034 ] 

Karolos Antoniadis commented on ZOOKEEPER-3481:
-----------------------------------------------

Unless I misunderstood something, it does not seem to me that a voting participant that joins later can only act as a follower. It could as well become a leader in a later leader election.

Can you provide the specific steps that throw the {{Leaders epoch ... is less than accepted epoch}} exception?

> The problem of AcceptedEpoch
> ----------------------------
>
>                 Key: ZOOKEEPER-3481
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-3481
>             Project: ZooKeeper
>          Issue Type: Improvement
>          Components: quorum
>    Affects Versions: 3.5.5
>            Reporter: tom.long
>            Priority: Major
>             Fix For: 3.5.7
>
>
> If the leader has been elected when the voting participant joins the cluster, then it can only act as followers. When Leader.getEpochToPropose is called, it does not participate in the voting. However, if the AcceptedEpoch is larger than the leader, it will never work properly.The status is as follows:LOOKING -> FOLLOWING -> exception -> LOOKING.
> code as follows(Learner.registerWithLeader(int pktType)):
> {code:java}
> if (newEpoch > self.getAcceptedEpoch()){
>    wrappedEpochBytes.putInt((int)self.getCurrentEpoch());
>    self.setAcceptedEpoch(newEpoch); 
> }else if (newEpoch == self.getAcceptedEpoch()){
>    // since we have already acked an epoch equal to the leaders, we cannot ack 
>    // again, but we still need to send our lastZxid to the leader so that we can 
>    // sync with it if it does assume leadership of the epoch. 
>    // the -1 indicates that this reply should not count as an ack for the new epoch 
>    wrappedEpochBytes.putInt(-1); 
> }else{ 
>    throw new IOException("Leaders epoch, " + newEpoch + " is less than accepted epoch, " + self.getAcceptedEpoch()); 
> }
> {code}
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.2#803003)