zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hanm <...@git.apache.org>
Subject [GitHub] zookeeper pull request #703: [ZOOKEEPER-1818] Correctly handle potential inc...
Date Thu, 29 Nov 2018 06:45:29 GMT
Github user hanm commented on a diff in the pull request:

    https://github.com/apache/zookeeper/pull/703#discussion_r237367761
  
    --- Diff: zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/FastLeaderElection.java
---
    @@ -1058,29 +1050,20 @@ else if (validVoter(n.sid) && validVoter(n.leader)) {
                             /*
                              * Before joining an established ensemble, verify that
                              * a majority are following the same leader.
    -                         * Only peer epoch is used to check that the votes come
    -                         * from the same ensemble. This is because there is at
    -                         * least one corner case in which the ensemble can be
    -                         * created with inconsistent zxid and election epoch
    -                         * info. However, given that only one ensemble can be
    -                         * running at a single point in time and that each
    -                         * epoch is used only once, using only the epoch to
    -                         * compare the votes is sufficient.
    -                         *
    -                         * @see https://issues.apache.org/jira/browse/ZOOKEEPER-1732
                              */
    -                        outofelection.put(n.sid, new Vote(n.leader,
    -                                IGNOREVALUE, IGNOREVALUE, n.peerEpoch, n.state));
    -                        voteSet = getVoteTracker(
    -                                outofelection, new Vote(n.leader,
    -                                IGNOREVALUE, IGNOREVALUE, n.peerEpoch, n.state));
    -                        if (voteSet.hasAllQuorums()
    -                                && checkLeader(outofelection, n.leader, IGNOREVALUE))
{
    +                        outofelection.put(n.sid, new Vote(n.version, n.leader,
    +                                n.zxid, n.electionEpoch, n.peerEpoch, n.state));
    +                        voteSet = getVoteTracker(outofelection, new Vote(n.version, 
    +                                n.leader, n.zxid, n.electionEpoch, n.peerEpoch, n.state));
    +
    +                        if (voteSet.hasAllQuorums() &&
    +                                checkLeader(outofelection, n.leader, n.electionEpoch))
{
                                 synchronized(this){
                                     logicalclock.set(n.electionEpoch);
                                     setPeerState(n.leader, voteSet);
                                 }
    -                            Vote endVote = new Vote(n.leader, n.zxid, n.peerEpoch);
    +                            Vote endVote = new Vote(n.leader, n.zxid, 
    +                                    n.electionEpoch, n.peerEpoch);
    --- End diff --
    
    nit: indentation


---

Mime
View raw message