From 9f790f4a87387d996123b102ccca122be71b46c2 Mon Sep 17 00:00:00 2001 From: Kezhu Wang Date: Fri, 29 Sep 2023 14:14:11 +0800 Subject: [PATCH] review: drop `quorumSync` config to gain consistent behavior --- .../src/main/resources/markdown/zookeeperAdmin.md | 6 ------ .../org/apache/zookeeper/server/quorum/Leader.java | 10 ---------- .../java/org/apache/zookeeper/test/QuorumSyncTest.java | 10 ---------- 3 files changed, 26 deletions(-) diff --git a/zookeeper-docs/src/main/resources/markdown/zookeeperAdmin.md b/zookeeper-docs/src/main/resources/markdown/zookeeperAdmin.md index 2821e4299a9..7a99cd346c6 100644 --- a/zookeeper-docs/src/main/resources/markdown/zookeeperAdmin.md +++ b/zookeeper-docs/src/main/resources/markdown/zookeeperAdmin.md @@ -1209,12 +1209,6 @@ property, when available, is noted below. leader. The default value is false. -* *quorumSync* - (Java system property: **zookeeper.quorumSync**) - **New in 3.10.0** - When this property is set, `sync` will be a quorum operation. - - The default value is false. * *serializeLastProcessedZxid.enabled* (Jave system property: **zookeeper.serializeLastProcessedZxid.enabled**) 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 2e0eefa5203..f0ebc13f4da 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 @@ -123,14 +123,6 @@ public static int getAckLoggingFrequency() { return ackLoggingFrequency; } - public static final String QUORUM_SYNC = "zookeeper.quorumSync"; - private static final boolean quorumSync; - - static { - quorumSync = Boolean.parseBoolean(System.getProperty(QUORUM_SYNC)); - LOG.info("{} = {}", QUORUM_SYNC, quorumSync); - } - final LeaderZooKeeperServer zk; final QuorumPeer self; @@ -1383,8 +1375,6 @@ public synchronized void processSync(Request r) { if (p != null) { p.pendingSyncs.add(r); pendingSyncs.incrementAndGet(); - } else if (!quorumSync) { - sendSync(r); } else { p = createQuorumSyncProposal(r); outstandingProposals.put(lastProposed, p); diff --git a/zookeeper-server/src/test/java/org/apache/zookeeper/test/QuorumSyncTest.java b/zookeeper-server/src/test/java/org/apache/zookeeper/test/QuorumSyncTest.java index de9a5a3f8f8..fb838e41f85 100644 --- a/zookeeper-server/src/test/java/org/apache/zookeeper/test/QuorumSyncTest.java +++ b/zookeeper-server/src/test/java/org/apache/zookeeper/test/QuorumSyncTest.java @@ -27,17 +27,9 @@ import org.apache.zookeeper.server.quorum.Leader; import org.apache.zookeeper.server.quorum.LearnerHandler; import org.apache.zookeeper.server.quorum.QuorumPeer; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; public class QuorumSyncTest extends QuorumBase { - @BeforeEach - @Override - public void setUp() throws Exception { - System.setProperty("zookeeper.quorumSync", "true"); - super.setUp(); - } - @Test public void testReadAfterSync() throws Exception { int leaderPort = getLeaderClientPort(); @@ -59,7 +51,6 @@ public void testReadAfterSync() throws Exception { followerWriter.setData("/test", "test1".getBytes(), -1); break; } catch (KeeperException.ConnectionLossException ignored) { - ignored.printStackTrace(); } } @@ -73,7 +64,6 @@ public void testReadAfterSync() throws Exception { assertArrayEquals("test1".getBytes(), test1); break; } catch (Exception ignored) { - ignored.printStackTrace(); } } }