zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From enixon <...@git.apache.org>
Subject [GitHub] zookeeper pull request #546: ZOOKEEPER-3066 Expose on JMX of Followers the i...
Date Fri, 22 Jun 2018 21:29:56 GMT
Github user enixon commented on a diff in the pull request:

    https://github.com/apache/zookeeper/pull/546#discussion_r197574036
  
    --- Diff: src/java/main/org/apache/zookeeper/server/quorum/QuorumPeer.java ---
    @@ -2069,4 +2073,9 @@ public QuorumCnxManager createCnxnManager() {
                     this.quorumCnxnThreadsSize,
                     this.isQuorumSaslAuthEnabled());
         }
    +
    +    boolean isLeader(long id) {
    +        Vote vote = getCurrentVote();
    +        return vote != null && id == vote.getId();
    --- End diff --
    
    I'd second the request to sidestep the election logic for this method if possible as it
makes the method harder to reason about. 
    
    It would be nice if the method implied the server was currently performing active leader
actions and the current way also covers a server preparing for or nominating itself to be
leader (or at least it looks like it). For example, with this code on a 5 server ensemble
with one server dead, if one server switches its vote midway through an election epoch then
you could be displaying two "leaders" by vote but this is not the same as a two leader splitbrain
scenario.


---

Mime
View raw message