From 290bf9aadc7dc9bb8cb2d1acbfce7fafb355885d Mon Sep 17 00:00:00 2001 From: Kezhu Wang Date: Sat, 30 Sep 2023 09:38:05 +0800 Subject: [PATCH] fixup: rename constants in ProtocolVersion --- .../java/org/apache/zookeeper/server/quorum/Leader.java | 2 +- .../java/org/apache/zookeeper/server/quorum/Learner.java | 2 +- .../apache/zookeeper/server/quorum/LearnerHandler.java | 6 +++--- .../apache/zookeeper/server/quorum/ProtocolVersion.java | 8 ++++---- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/Leader.java b/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/Leader.java index 3defeb8b85f..add738dbf50 100644 --- a/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/Leader.java +++ b/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/Leader.java @@ -1401,7 +1401,7 @@ public synchronized void processSync(Request r) { if (p != null) { p.pendingSyncs.add(r); pendingSyncs.incrementAndGet(); - } else if (followersProtocolVersion < ProtocolVersion.VERSION_3_10_0) { + } else if (followersProtocolVersion < ProtocolVersion.V3_10_0) { sendSync(r); } else { p = createQuorumSyncProposal(r); diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/Learner.java b/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/Learner.java index f3375bd92b4..5e09dd80a15 100644 --- a/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/Learner.java +++ b/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/Learner.java @@ -104,7 +104,7 @@ public Socket getSocket() { protected InputArchive leaderIs; protected OutputArchive leaderOs; /** the protocol version of the leader */ - protected int leaderProtocolVersion = ProtocolVersion.VERSION_ANCIENT; + protected int leaderProtocolVersion = ProtocolVersion.ANCIENT; private static final int BUFFERED_MESSAGE_SIZE = 10; protected final MessageTracker messageTracker = new MessageTracker(BUFFERED_MESSAGE_SIZE); diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/LearnerHandler.java b/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/LearnerHandler.java index a201543495e..78913d6d48c 100644 --- a/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/LearnerHandler.java +++ b/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/LearnerHandler.java @@ -104,7 +104,7 @@ String getRemoteAddress() { return sock == null ? "" : sock.getRemoteSocketAddress().toString(); } - protected int version = ProtocolVersion.VERSION_ANCIENT; + protected int version = ProtocolVersion.ANCIENT; int getVersion() { return version; @@ -524,7 +524,7 @@ public void run() { long newEpoch = learnerMaster.getEpochToPropose(this.getSid(), lastAcceptedEpoch); long newLeaderZxid = ZxidUtils.makeZxid(newEpoch, 0); - if (this.getVersion() < ProtocolVersion.VERSION_3_4_0) { + if (this.getVersion() < ProtocolVersion.V3_4_0) { // we are going to have to extrapolate the epoch information long epoch = ZxidUtils.getEpochFromZxid(zxid); ss = new StateSummary(epoch, zxid); @@ -596,7 +596,7 @@ public void run() { // the version of this quorumVerifier will be set by leader.lead() in case // the leader is just being established. waitForEpochAck makes sure that readyToStart is true if // we got here, so the version was set - if (getVersion() < ProtocolVersion.VERSION_3_4_0) { + if (getVersion() < ProtocolVersion.V3_4_0) { QuorumPacket newLeaderQP = new QuorumPacket(Leader.NEWLEADER, newLeaderZxid, null, null); oa.writeRecord(newLeaderQP, "packet"); } else { diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/ProtocolVersion.java b/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/ProtocolVersion.java index a852b1ef5eb..3ec072a9a53 100644 --- a/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/ProtocolVersion.java +++ b/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/ProtocolVersion.java @@ -24,22 +24,22 @@ private ProtocolVersion() {} /** * Pre ZAB 1.0. */ - public static final int VERSION_ANCIENT = 1; + public static final int ANCIENT = 1; /** * ZAB 1.0. */ - public static final int VERSION_3_4_0 = 0x10000; + public static final int V3_4_0 = 0x10000; /** * Protocol changes: * * Learner will piggyback whatever data leader attached in {@link Leader#PING} after session data. * This way, leader is free to enhance {@link Leader#PING} in future without agreement from learner. */ - public static final int VERSION_3_10_0 = 0x20000; + public static final int V3_10_0 = 0x20000; /** * Point to the newest coding version. */ - public static final int CURRENT = VERSION_3_10_0; + public static final int CURRENT = V3_10_0; }