zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (ZOOKEEPER-2988) NPE triggered if server receives a vote for a server id not in their voting view
Date Tue, 17 Apr 2018 15:50:00 GMT

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

ASF GitHub Bot commented on ZOOKEEPER-2988:
-------------------------------------------

Github user eribeiro commented on a diff in the pull request:

    https://github.com/apache/zookeeper/pull/476#discussion_r182127687
  
    --- Diff: src/java/main/org/apache/zookeeper/server/quorum/FastLeaderElection.java ---
    @@ -927,10 +927,11 @@ public Vote lookForLeader() throws InterruptedException {
                                 tmpTimeOut : maxNotificationInterval);
                         LOG.info("Notification time out: " + notTimeout);
                     } 
    -                else if (self.getCurrentAndNextConfigVoters().contains(n.sid)) {
    +                else if (self.getCurrentAndNextConfigVoters().contains(n.sid) &&
    --- End diff --
    
    As this PR modifies this line and add similar ones, wouldn't be the case of creating a
private method with a meaningful name like below?
    ```
    private boolean configVotersContains(long sid) {
        return self.getCurrentAndNextConfigVoters().contains(sid);
    }
    ```
    
    This makes this line and the lines below more readable, imho.


> NPE triggered if server receives a vote for a server id not in their voting view
> --------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-2988
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2988
>             Project: ZooKeeper
>          Issue Type: Bug
>          Components: leaderElection
>    Affects Versions: 3.5.3, 3.4.11
>            Reporter: Brian Nixon
>            Priority: Minor
>
> We've observed the following behavior in elections when a node is lagging behind the
quorum in its view of the ensemble topology.
> - Node A is operating with node B in its voting view, but without view of node C.
> - B votes for C.
> - A then switches its vote to C, but throws a NPE when attempting to connect.
> This causes the QuorumPeer to spin up a Follower only to immediately have it shutdown
by the exception.
> Ideally, A would not advertise a vote for a server that it will not follow.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message