From c2fa311aa564e51fdf966717126867400b531768 Mon Sep 17 00:00:00 2001 From: Andrew Purtell Date: Tue, 24 Nov 2026 11:23:37 -0800 Subject: [PATCH] PHOENIX-8082 BackwardCompatibilityIT reuses a cached connection after a ZK port is reused Each test starts a new mini cluster. When the new cluster gets the ZooKeeper port of an earlier one, the new client URL maps to the cached connection of the stopped cluster, and the test fails. Add a unique principal to the URL, so each cluster gets its own cached connection. Co-Authored-By: Claude Opus 5.5 --- .../org/apache/phoenix/end2end/BackwardCompatibilityIT.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BackwardCompatibilityIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BackwardCompatibilityIT.java index a2487cd7789..5c98cc4fc17 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BackwardCompatibilityIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BackwardCompatibilityIT.java @@ -123,7 +123,10 @@ public synchronized void doSetup() throws Exception { QueryServicesOptions.DEFAULT_EXTRA_JDBC_ARGUMENTS); hbaseTestUtil.startMiniCluster(); zkQuorum = "localhost:" + hbaseTestUtil.getZkCluster().getClientPort(); - url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; + // A unique principal gives each mini cluster its own cached connection. A reused ZK port then + // does not map to a connection for a stopped cluster. + url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum + + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + BaseTest.generateUniqueName(); DriverManager.registerDriver(PhoenixDriver.INSTANCE); checkForPreConditions(compatibleClientVersion, conf); }