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

palashc 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 5b10f02332 PHOENIX-7822 MaxConcurrentConnectionsIT poll for async 
connection counts (#2439)
5b10f02332 is described below

commit 5b10f0233281b9e000b8b1a1b71a7ba21ceb898b
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());
   }
 }

Reply via email to