This is an automated email from the ASF dual-hosted git repository.
jisaac pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/phoenix.git
The following commit(s) were added to refs/heads/master by this push:
new 21ab785930 PHOENIX-7493 Addendum Only making HAGroupStoreClient
unhealthy on CONNECTION_LOST (#2316)
21ab785930 is described below
commit 21ab7859306d9573175fe0ea4a4da1dbe9c134e8
Author: ritegarg <[email protected]>
AuthorDate: Tue Nov 11 13:54:48 2025 -0800
PHOENIX-7493 Addendum Only making HAGroupStoreClient unhealthy on
CONNECTION_LOST (#2316)
Co-authored-by: Ritesh Garg
<[email protected]>
---
.../main/java/org/apache/phoenix/jdbc/HAGroupStoreClient.java | 7 ++++++-
.../it/java/org/apache/phoenix/jdbc/HAGroupStoreClientIT.java | 11 ++++++++++-
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git
a/phoenix-core-client/src/main/java/org/apache/phoenix/jdbc/HAGroupStoreClient.java
b/phoenix-core-client/src/main/java/org/apache/phoenix/jdbc/HAGroupStoreClient.java
index 43bd24048b..93102d79ac 100644
---
a/phoenix-core-client/src/main/java/org/apache/phoenix/jdbc/HAGroupStoreClient.java
+++
b/phoenix-core-client/src/main/java/org/apache/phoenix/jdbc/HAGroupStoreClient.java
@@ -124,11 +124,16 @@ public class HAGroupStoreClient implements Closeable {
case INITIALIZED:
latch.countDown();
break;
- case CONNECTION_LOST:
case CONNECTION_SUSPENDED:
+ LOGGER.warn("Received CONNECTION_SUSPENDED event, will wait
until either "
+ + "ZK connection is restored or session timeout occurs");
+ break;
+ case CONNECTION_LOST:
+ LOGGER.error("Received CONNECTION_LOST event, marking cache as
unhealthy");
isHealthy = false;
break;
case CONNECTION_RECONNECTED:
+ LOGGER.info("Received CONNECTION_RECONNECTED event, marking
cache as healthy");
isHealthy = true;
break;
default:
diff --git
a/phoenix-core/src/it/java/org/apache/phoenix/jdbc/HAGroupStoreClientIT.java
b/phoenix-core/src/it/java/org/apache/phoenix/jdbc/HAGroupStoreClientIT.java
index d591a0769a..d5b1406c1a 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/jdbc/HAGroupStoreClientIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/jdbc/HAGroupStoreClientIT.java
@@ -17,6 +17,8 @@
*/
package org.apache.phoenix.jdbc;
+import static
org.apache.phoenix.jdbc.HighAvailabilityGroup.PHOENIX_HA_ZK_SESSION_TIMEOUT_MS_DEFAULT;
+import static
org.apache.phoenix.jdbc.HighAvailabilityGroup.PHOENIX_HA_ZK_SESSION_TIMEOUT_MS_KEY;
import static org.apache.phoenix.jdbc.PhoenixHAAdmin.toPath;
import static org.junit.Assert.assertThrows;
@@ -336,7 +338,14 @@ public class HAGroupStoreClientIT extends BaseTest {
// Shutdown the ZK Cluster to simulate CONNECTION_SUSPENDED event
utility.shutdownMiniZKCluster();
- Thread.sleep(ZK_CURATOR_EVENT_PROPAGATION_TIMEOUT_MS);
+ // Check that immediately after ZK is down, the connection state
+ // should be SUSPENDED (and not LOST), so no exception should be thrown
+ assert
haGroupStoreClient.getCRRsByClusterRole(ClusterRoleRecord.ClusterRole.ACTIVE).size()
+ == 2;
+
+ long sessionTimeout = config.getLong(PHOENIX_HA_ZK_SESSION_TIMEOUT_MS_KEY,
+ PHOENIX_HA_ZK_SESSION_TIMEOUT_MS_DEFAULT);
+ Thread.sleep(sessionTimeout + ZK_CURATOR_EVENT_PROPAGATION_TIMEOUT_MS);
// Check that HAGroupStoreClient instance is not healthy and throws
IOException
assertThrows(IOException.class,
() ->
haGroupStoreClient.getCRRsByClusterRole(ClusterRoleRecord.ClusterRole.ACTIVE));