Repository navigation
Poll all materialized views with one query in test_rabbitmq_mv_combo - #113972
Conversation
test_rabbitmq_mv_combo fails on Integration tests (amd_msan) with "Time limit of 180 seconds reached". In the failing report the test is neither stalled nor far behind: consumption is monotonic across all 37 observations and reaches 940800 / 1000000 (94.08%), needing about 20 more seconds at its own late rate. The budget goes to the polling loop itself. Each poll iteration issued one SELECT count() per materialized view, and every instance.query() spawns a clickhouse-client process inside the instance container, so the actual poll interval in CI was about 5.0s rather than the ~1s the code asks for. Under msan the cost is process start-up, not query work: every statement in that job shows the same per-query floor regardless of shape. On a shard running three pytest workers, that leaves too little margin to absorb ordinary cross-worker contention. Counting all five targets with a single merge() query removes four of the five spawns per poll. Measured on one box in one session, single worker: 5.14 spawns per poll to 1.02, and polling overhead 19.8s of a 53.8s poll span (36.8%) to 7.8s of 54.8s (14.2%). With three concurrent workers, overhead goes from about 38.7% to about 13.4%. Poll cadence improves from about 1.56s to about 1.15s, so progress is observed more finely as well. Reverting only the merged query returns every number to its previous value. This deliberately does not touch the 180 second deadline, its failure message, the sleep(1), the load or the final assertion, which is what ClickHouse#110224 asked for when it reverted my earlier attempt at loosening the timeout. The merged count was verified equal to the previous per-table sum, both while rows were arriving and once settled, and the anchored pattern was verified to resolve to exactly the five target tables. The anchor is load-bearing: unanchored, combo_[0-9]+ also matches the five combo_N_mv views, and a read of a materialized view goes to its target table, so every row would be counted twice and the loop would exit at half the real progress. Verified on a probe database with distinct per-table counts: anchored 11111 (the five targets, once each), unanchored 22222. Whole-module runs before and after give identical failure sets, and 21 repeat runs with three workers passed. This is not claimed to eliminate the failure: since ClickHouse#110224 the test fails about twice in 24 days over roughly 47000 runs and never on master, a rate no feasible local run count could measure. Related: ClickHouse#109909 Related: ClickHouse#110224
Internal second-model reviewBefore opening this PR I reviewed the change myself and had a second model review it ❌ The anchor comment stated the wrong reason (fixed). Both reviews landed on this
💡 Comments in the new lines do not use inline code (noted, not changed). The repo asks for 💡 Noted, not changed: the polling loop at |
Pre-PR validation gate (click to expand)
Whole-module runs before and after this change give identical failure sets (1 failed, 56 passed both times; the one failure is a local TLS mount gap on the Session id: cron:clickhouse-impl-slot-4:20260808-151700 |
|
cc @kssenii, could you review this? It is a test-only change to |
|
Workflow [PR], commit [948666c] Summary: ✅ AI ReviewSummaryThis PR changes Final Verdict✅ No actionable review findings in the current diff. |
CI finish ledger - 948666cCI is fully finished on this head. One failure, owned, not PR-caused.
Gate detail: (a) 0 of 175 check-runs queued or in_progress (fully paginated); (b) On attribution: this diff is a single integration test file ( The whole Note this failure is invisible to the check-runs API: only the per-test CIDB row is FAIL. On the owner cell: the fix task for this mode has completed its investigation and its write-up is posted on #113408 (@alexey-milovidov's own report of this fleet-wide failure). It concluded the remaining variable is server-side rather than in the repository, so the task is currently waiting on that decision rather than on more analysis from me. The fixing-PR link is still owed on this PR and will be posted here. Session id: cron:our-pr-ci-monitor:20260808-213000 |
Related: #109909
Related: #110224
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
This does not touch the 180 second deadline or its failure message. It removes work from inside
that deadline, which is what #110224 asked for when it reverted my earlier timeout change.
In the failing report the test is neither stalled nor far behind: consumption is monotonic across
all 37 observations and reaches 940800 / 1000000 (94.08%), needing about 20 more seconds at its
own late rate. The budget goes to the polling loop. Each iteration ran one
SELECT count()per materialized view, and everyinstance.query()spawns aclickhouse-clientin the container, so much of the wall clock is client start-up; under msanthat cost is the same whatever the query.
Polling all five targets with one
merge()count cuts the spawns. Measured on one box in onesession, single worker: 5.14 spawns per poll to 1.02, and polling overhead 19.8s of a 53.8s poll
span (36.8%) to 7.8s of 54.8s (14.2%). With three pytest workers, the shard condition in the
failing job, overhead goes from about 38.7% to about 13.4%. Reverting only the merged query
restores every number.
The load, the deadline, the
sleep(1), the failure message and the final assertion are unchanged,and the merged count was verified equal to the previous per-table sum both while rows were arriving
and once settled. The pattern is anchored on purpose: unanchored,
combo_[0-9]+also matches the five
combo_N_mvviews, and reading a view goes to its targetcombo_N, soevery row would be counted twice and the loop would exit at half the real progress.
This may not eliminate the failure. Since #110224 the test fails about twice in 24 days over
roughly 47000 runs and never on master, so the claim is the measured overhead reduction rather
than a rate change. 21 repeat runs with three workers passed.
Version info
26.8.1.1011(included in26.8and later)