You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zookeeper.apache.org by ma...@apache.org on 2021/06/27 07:21:34 UTC
[zookeeper] branch master updated: ZOOKEEPER-4312: remove
unnecessary code
This is an automated email from the ASF dual-hosted git repository.
maoling pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/zookeeper.git
The following commit(s) were added to refs/heads/master by this push:
new 9442ce2 ZOOKEEPER-4312: remove unnecessary code
9442ce2 is described below
commit 9442ce23bade5286459ff78ade1af173f7b69c30
Author: zhongxiong.zeng <zh...@za.group>
AuthorDate: Sun Jun 27 15:21:26 2021 +0800
ZOOKEEPER-4312: remove unnecessary code
The result of this line of code is not used, this code is uncessary
Author: zhongxiong.zeng <zh...@za.group>
Reviewers: Ching-Chan Lee <le...@gmail.com>, maoling <ma...@apache.org>
Closes #1709 from zhongxiongzeng/remove_unnecessary_code and squashes the following commits:
2b49e106c [zhongxiong.zeng] Revert "remove redundant code"
081c2a03b [zhongxiong.zeng] remove redundant code
0e8a1ddb2 [zhongxiong.zeng] remove unnecessary code
---
.../org/apache/zookeeper/server/quorum/FastLeaderElection.java | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/FastLeaderElection.java b/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/FastLeaderElection.java
index 9fc9d14..654ed1c 100644
--- a/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/FastLeaderElection.java
+++ b/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/FastLeaderElection.java
@@ -976,8 +976,7 @@ public class FastLeaderElection implements Election {
/*
* Exponential backoff
*/
- int tmpTimeOut = notTimeout * 2;
- notTimeout = Math.min(tmpTimeOut, maxNotificationInterval);
+ notTimeout = Math.min(notTimeout << 1, maxNotificationInterval);
/*
* When a leader failure happens on a master, the backup will be supposed to receive the honour from
@@ -986,8 +985,8 @@ public class FastLeaderElection implements Election {
* The leader election algorithm does not provide the ability of electing a leader from a single instance
* which is in a configuration of 2 instances.
* */
- self.getQuorumVerifier().revalidateVoteset(voteSet, notTimeout != minNotificationInterval);
- if (self.getQuorumVerifier() instanceof QuorumOracleMaj && voteSet != null && voteSet.hasAllQuorums() && notTimeout != minNotificationInterval) {
+ if (self.getQuorumVerifier() instanceof QuorumOracleMaj
+ && self.getQuorumVerifier().revalidateVoteset(voteSet, notTimeout != minNotificationInterval)) {
setPeerState(proposedLeader, voteSet);
Vote endVote = new Vote(proposedLeader, proposedZxid, logicalclock.get(), proposedEpoch);
leaveInstance(endVote);