Repository navigation
Fix flaky tests 05227_lightweight_update_pending_rename and 05331_lightweight_update_before_rename_merge - #125070
Conversation
…htweight_update_before_rename_merge Both tests run RENAME COLUMN with alter_sync = 0 and then wait with ALTER TABLE ... DELETE WHERE 0 SETTINGS mutations_sync = 2. The DELETE cannot be assigned until the ALTER mutation is finalized, every merge-selecting round in that window returns CannotSelect and multiplies the interval by 1.2, and finalizing the ALTER mutation schedules no new round, so the DELETE waits out the backed-off interval (up to max_merge_selecting_sleep_ms, 60 s). Pin merge_selecting_sleep_ms = 100, max_merge_selecting_sleep_ms = 200 on every table, as was done for 03100_lwu_22_detach_attach_patches. The mutations stay held by SYSTEM STOP MERGES / max_replicated_mutations_in_queue = 0, so the tests check the same thing. Failing report (Fast test (arm_darwin), 60 s per-test cap): https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=125032&sha=72c0c5818dc13066056600406d463dd36ae39ffe&name_0=PR&name_1=Fast%20test%20%28arm_darwin%29 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 0 findings) plus a separate cold review (0 code findings; 2 PR-description nits, both applied before opening).
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-10:20261010-110400 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-4:20261010-094600 |
|
Workflow [PR], commit [67fa667] Summary: ✅ AI ReviewSummaryThis PR narrows the merge-selector backoff only inside the two flaky Final Verdict✅ No findings. The change is appropriately scoped to test-only settings, and the current Praktika report for |
Related: #119144
Related: #124653
Related: #115279
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Not for changelog.
Description
05227_lightweight_update_pending_rename(added in #119144) hit the 60 second per-test cap inFast test (arm_darwin):https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=125032&sha=72c0c5818dc13066056600406d463dd36ae39ffe&name_0=PR&name_1=Fast%20test%20%28arm_darwin%29
05331_lightweight_update_before_rename_merge(added in #124653) has the same shape; inFast test (arm_darwin)it runs p99 55.1 s, max 58.8 s over 30 days.Root cause. Both tests run
RENAME COLUMN ... SETTINGS alter_sync = 0and then wait withALTER TABLE ... DELETE WHERE 0 SETTINGS mutations_sync = 2. TheDELETEcannot be assigned while the ALTER mutation is unfinished (alters run in strict order), so every merge-selecting round in that window returnsCannotSelectand multiplies the interval by 1.2. Finalizing the ALTER mutation schedules no new round, so theDELETEwaits out the whole backed-off interval, up tomax_merge_selecting_sleep_ms(60 s). In the failing run 05227 waited 22.1 s, then more than 35 s.The fix pins
merge_selecting_sleep_ms = 100, max_merge_selecting_sleep_ms = 200on every table of both tests, as #115279 did for03100_lwu_22_detach_attach_patches. Both tests hold their mutations withSYSTEM STOP MERGESormax_replicated_mutations_in_queue = 0, not with timing, so what they check is unchanged.Validation on a local debug server with the Fast test config, 20 sequential runs per arm:
DELETEs waited 5 s or more, 05331 took up to 47.8 s;DELETEunder 330 ms, each test under 4 s;system.part_logshows the same merges in both arms, and every held mutation still runs only after the test releases it;Waking the merge selector when an ALTER mutation is finalized would remove this delay in the engine. I kept this PR test only and can send that separately if wanted.
Server log of the failing run,
t_lwu_rename_after(excerpt, server clock UTC+2, table UUID elided)Workflow [PR]
Sync PR [sync-upstream/pr/125070]
Version info
26.10.1.2010-master(included in26.10and later)