Repository navigation
Fix flaky test 02676_optimize_old_parts_replicated - #110178
Merged
Merged
Conversation
The test relies on the automatic whole-partition force merge (`min_age_to_force_merge_on_partition_only`) reducing the number of active parts within a bounded wait. Under heavy parallel load two effects could starve that merge past the wait window, leaving an extra part and a result differing from the reference (`3` instead of `2` in the "disable limit" case): - `getBestPartitionToOptimizeEntire` skips the whole-partition merge while the server-wide background merge pool has fewer free slots than `number_of_free_entries_in_pool_to_execute_optimize_entire_partition` (default 25). On a busy runner this gate keeps firing. - Every merge-selection round that selects nothing multiplies the merge-selecting sleep by `merge_selecting_sleep_slowdown_factor` up to `max_merge_selecting_sleep_ms` (default 60s), so retries become sparse. Set `number_of_free_entries_in_pool_to_execute_optimize_entire_partition=1` and `max_merge_selecting_sleep_ms=1000` on the partition-only tables - the same guards the analogous test 03357_replacing_min_age_cleanup already uses. Closes: #107506 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Contributor
|
Workflow [PR], commit [267e0c7] Summary: ✅ AI ReviewSummaryThis PR makes Missing context / blind spots
Final Verdict
|
1 task
alexey-milovidov
pushed a commit
to lneves12/ClickHouse
that referenced
this pull request
Aug 18, 2026
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]>
github-actions Bot
pushed a commit
to Altinity/ClickHouse
that referenced
this pull request
Aug 24, 2026
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]> (cherry picked from commit 98f7919)
github-actions Bot
pushed a commit
to Altinity/ClickHouse
that referenced
this pull request
Aug 24, 2026
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]> (cherry picked from commit 98f7919)
github-actions Bot
pushed a commit
to Altinity/ClickHouse
that referenced
this pull request
Aug 24, 2026
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]> (cherry picked from commit 98f7919)
zeekay
pushed a commit
to hanzoai/datastore
that referenced
this pull request
Sep 11, 2026
…optimize-old-parts Fix flaky test 02676_optimize_old_parts_replicated
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.
Closes: #107506
The test
02676_optimize_old_parts_replicatedrelies on the automatic whole-partition force merge (min_age_to_force_merge_on_partition_only) reducing the number of active parts within a bounded wait. Under heavy parallel load two effects could starve that merge past the wait window, leaving an extra part and a result differing from the reference (3instead of2in the "disable limit" case):getBestPartitionToOptimizeEntireskips the whole-partition merge while the server-wide background merge pool has fewer free slots thannumber_of_free_entries_in_pool_to_execute_optimize_entire_partition(default 25). On a busy runner this gate keeps firing.merge_selecting_sleep_slowdown_factorup tomax_merge_selecting_sleep_ms(default 60s), so retries become sparse.The fix sets
number_of_free_entries_in_pool_to_execute_optimize_entire_partition=1andmax_merge_selecting_sleep_ms=1000on the partition-only tables - the same guards the analogous test03357_replacing_min_age_cleanupalready uses. No product code changes; only the test.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Not for changelog.
Documentation entry for user-facing changes
🤖 Generated with Claude Code
Version info
26.7.1.863(included in26.7and later)