Repository navigation
Fix flaky 03100_lwu_06_apply_patches - #114135
Conversation
The test lists patch parts after `OPTIMIZE ... FINAL` and asserted a patch part the engine is entitled to drop at that point, so it intermittently lost the `patch-...-all_0_0_0_2` row from a `system.parts` listing. `MergeTreeData::clearUnusedPatchParts` drops a patch once its max source data version is <= the minimum data version among the partition's active regular parts. The `ALTER ... APPLY PATCHES, UPDATE` brings that minimum to 3, so from that point on the patch with version 2 is droppable while the one with version 4 is not. That asymmetry is exactly the observed diff, and it licenses the drop before all three of the test's part listings, not only the last one. The `OPTIMIZE ... FINAL` does not lower the minimum, it only merges the two regular parts into one; with `apply_patches_on_merge = 0` it does not consume the patches either. The `cleanup_delay_period = 1000` the test relied on was never a barrier: `IMergeTreeCleanupThread::start` schedules the first iteration with no delay (the delay only applies from the second iteration on), and `wakeup` is a bare `task->schedule` that bypasses the delay from any of its call sites. On `ReplicatedMergeTree` there is also no further interval gate before the patch cleanup. Pin `remove_unused_patch_parts = 0` instead and drop the two superseded delay settings, matching the existing idiom in `03100_lwu_01_basics` and `03100_lwu_15_future_reads`. The `.reference` file is unchanged. Validated in both directions on a single provoked state whose arms differ only in the pin value: forcing a cleanup `wakeup` between the `OPTIMIZE` and the final listing reproduces exactly the CI diff together with the `Will drop unused patch part` log line, and with the pin the same provoked run passes with that log line absent. 50/50 randomized runs pass. I measured the data version of every part in the 9 stateless tests whose `.reference` asserts literal patch-part names. Of those, only this one and the already-pinned `03100_lwu_01_basics` reach the drop condition, so no other test is touched. Tests that assert patch state in aggregate rather than by name are outside that set; `03100_lwu_15_future_reads` and `03100_lwu_51_condition_evaluated_once` are already pinned. Report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=110202&sha=702986aef420b1b00b18acf938bf37f9d3844e9d&name_0=PR&name_1=Stateless%20tests%20%28arm_asan_ubsan%2C%20azure%2C%20parallel%29 Related: ClickHouse#110202
Internal second-model review (3 rounds, 0 blockers) - click to expandThree independent review rounds over this one-line test pin. All findings were in
Also noticed and deliberately not raised: no test covers the positive Session id: cron:clickhouse-review-slot-10:20260810-100800 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-4:20260810-063700 |
|
cc @Michicosun, could you review this? Same pin you added in #100273, here for |
|
Workflow [PR], commit [4ca5499] Summary: ❌
AI ReviewSummaryThis PR makes Final Verdict
|
CI finish ledger — 4ca5499Every failure below has an owner: a fixing PR (ours or external), or a full-effort fix task
Session id: cron:our-pr-ci-monitor:20260810-160000 |
fffccf8
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
Related: #110202
The test asserted a patch part the engine is entitled to drop, so it lost the
patch-...-all_0_0_0_2 15row from asystem.partslisting:failing report.
clearUnusedPatchPartsdrops a patch once its max source data version is<=theminimum data version among the partition's active regular parts. The
ALTER ... APPLY PATCHES, UPDATEbrings that minimum to 3, so from that point on thepatch with version 2 is droppable while the one with version 4 is not. That asymmetry
is exactly the observed diff, and it licenses the drop before all three of the test's
part listings, not only the last one. The
OPTIMIZE ... FINALdoes not lower the minimum.The
cleanup_delay_period = 1000the test relied on is not a barrier: the first cleanupiteration is scheduled with no delay, and
wakeupis a baretask->schedule()thatbypasses the delay from any of its call sites. So I pin
remove_unused_patch_parts = 0instead and drop the two delay settings it replaces. Same one-line idiom as #100273
(
03100_lwu_01_basics) and #112158 (03100_lwu_15_future_reads), which pin it againstthe same background drop. The
.referenceis unchanged.Validated in both directions on one provoked state whose arms differ only in the pin:
forcing a cleanup wakeup reproduces exactly the CI diff with
Will drop unused patch part patch-...-all_0_0_0_2in the log, and with the pin the sameprovoked run passes with that log line absent. 50/50 randomized runs pass.
I measured the data version of every part in the 9 tests that assert literal patch-part
names. Of those, only this one and the already-pinned
03100_lwu_01_basicsreach the dropcondition, so I left the other 7 alone. Tests that assert patch state in aggregate rather
than by name are outside that set;
03100_lwu_15_future_readsand03100_lwu_51_condition_evaluated_onceare already pinned.Version info
26.8.1.1134(included in26.8and later)