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

Flavio Paiva Junqueira commented on ZOOKEEPER-335:
--------------------------------------------------

Thanks for detailed assessment, Vishal. In Step b, the fact that the process 
believes it is the leader is not a problem, and it happens because we queue 
notification messages during leader election. 

The real issue is that leader code is setting the last processed zxid to the 
first of the new epoch even before connecting to a quorum of followers. Because 
the leader code sets this value before connecting to a quorum of followers 
(Leader.java:281) and the follower code throws an IOException 
(Follower.java:73) if the leader epoch is smaller, we have that when the false 
leader drops leadership and becomes a follower, it finds a smaller epoch and 
kills itself.

I noticed that this follower check was not there before (not present in 3.0 
branch), and it might have been introduced when we did the observer 
reorganization. For now I propose that we move line Leader.java:281 to 
Leader.java:470. It simply changes the point in which we set the last processed 
zxid to one in which we know that  a quorum of followers supports the leader. I 
reasoned a bit about it and verified that tests pass.

A patch for the change I'm proposing is trivial, but a unit test will require 
some work, so I'd rather hear opinions first. Also, please note that this 
problem is not related to the topic of this jira, so we might consider working 
on a different jira from this point on. 



> zookeeper servers should commit the new leader txn to their logs.
> -----------------------------------------------------------------
>
>                 Key: ZOOKEEPER-335
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-335
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: server
>    Affects Versions: 3.1.0
>            Reporter: Mahadev konar
>            Assignee: Mahadev konar
>            Priority: Blocker
>             Fix For: 3.4.0
>
>         Attachments: faultynode-vishal.txt, zk.log.gz, zklogs.tar.gz
>
>
> currently the zookeeper followers do not commit the new leader election. This 
> will cause problems in a failure scenarios with a follower acking to the same 
> leader txn id twice, which might be two different intermittent leaders and 
> allowing them to propose two different txn's of the same zxid.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to