Github user eolivelli commented on a diff in the pull request:
https://github.com/apache/zookeeper/pull/546#discussion_r197604271
--- 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 --
@enixon sorry, to me it is not clear if you are saying that current method
is okay or that I should change it according to @anmolnar idea.
For LocalPeerBean it may have sense to also check local election state, but
for RemotePeerBean I can't see the meaning.
Alternatively we could return 'false' in case that local peer is performing
leader election.
I think we should keep the logic simple
---