Repository navigation
Fix flaky test 03100_lwu_22_detach_attach_patches - #115279
PedroTadim merged 1 commit into
Conversation
The test hits the 60 second per-test cap in Fast test: 7 failures across 7 distinct pull requests over 30 days, 0 on master. Every merge-selection round that selects nothing multiplies the table's merge-selecting interval by merge_selecting_sleep_slowdown_factor, up to max_merge_selecting_sleep_ms (default 60000). Externally woken rounds count too, and mutate() schedules one for every UPDATE and APPLY PATCHES, so the interval saturates at the 60 second ceiling within a second of CREATE TABLE. Any later statement that has to wait for the next selection round then pays that interval. This test issues APPLY PATCHES under mutations_sync = 2, so a single such wait consumes its whole budget. Measured locally, reading the interval the engine itself logs: unpinned, the interval reaches 60000 ms and the longest observed wait between selection rounds is 54832 ms; with the pin the interval never exceeds 200 ms and the longest wait is 121 ms. Over 20 unpinned randomized runs 7 took more than 30 seconds, max 57.51 s against the 60 s cap; with the pin, 100 runs all finished in under 3 seconds. Pin merge_selecting_sleep_ms and max_merge_selecting_sleep_ms on both tables, as the merged ClickHouse#110178 did for 02676_optimize_old_parts_replicated and as 03047_on_fly_mutations_basics_rmt already does. Test only. The engine behaviour is left alone deliberately. That the interval grows on externally woken rounds is a scheduling policy question affecting merge latency and Keeper load for every replicated table, and changing it needs multi-replica measurements this change does not have. Co-Authored-By: Claude Fable 5 <[email protected]>
Internal second-model review (0 blockers, 0 major, 2 nits, all resolved)Independent cold review of the resulting diff, then an independent second-model gate pass, then
Second-model gate pass: 0 findings, full coverage of the changed test, its reference, the Verified independently during review, from source rather than from the author's notes:
Reviewed commit: |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-5:20260818-095700 |
|
Workflow [PR], commit [98f7919] Summary: ✅ AI ReviewSummaryThis PR pins Final Verdict
|
|
cc @scanhex12, could you review this? It is a test-only pin: every merge-selection round that selects nothing multiplies the table's merge-selecting interval up to |
33748e6
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Not for changelog.
Description
03100_lwu_22_detach_attach_patcheshits the 60 second per-test cap inFast test(
Timeout! Killing process group). Measured over 30 days: 7 failures across 7 distinctpull requests, 0 on master. Example report:
https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=115234&sha=3d3a0b0cfb7379259dd3158099a5035c6d7099fe&name_0=PR&name_1=Fast%20test
Root cause. Every merge-selection round that selects nothing multiplies the table's
merge-selecting interval by
merge_selecting_sleep_slowdown_factor, up tomax_merge_selecting_sleep_ms(default 60000). Externally woken rounds count too, andmutate()schedules one for everyUPDATEandAPPLY PATCHES, so the interval saturatesat the 60 second ceiling within a second of
CREATE TABLE. Any later statement that has towait for the next selection round then pays that interval. This test issues
APPLY PATCHESunder
mutations_sync = 2, so a single such wait consumes the whole 60 second budget.Measured locally on one server, reading the interval the engine itself logs
(
Scheduling next merge selecting task after Nms): unpinned, the interval reaches 60000 msand the longest observed wait between selection rounds is 54832 ms; with the pin the
interval never exceeds 200 ms and the longest wait is 121 ms. Over 20 unpinned randomized
runs, 7 took more than 30 seconds (max 57.51 s, i.e. a near miss of the cap); with the pin,
100 runs all finished in under 3 seconds.
The fix pins
merge_selecting_sleep_msandmax_merge_selecting_sleep_mson the test's twotables, which is what the merged #110178 did for
02676_optimize_old_parts_replicatedandwhat
03047_on_fly_mutations_basics_rmtalready does. Test only, no product code change.I did not change the engine here. That the interval grows on externally woken rounds is a
scheduling policy question that affects merge latency and Keeper load for every replicated
table, and justifying a change to it needs multi-replica measurements this PR does not have.
Workflow [PR]
Sync PR [sync-upstream/pr/115279]