This is an automated email from the ASF dual-hosted git repository. virajjasani pushed a commit to branch 5.3 in repository https://gitbox.apache.org/repos/asf/phoenix.git
commit b5b0b2a360d0ae579601fc352c8975585b4c5fd9 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 2a28c61e78..f50254cc94 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 @@ -130,6 +130,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(); @@ -169,7 +175,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()); } }
