Repository navigation
Fix flaky 03100_lwu_15_future_reads - #112158
Merged
alexey-milovidov merged 1 commit intoJul 28, 2026
Merged
Conversation
The test ends with
SELECT sum(rows) FROM system.parts
WHERE ... AND startsWith(name, 'patch')
and expects `200`, but that query was racing against the background cleanup
thread.
Once `OPTIMIZE TABLE ... FINAL` has applied the patches, the data version of the
merged part reaches the patches' max data version, so `clearUnusedPatchParts`
considers both patch parts unused and drops them. For `ReplicatedMergeTree` the
drop goes through a `DROP_PART` log entry, which removes the parts outright
rather than leaving them `Outdated`, so they disappear from `system.parts` and
the last query returns `0` - or `100`, when only one of them had been dropped
yet.
On a fast runner the test finishes long before the first iteration of the
cleanup thread, so the race is invisible. On a loaded runner it gets a turn
before the last query; accordingly, all observed failures are on `amd_tsan`,
`amd_msan` and flaky checks.
Pin `remove_unused_patch_parts = 0` on the table, the same way
`03100_lwu_01_basics` and other lightweight-update tests already do, so the
patch parts stay in place for the final check. The future-reads check itself is
unaffected.
Reproduced locally by making the cleanup thread run every second: without this
change the test fails with exactly the diff seen in CI (`-200` / `+0`), with it
the test passes.
CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=107275200b9ab432ec9375a091aad62690484bfd&name_0=MasterCI&name_1=Stateless%20tests%20%28amd_tsan%2C%20parallel%29
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Contributor
|
Workflow [PR], commit [9101372] Summary: ✅ AI ReviewSummaryThis PR makes Final Verdict
|
This was referenced Aug 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
03100_lwu_15_future_readsis flaky. It ends withand expects
200, but that query was racing against the background cleanup thread.Once
OPTIMIZE TABLE ... FINALhas applied the patches, the data version of the merged part reaches the patches' max data version, soclearUnusedPatchPartsconsiders both patch parts unused and drops them. ForReplicatedMergeTreethe drop goes through aDROP_PARTlog entry, which removes the parts outright rather than leaving themOutdated, so they disappear fromsystem.partsand the last query returns0- or100, when only one of them had been dropped yet.On a fast runner the test finishes long before the first iteration of the cleanup thread, so the race is invisible. On a loaded runner it gets a turn before the last query; accordingly, all observed failures are on
amd_tsan,amd_msanand flaky checks. The two sums the test checks were always correct, so this is a test-only race and not a product bug.The fix pins
remove_unused_patch_parts = 0on the table, the same way03100_lwu_01_basicsand other lightweight-update tests already do, so the patch parts stay in place for the final check. The future-reads check itself is unaffected.Verified locally on a
ReplicatedMergeTreesetup by making the cleanup thread run every second (cleanup_delay_period = 1) and widening the window before the last query, which turns the race into a deterministic failure:-200/+0);CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=107275200b9ab432ec9375a091aad62690484bfd&name_0=MasterCI&name_1=Stateless%20tests%20%28amd_tsan%2C%20parallel%29
Changelog category (leave one):
Version info
26.8.1.302(included in26.8and later)