From b35d5b25094a5e9d76c24f910a86dde900d1340e Mon Sep 17 00:00:00 2001 From: Amina Dinari Date: Tue, 11 Mar 2025 13:44:49 +0100 Subject: [PATCH 1/6] GH-1251: Upgrade Zookeeper to 3.9.3+ --- .../java/org/apache/curator/test/TestingZooKeeperMain.java | 3 +-- pom.xml | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/curator-test/src/main/java/org/apache/curator/test/TestingZooKeeperMain.java b/curator-test/src/main/java/org/apache/curator/test/TestingZooKeeperMain.java index 74d39daf2..bcdbdc2f6 100644 --- a/curator-test/src/main/java/org/apache/curator/test/TestingZooKeeperMain.java +++ b/curator-test/src/main/java/org/apache/curator/test/TestingZooKeeperMain.java @@ -255,8 +255,7 @@ public TestZooKeeperServer(FileTxnSnapLog txnLog, ServerConfig config) { this.setMaxSessionTimeout(config.getMaxSessionTimeout()); } - @Override - public synchronized void shutdown(boolean fullyShutDown) { + public synchronized void customShutdown(boolean fullyShutDown) { super.shutdown(fullyShutDown); try { txnLog.close(); diff --git a/pom.xml b/pom.xml index d83d2f1ce..55f4f37d2 100644 --- a/pom.xml +++ b/pom.xml @@ -72,7 +72,7 @@ true - 3.9.2 + 3.9.3 5.1.4 3.10.0 3.2.0 From e47ac0e2b2e0d430e8dfda47a5d89f8e754b018f Mon Sep 17 00:00:00 2001 From: Amina Dinari Date: Tue, 11 Mar 2025 14:14:02 +0100 Subject: [PATCH 2/6] Update TestingZooKeeperMain.java --- .../java/org/apache/curator/test/TestingZooKeeperMain.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/curator-test/src/main/java/org/apache/curator/test/TestingZooKeeperMain.java b/curator-test/src/main/java/org/apache/curator/test/TestingZooKeeperMain.java index bcdbdc2f6..8e46d245a 100644 --- a/curator-test/src/main/java/org/apache/curator/test/TestingZooKeeperMain.java +++ b/curator-test/src/main/java/org/apache/curator/test/TestingZooKeeperMain.java @@ -165,7 +165,7 @@ public void close() throws IOException { try { if (zkServer != null) { - zkServer.shutdown(); + zkServer.customShutdown(); ZKDatabase zkDb = zkServer.getZKDatabase(); if (zkDb != null) { // make ZK server close its log files @@ -209,7 +209,7 @@ private void internalRunFromConfig(ServerConfig config) throws IOException { latch.countDown(); cnxnFactory.join(); if ((zkServer != null) && zkServer.isRunning()) { - zkServer.shutdown(); + zkServer.customShutdown(); } } catch (InterruptedException e) { // warn, but generally this is ok From 2b263acc78f97c9e776bf67d0d4bfb1e94da5176 Mon Sep 17 00:00:00 2001 From: Amina Dinari Date: Tue, 11 Mar 2025 16:50:56 +0100 Subject: [PATCH 3/6] Update TestingZooKeeperMain.java --- .../org/apache/curator/test/TestingZooKeeperMain.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/curator-test/src/main/java/org/apache/curator/test/TestingZooKeeperMain.java b/curator-test/src/main/java/org/apache/curator/test/TestingZooKeeperMain.java index 8e46d245a..050e4b0a7 100644 --- a/curator-test/src/main/java/org/apache/curator/test/TestingZooKeeperMain.java +++ b/curator-test/src/main/java/org/apache/curator/test/TestingZooKeeperMain.java @@ -264,6 +264,15 @@ public synchronized void customShutdown(boolean fullyShutDown) { } } + public synchronized void customShutdown() { + super.shutdown(); + try { + txnLog.close(); + } catch (IOException e) { + // ignore + } + } + private final AtomicBoolean isRunning = new AtomicBoolean(false); public RequestProcessor getFirstProcessor() { From 428023008581f3f0bbe40c61c860b98a06822dad Mon Sep 17 00:00:00 2001 From: Amina Dinari Date: Wed, 12 Mar 2025 18:58:20 +0100 Subject: [PATCH 4/6] Adding boolean parameters --- .../apache/curator/test/TestingZooKeeperMain.java | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/curator-test/src/main/java/org/apache/curator/test/TestingZooKeeperMain.java b/curator-test/src/main/java/org/apache/curator/test/TestingZooKeeperMain.java index 050e4b0a7..5c999385b 100644 --- a/curator-test/src/main/java/org/apache/curator/test/TestingZooKeeperMain.java +++ b/curator-test/src/main/java/org/apache/curator/test/TestingZooKeeperMain.java @@ -165,7 +165,7 @@ public void close() throws IOException { try { if (zkServer != null) { - zkServer.customShutdown(); + zkServer.customShutdown(false); ZKDatabase zkDb = zkServer.getZKDatabase(); if (zkDb != null) { // make ZK server close its log files @@ -209,7 +209,7 @@ private void internalRunFromConfig(ServerConfig config) throws IOException { latch.countDown(); cnxnFactory.join(); if ((zkServer != null) && zkServer.isRunning()) { - zkServer.customShutdown(); + zkServer.customShutdown(false); } } catch (InterruptedException e) { // warn, but generally this is ok @@ -264,15 +264,6 @@ public synchronized void customShutdown(boolean fullyShutDown) { } } - public synchronized void customShutdown() { - super.shutdown(); - try { - txnLog.close(); - } catch (IOException e) { - // ignore - } - } - private final AtomicBoolean isRunning = new AtomicBoolean(false); public RequestProcessor getFirstProcessor() { From eb55173257b049d1ca045995c1cbea7386d97514 Mon Sep 17 00:00:00 2001 From: Kezhu Wang Date: Sun, 15 Jun 2025 22:55:15 +0800 Subject: [PATCH 5/6] Session could expired if all servers stopped since ZOOKEEPER-4508 --- .../java/org/apache/curator/framework/imps/TestFramework.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java index 6ffd03406..07ecf3338 100644 --- a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java +++ b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java @@ -479,7 +479,7 @@ public void stateChanged(CuratorFramework client, ConnectionState newState) { try { client.checkExists().forPath("/"); fail("Connection should be down"); - } catch (KeeperException.ConnectionLossException e) { + } catch (KeeperException.ConnectionLossException | KeeperException.SessionExpiredException e) { // expected } From bca26a9e0de32fff665bab6270e20c86bb1a336b Mon Sep 17 00:00:00 2001 From: Kezhu Wang Date: Sun, 15 Jun 2025 22:54:47 +0800 Subject: [PATCH 6/6] Use shutdown() instead of shutdown(false) --- .../org/apache/curator/test/TestingZooKeeperMain.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/curator-test/src/main/java/org/apache/curator/test/TestingZooKeeperMain.java b/curator-test/src/main/java/org/apache/curator/test/TestingZooKeeperMain.java index 5c999385b..79f63fffb 100644 --- a/curator-test/src/main/java/org/apache/curator/test/TestingZooKeeperMain.java +++ b/curator-test/src/main/java/org/apache/curator/test/TestingZooKeeperMain.java @@ -165,7 +165,7 @@ public void close() throws IOException { try { if (zkServer != null) { - zkServer.customShutdown(false); + zkServer.customShutdown(); ZKDatabase zkDb = zkServer.getZKDatabase(); if (zkDb != null) { // make ZK server close its log files @@ -209,7 +209,7 @@ private void internalRunFromConfig(ServerConfig config) throws IOException { latch.countDown(); cnxnFactory.join(); if ((zkServer != null) && zkServer.isRunning()) { - zkServer.customShutdown(false); + zkServer.customShutdown(); } } catch (InterruptedException e) { // warn, but generally this is ok @@ -255,8 +255,8 @@ public TestZooKeeperServer(FileTxnSnapLog txnLog, ServerConfig config) { this.setMaxSessionTimeout(config.getMaxSessionTimeout()); } - public synchronized void customShutdown(boolean fullyShutDown) { - super.shutdown(fullyShutDown); + public synchronized void customShutdown() { + super.shutdown(); try { txnLog.close(); } catch (IOException e) {