From 368cf014d52f43ab207ca60f31069bfc0cc52312 Mon Sep 17 00:00:00 2001 From: Andrew Purtell Date: Tue, 24 Nov 2026 11:23:37 -0800 Subject: [PATCH] PHOENIX-8105 QueryLoggerIT fixed clock expires server calls The test injects a fixed clock that starts at 100. The clock also drives the server, so server call deadlines are far in the past after the reset, and the server drops the call that writes the query log. Start the clock at the current time and compare the start time with the clock. Co-Authored-By: Claude Opus 5.5 --- .../it/java/org/apache/phoenix/end2end/QueryLoggerIT.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryLoggerIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryLoggerIT.java index 5769da066db..e3e695e5e21 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryLoggerIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryLoggerIT.java @@ -280,7 +280,9 @@ private void testPreparedStatement(LogLevel loglevel) throws Exception { props.setProperty(QueryServices.LOG_LEVEL, loglevel.name()); Connection conn = DriverManager.getConnection(getUrl(), props); assertEquals(conn.unwrap(PhoenixConnection.class).getLogLevel(), loglevel); - final MyClock clock = new MyClock(100); + // The fixed clock also drives the server clock. Start it at the current time, so server + // calls do not expire when the test resets the clock. + final MyClock clock = new MyClock(EnvironmentEdgeManager.currentTimeMillis()); EnvironmentEdgeManager.injectEdge(clock); try { String query = "SELECT * FROM " + tableName + " where V = ?"; @@ -323,7 +325,7 @@ private void testPreparedStatement(LogLevel loglevel) throws Exception { assertTrue(LogLevel.TRACE == loglevel ? rs.getString(SCAN_METRICS_JSON).contains("scanMetrics") : rs.getString(SCAN_METRICS_JSON) == null); - assertEquals(rs.getTimestamp(START_TIME).getTime(), 100); + assertEquals(clock.time, rs.getTimestamp(START_TIME).getTime()); assertEquals(rs.getString(TENANT_ID), null); } }