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

Flavio Junqueira commented on ZOOKEEPER-1324:
---------------------------------------------

[~shralex] Thanks a lot for having a look at the new patch. Part of this patch 
was moving a bit of code around. In the original patch prior to ZOOKEEPER-107 
getting in, we were removing this "if ((zxid & 0xffffffffL) != 0)" because were 
not calling tryToCommit for the newleader proposal any longer. When looking at 
the trunk code, it seemed to me that you had some duplicate code in the else 
block because you needed to have it executed for both branches (if ((zxid & 
0xffffffffL) != 0) succeeds or not). But, because we removed this check "if 
((zxid & 0xffffffffL) != 0)", we don't have to duplicate that piece of code any 
longer, and it is executed in the case that the request a reconfig one.

For completeness, the duplicated bit of code I'm referring to is this:

{code}
QuorumVerifier newQV = self.getLastSeenQuorumVerifier();
               
Long designatedLeader = getDesignatedLeader(p, zxid);                           
              
               
self.processReconfig(newQV, designatedLeader, zk.getZxid(), true);
if (designatedLeader != self.getId()) {
        allowedToCommit = false;
}
{code}

One bit that I just realized while writing this post is that the else block in 
the current trunk code is executed even if the request is not a reconfig 
request. Is this correct? Note that we don't process the newleader proposal in 
this method any longer. 

The other thing I was thinking is that if it is really incorrect, then the 
tests should have captured. Assuming that I need to fix the patch, it would be 
nice to determine why the reconfig tests didn't capture it and fix the tests. 
                
> Remove Duplicate NEWLEADER packets from the Leader to the Follower.
> -------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-1324
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1324
>             Project: ZooKeeper
>          Issue Type: Improvement
>          Components: quorum
>    Affects Versions: 3.5.0
>            Reporter: Mahadev konar
>            Assignee: Thawan Kooburat
>            Priority: Critical
>             Fix For: 3.5.0, 3.4.6
>
>         Attachments: ZOOKEEPER-1324-branch-3.4.patch, ZOOKEEPER-1324.patch, 
> ZOOKEEPER-1324.patch, ZOOKEEPER-1324.patch, ZOOKEEPER-1324.patch, 
> ZOOKEEPER-1324.patch, ZOOKEEPER-1324.patch
>
>


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to