Flaky test in redis-hbo-provider: TestHistoryBasedRedisStatisticsTracking.testConcurrentHistoryBasedStatsCalculator fails intermittently in CI
Author: yingsu00Created Oct 1, 2026Updated Oct 1, 2026
Labelstestsflaky-build
Failure observed in CI for redis-hbo-provider module.
Related Actions run: https://github.com/prestodb/presto/actions/runs/36702610586/job/109845359343?pr=28540
Repository: prestodb/presto Module: redis-hbo-provider Failing test: com.facebook.presto.statistic.TestHistoryBasedRedisStatisticsTracking.testConcurrentHistoryBasedStatsCalculator
Environment
- CI GitHub Actions run: 36702610586 (job 109845359343)
- Commit ref in logs: 2be44980c4a166589c66db9ebfc71ecb40d5770f
- Test framework: TestNG, Maven Surefire
Expected Behavior
- The history-based statistics tests should be stable and pass in CI.
Current Behavior
- Test intermittently fails with AssertionError: "Plan does not match" because expected history-based statistics are not observed by assertPlan.
- Logs show repeated warnings from router/RemoteState/http client marking local mock Redis endpoints unhealthy and many "Server refused connection" or "AuthorizationPreservingHttpClient ... is stopped" messages. The failure appears timing-related (race) between stats collection persistence and assertions.
Relevant log excerpt (abbrev):
- "Tests run: 22, Failures: 1... TestHistoryBasedRedisStatisticsTracking.testConcurrentHistoryBasedStatsCalculator"
- "java.lang.AssertionError: Plan does not match"
- Many warnings: "Error fetching query infos... is stopped" / "Server refused connection" / "marked as unhealthy" and "Couldn't stop Thread[...]"
Possible Solution / Suggested Fix
- The test uses a fixed Thread.sleep (sleepTimeoutMillis = 6000) after executing queries to allow stats-collection threads to persist history-based statistics. Under CI variance and concurrency this is sometimes insufficient.
- Replace fixed sleep with a polling-based wait that retries assertPlan until the history-based stats appear (or a reasonable timeout elapses). This avoids races and makes the test tolerant to CI timing variability.
- Example change in TestHistoryBasedRedisStatisticsTracking.java:
- Add a helper waitForPlanMatch(...) that polls assertPlan until success or timeout.
- Use that helper in testConcurrentHistoryBasedStatsCalculator when asserting history-based row counts for concurrently-collected queries.
- Optionally increase sleepTimeoutMillis slightly, but polling is the primary fix.
Files involved
- redis-hbo-provider/src/test/java/com/facebook/presto/statistic/TestHistoryBasedRedisStatisticsTracking.java
How to reproduce locally
- Run failing module tests locally: mvn -rf :redis-hbo-provider -Dtest=com.facebook.presto.statistic.TestHistoryBasedRedisStatisticsTracking test
Additional context
- The failure appears flaky and timing-related rather than a functional regression. Making the test resilient to timing (polling) should fix CI flakiness.
Please triage and consider updating the test as suggested. I can open a PR with the patch that replaces the fixed sleep with polling and adds a small helper if desired.
Source: prestodb/presto