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 6f5e8a908c PHOENIX-7952 UpsertSelectIT is flaky due to a connection
leak check using a global counter (#2561)
6f5e8a908c is described below
commit 6f5e8a908cd00b1677a026be7622a4b9ff710eb7
Author: Andrew Purtell <[email protected]>
AuthorDate: Tue Jun 30 15:57:39 2026 -0700
PHOENIX-7952 UpsertSelectIT is flaky due to a connection leak check using a
global counter (#2561)
Co-authored-by: Claude Opus 4.8[1m] <[email protected]>
---
.../org/apache/phoenix/end2end/UpsertSelectIT.java | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java
index 1bf090cdae..0e454b78cf 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java
@@ -107,12 +107,27 @@ public class UpsertSelectIT extends
ParallelStatsDisabledIT {
@After
public void assertNoConnLeak() throws Exception {
- boolean refCountLeaked = isAnyStoreRefCountLeaked();
+ // The server-side UPSERT SELECT path can open auxiliary connections that
are closed
+ // asynchronously on background threads, so a simple synchronous read can
race ahead of
+ // their decrement. Poll for the counter to settle down before declaring a
leak.
+ waitForOpenConnectionsToSettle();
assertTrue(PhoenixRuntime.areGlobalClientMetricsBeingCollected());
- assertEquals(0, GLOBAL_OPEN_PHOENIX_CONNECTIONS.getMetric().getValue());
+ boolean refCountLeaked = isAnyStoreRefCountLeaked();
assertFalse("refCount leaked", refCountLeaked);
}
+ private static void waitForOpenConnectionsToSettle() throws
InterruptedException {
+ final long timeoutMs = 30000;
+ final long pollIntervalMs = 100;
+ long deadline = EnvironmentEdgeManager.currentTimeMillis() + timeoutMs;
+ long openConnections =
GLOBAL_OPEN_PHOENIX_CONNECTIONS.getMetric().getValue();
+ while (openConnections != 0 && EnvironmentEdgeManager.currentTimeMillis()
< deadline) {
+ Thread.sleep(pollIntervalMs);
+ openConnections = GLOBAL_OPEN_PHOENIX_CONNECTIONS.getMetric().getValue();
+ }
+ assertEquals(0, openConnections);
+ }
+
// name is used by failsafe as file name in reports
@Parameters(name = "UpsertSelecttIT_allowServerSideMutations={0}")
public static synchronized Object[] data() {