This is an automated email from the ASF dual-hosted git repository. virajjasani pushed a commit to branch 5.2 in repository https://gitbox.apache.org/repos/asf/phoenix.git
commit 3355260ef0376c82fc27971df75e1ffed66a46be Author: Andrew Purtell <[email protected]> AuthorDate: Tue Jun 30 15:48:27 2026 -0700 PHOENIX-7822 MaxConcurrentConnectionsIT poll for async connection counts (#2439) --- .../org/apache/phoenix/query/MaxConcurrentConnectionsIT.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/phoenix-core/src/it/java/org/apache/phoenix/query/MaxConcurrentConnectionsIT.java b/phoenix-core/src/it/java/org/apache/phoenix/query/MaxConcurrentConnectionsIT.java index 860344550d..5223af32ed 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/query/MaxConcurrentConnectionsIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/query/MaxConcurrentConnectionsIT.java @@ -120,6 +120,12 @@ public class MaxConcurrentConnectionsIT extends BaseTest { if (conn != null) { conn.close(); } + // Connection close is asynchronous; poll until both counters drain to 0 + // before asserting (asserting synchronously is racy). + hbaseTestUtil.waitFor(30000, 100, + () -> GLOBAL_OPEN_PHOENIX_CONNECTIONS.getMetric().getValue() == 0L); + hbaseTestUtil.waitFor(30000, 100, + () -> GLOBAL_OPEN_INTERNAL_PHOENIX_CONNECTIONS.getMetric().getValue() == 0L); long connections = GLOBAL_OPEN_PHOENIX_CONNECTIONS.getMetric().getValue(); assertEquals(String.format("Found %d connections still open.", connections), 0, connections); connections = GLOBAL_OPEN_INTERNAL_PHOENIX_CONNECTIONS.getMetric().getValue(); @@ -159,7 +165,9 @@ public class MaxConcurrentConnectionsIT extends BaseTest { } finally { connection.close(); } - // All 10 child connections should be removed successfully from the queue + // Child-connection reaping is asynchronous; wait until the queue + // drains before asserting. + hbaseTestUtil.waitFor(30000, 100, () -> connection.getChildConnectionsCount() == 0); assertEquals(0, connection.getChildConnectionsCount()); } }
