You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@helix.apache.org by xy...@apache.org on 2023/05/17 00:37:11 UTC

[helix] branch master updated: Small bug fixes related to ZK disconnect. (#2486)

This is an automated email from the ASF dual-hosted git repository.

xyuanlu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/helix.git


The following commit(s) were added to refs/heads/master by this push:
     new 9d5b82e66 Small bug fixes related to ZK disconnect. (#2486)
9d5b82e66 is described below

commit 9d5b82e66ed99bc00f0398b658fa04c1beee7c0a
Author: Komal Desai <98...@users.noreply.github.com>
AuthorDate: Tue May 16 17:37:06 2023 -0700

    Small bug fixes related to ZK disconnect. (#2486)
    
    with exponential backoff in retry logic, test had become flaky. Explicitly wait for thread to join and remove the randomness.
    
    Co-authored-by: Komal Desai <kd...@kdesai-mn1.linkedin.biz>
---
 .../java/org/apache/helix/integration/TestZkConnectionLost.java     | 2 +-
 .../src/main/java/org/apache/helix/zookeeper/zkclient/ZkClient.java | 2 +-
 .../org/apache/helix/zookeeper/impl/client/TestRawZkClient.java     | 6 +++---
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestZkConnectionLost.java b/helix-core/src/test/java/org/apache/helix/integration/TestZkConnectionLost.java
index b42752937..f141766ab 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/TestZkConnectionLost.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/TestZkConnectionLost.java
@@ -132,7 +132,7 @@ public class TestZkConnectionLost extends TaskTestBase {
     };
     try {
       testThread.start();
-      testThread.join(10000);
+      testThread.join();
       Assert.assertTrue(disconnected.get());
       Assert.assertFalse(controllerManager.isConnected());
     } finally {
diff --git a/zookeeper-api/src/main/java/org/apache/helix/zookeeper/zkclient/ZkClient.java b/zookeeper-api/src/main/java/org/apache/helix/zookeeper/zkclient/ZkClient.java
index da9a54303..78a3c88ed 100644
--- a/zookeeper-api/src/main/java/org/apache/helix/zookeeper/zkclient/ZkClient.java
+++ b/zookeeper-api/src/main/java/org/apache/helix/zookeeper/zkclient/ZkClient.java
@@ -1955,7 +1955,7 @@ public class ZkClient implements Watcher {
     if (_monitor != null) {
       _monitor.increaseOutstandingRequestGauge();
     }
-    int retryCount = 1;
+    int retryCount = 0;
     long currTime = System.currentTimeMillis();
     try {
       while (true) {
diff --git a/zookeeper-api/src/test/java/org/apache/helix/zookeeper/impl/client/TestRawZkClient.java b/zookeeper-api/src/test/java/org/apache/helix/zookeeper/impl/client/TestRawZkClient.java
index ca371616a..e5b589ff8 100644
--- a/zookeeper-api/src/test/java/org/apache/helix/zookeeper/impl/client/TestRawZkClient.java
+++ b/zookeeper-api/src/test/java/org/apache/helix/zookeeper/impl/client/TestRawZkClient.java
@@ -832,7 +832,7 @@ public class TestRawZkClient extends ZkTestBase {
       final boolean creationThreadTerminated = countDownLatch.await(10L, TimeUnit.SECONDS);
       if (!creationThreadTerminated) {
         running.set(false);
-        creationThread.join(5000L);
+        creationThread.join();
         Assert.fail("Failed to receive a ConnectionLossException after zookeeper has shutdown.");
       }
     } finally {
@@ -893,7 +893,7 @@ public class TestRawZkClient extends ZkTestBase {
     final boolean creationThreadTerminated = countDownLatch.await(10, TimeUnit.SECONDS);
     if (!creationThreadTerminated) {
       running.set(false);
-      creationThread.join(5000L);
+      creationThread.join();
       Assert.fail("Failed to reconnect to zk server and create ephemeral node"
           + " after zk server is recovered.");
     }
@@ -966,7 +966,7 @@ public class TestRawZkClient extends ZkTestBase {
     final boolean creationThreadTerminated = countDownLatch.await(10, TimeUnit.SECONDS);
     if (!creationThreadTerminated) {
       running.set(false);
-      creationThread.join(5000L);
+      creationThread.join();
       Assert.fail("Failed to reconnect to zk server and create ephemeral node"
           + " after zk server is recovered.");
     }