Repository navigation
Fix flaky 04239_streaming_combinations: wait for both UNION ALL sides - #106574
Conversation
The "Test Regular Union Stream" subtest spawns
SELECT a FROM t_streaming_test UNION ALL SELECT a FROM t_streaming_test STREAM
against a table that already contains one row (`'started'`, `0`). Both
`UNION ALL` sources scan that row and emit one `started` line each, so the
expected output starts with two `started` lines before any post-INSERT
data arrives.
The test previously synchronized with `read_until "$fifo_1" "started"`,
which returns after the FIRST `started` is observed. There is no
ordering guarantee between the two `UNION ALL` sources, so the regular
side's `started` could still be in flight when the test issues its
`INSERT`s. When that happens the streaming side emits a post-INSERT row
(`0`) into the FIFO before the regular side's `started` reaches stdout,
producing `started\n0\nstarted\n0\n1` instead of the reference
`started\nstarted\n0\n0\n1`. The race widens under `distributed plan` +
`s3 storage` because of the higher and more variable scheduling latency
of those configurations, which is exactly where CI saw the failures
(report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=106423&sha=c63e3b252e8a6bd504220f99031f9ba16a95ce09&name_0=PR&name_1=Stateless%20tests%20%28amd_debug%2C%20distributed%20plan%2C%20s3%20storage%2C%20parallel%29
PR: ClickHouse#106423).
This patch extends `read_until` in `streaming.lib` with an optional
target-count argument (defaults to 1, preserving existing callers) and
updates the `Test Regular Union Stream` subtest to wait for both
`started` markers before issuing the INSERTs, so the post-INSERT rows
are appended in a deterministic position relative to both source rows.
Verified locally: 20/20 passes with random settings disabled, 1/1 with
default randomization.
Caused by: ClickHouse#96130
Related: ClickHouse#106423
Pre-PR validation gate
Session id: cron:clickhouse-ci-task-worker:20260605-151300 |
|
cc @Michicosun — could you review this? It removes a synchronization race in the |
|
Workflow [PR], commit [abe6d09] Summary: ✅ AI ReviewSummaryThe PR fixes a flaky Final VerdictStatus: ✅ Approve |
LLVM Coverage Report
Changed lines: No C/C++ source files changed — skipping uncovered code analysis. Newly covered by added/modified tests: 413 line(s), 24 function(s) across 124 file(s) · Details Top files
|
The
Test Regular Union Streamsubtest of04239_streaming_combinationsspawns:against a table that already contains one row (
'started',0). BothUNION ALLsources scan that row and emit onestartedline each, so the expected reference begins with twostartedlines before any post-INSERT data.The test synchronized with
read_until "$fifo_1" "started", which returns after the FIRSTstartedline.UNION ALLprovides no ordering between sources, so the regular side'sstartedcould still be in flight when the test issuesINSERTs. When that happens the streaming side emits a post-INSERT row (0) into the FIFO before the regular side'sstartedreaches stdout, producingstarted\n0\nstarted\n0\n1instead of the referencestarted\nstarted\n0\n0\n1. The race widens underdistributed plan+s3 storagebecause of higher and more variable scheduling latency, which matches where CI saw the failures.This patch extends
read_untilinstreaming.libwith an optional target-count argument (defaults to 1, preserving existing callers) and updates theTest Regular Union Streamsubtest to wait for bothstartedmarkers before issuing the INSERTs. Post-INSERT rows are then appended at a deterministic position relative to both source rows.CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=106423&sha=c63e3b252e8a6bd504220f99031f9ba16a95ce09&name_0=PR&name_1=Stateless%20tests%20%28amd_debug%2C%20distributed%20plan%2C%20s3%20storage%2C%20parallel%29
Verified locally: 20/20 passes with random settings disabled, 1/1 with default randomization. The race is timing-sensitive in CI; the fix removes the synchronization gap that allowed it.
Related: #106423
Caused by: #96130
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
...
Documentation entry for user-facing changes
Version info
26.6.1.459