Skip to content

Add small-parts batching settings to SimpleMergeSelector - #100436

Merged
alexey-milovidov merged 64 commits into
ClickHouse:masterfrom
amosbird:min-age-merge-threshold
Oct 12, 2026
Merged

alexey-milovidov merged 64 commits into
ClickHouse:masterfrom
amosbird:min-age-merge-threshold

Conversation

@amosbird

@amosbird amosbird commented Mar 23, 2026 •

Copy link
Copy Markdown
Collaborator

Add three new MergeTree settings that let users reduce the number of merge
operations under rapid small-part insertion. When all parts in a candidate
merge range are small, fresh, and fewer than a configurable minimum count,
the merge is rejected — forcing the system to accumulate more parts before
merging.

Settings:

  • merge_selector_small_parts_threshold (default 10 MB) — size ceiling for "small" parts
  • merge_selector_small_parts_min_count (default 0 = disabled) — minimum part count required
  • merge_selector_small_parts_max_age (default 600 s) — age safety valve

Disabled by default. Simulation test with 200 × 1 MB parts at 1 insert/s
shows merge count drops from 42 to 26 (−38%) with negligible WA change.

Rationale

Merging a small number of small parts is wasteful: the I/O cost is high
relative to the modest read-performance improvement. Waiting for more small
parts to accumulate produces wider merges that achieve the same part-count
reduction at lower total write amplification.

Cassandra STCS applies the same idea: it requires at least min_threshold
(default 4) similar-sized SSTables before triggering compaction, and groups
SSTables below min_sstable_size (default 50 MB) together.

The gate applies to background merge selection only. Aggressive selection
(OPTIMIZE without FINAL) is an explicit user request that ignores part
novelty, so fillSimpleSettings disables the gate (small_parts_min_count = 0)
when it builds the aggressive selector — OPTIMIZE TABLE still merges a fresh
below-minimum small range immediately.

The gate is monotone on the candidate set: it only rejects candidate ranges,
it never introduces a new one. So every range the selector emits with the gate
enabled is a range it could also emit with the gate disabled — the gate cannot
invent a merge shape, in particular it cannot steer the selector toward merging
large dissimilar-sized parts.

There is exactly one deliberate exception. The default-on fullness heuristic
(merge_selector_enable_heuristic_to_lower_max_parts_to_merge_at_once) can lower
the effective max_parts_to_merge_at_once below
merge_selector_small_parts_min_count, which would make the minimum unattainable
and silently degrade the gate into "block all fresh small merges until
merge_selector_small_parts_max_age". To avoid that, enumeration is extended
through the first all-small, all-fresh candidate of exactly
merge_selector_small_parts_min_count parts. That extension is deliberately
narrow: stale or large ranges keep the lowered cap, an explicitly configured
max_parts_to_merge_at_once below the minimum keeps it (that is a contradictory
configuration, and it is documented as such), and ranges that already reached
min_age_to_force_merge keep it too — allow accepts those before the
small-parts gate is evaluated, so the gate is not what blocks them and there is
nothing to compensate for.

merge_selector_window_size is a hard width limit in the same way: it is a
global anti-snowball protection and is not widened for the gate, so
configuring it below merge_selector_small_parts_min_count is likewise
contradictory. This is documented in the setting description.

That is deliberately a statement about the candidate set, and it is the only
claim this PR relies on. Two things it explicitly does not claim:

  • It is not a "defer only" guarantee within a single selection round.
    Estimator keeps one global best candidate per partition, so rejecting the
    top-scoring small batch can hand that round to a different, already-eligible
    range rather than produce no merge. For example, in a fresh partition shaped
    [1, 1, 1, 1000, 5, 5, 5, 5, 1000, ...] MiB with
    merge_selector_small_parts_min_count = 4, the three 1 MiB parts are the best
    candidate without the gate, and with the gate the four 5 MiB parts are merged
    instead. The rejected batch is still merged later (or immediately once
    min_age_to_force_merge or the age safety valve fires).
  • It does not claim the base-ratio predicate
    (sum_size / max_size >= lowered_base) holds for every emitted range. The
    pre-existing right-tail trimming heuristic can already shorten a range after
    it passes allow, independently of these settings; this PR does not change
    that behavior.

Changelog category (leave one):

  • Improvement

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Add merge_selector_small_parts_min_count, merge_selector_small_parts_threshold, and merge_selector_small_parts_max_age MergeTree settings to reduce the number of merge operations under rapid small-part insertion by requiring a minimum batch size before merging small fresh parts.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

Three new MergeTree settings are added. When merge_selector_small_parts_min_count is set to a non-zero value (e.g. 8), the merge selector will not merge small parts (below merge_selector_small_parts_threshold bytes) that are younger than merge_selector_small_parts_max_age seconds unless at least that many parts are available. This reduces merge churn under rapid small-part insertion workloads.


Workflow [PR]
Sync PR [sync-upstream/pr/100436]

Version info

  • Merged into: 26.10.1.2172-master (included in 26.10 and later)

Add three new MergeTree settings to reduce write amplification under rapid
small part insertion:

- `merge_selector_small_parts_threshold` (default 10 MB): max size for a
  part to be considered "small"
- `merge_selector_small_parts_min_count` (default 0 = disabled): minimum
  number of parts required before merging small fresh parts
- `merge_selector_small_parts_max_age` (default 600s): age safety valve —
  once the youngest part in the range exceeds this age, the restriction is
  lifted so old small parts can still eventually merge

When all three conditions are met (all parts small, all parts fresh, too
few parts), the merge is rejected, forcing the system to accumulate more
parts before merging. This reduces the total number of merge operations.

Simulation test shows ~38% fewer merges (42 → 26) with negligible WA
change (3.31 → 3.325) for 200 × 1 MB parts inserted every 1 second.
@clickhouse-gh

clickhouse-gh Bot commented Mar 23, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [f7b73b6]

Summary: ✅


AI Review

Summary

This PR adds three opt-in MergeTree settings that batch fresh small parts in SimpleMergeSelector, wires them through the selector setup, exempts aggressive OPTIMIZE from the new gate, and adds focused regression coverage for trimming, force-merge precedence, lowered-cap interactions, and the untrimmed age valve. I did not find any correctness, compatibility, or performance issues in the current diff. The previously reported edge cases are fixed or explicitly narrowed in the durable docs/comments, and the current PR CI is all green.

Final Verdict

✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-improvement Pull request with some product improvements label Mar 23, 2026
amosbird and others added 3 commits March 24, 2026 11:09
The new merge selector small-parts settings were originally added to the
`26.4` block in `SettingsChangesHistory.cpp`. After merging master, `26.5`
is the new current version, so move them there.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member

@groeneai, provide a fix for stress test failures: Logical error: 'std::exception. Code: 1001, type: std::out_of_range, e.what() = unordered_map::at: key not found (version 26.5.1.476), Stack trace: (STID: 2508-3132)

@groeneai

groeneai commented May 9, 2026

Copy link
Copy Markdown
Collaborator

@alexey-milovidov — STID 2508-3132 (and the sibling stack-frame variants 2508-34fb, 2508-3307, 2508-3cd3) are the chronic InsertDependenciesBuilder::createSelect unordered_map::at: key not found family. Tracking under our umbrella P0 task 2026-04-29-ci-p0-stid-2508-34fb-logical-error-std.

⚠️ Status update on the in-flight fix:

Your PR #98779 ("Fix assertion failure in view dependencies on DROP+CREATE MV") merged 2026-05-08 21:44 UTC, but the family is still firing on master post-fix — CIDB shows 9 master hits across 5 distinct master commits in the 24h after the merge, all on commits that include 3cf32af9 (the fix). Examples:

commit time (UTC) jobs
9ed0cd6b80c 2026-05-09 22:19 Stress test (arm_asan_ubsan, s3)
9250c75921 2026-05-09 22:08 Stress test (arm_tsan)
7ef3e901ad 2026-05-09 10:10 Stress test (experimental, serverfuzz, …) ×3
b38a892dfb 2026-05-08 23:22 Stress test (azure, amd_msan)

The hit on this PR (version 26.5.1.476, STID 2508-3132) is the same chronic family, surfacing on PR CI under fuzzer/stress mutation pressure. Not a regression caused by this PR.

PR #98779 evidently doesn't cover all unordered_map::at lookup paths in createSelect / createPostSink. We're escalating to investigate the residual code paths and will open a follow-up fix PR. Will reference this directive in the fix PR.

alexey-milovidov and others added 2 commits May 17, 2026 21:31
… limit

Switch the `merge_selector_small_parts_max_age` safeguard to compare against
the **oldest** part in a candidate range (`max_age`) instead of the
**youngest** part (`min_age`).

The intent — documented both in the header and in the PR description — is
that the batching restriction should apply only when *all* parts in the
range are still fresh. The previous condition `min_age < small_parts_max_age`
is the opposite: it is satisfied whenever *any* part is fresh, so a single
newly inserted small part can keep blocking merges with older small parts
indefinitely, even when the rest of the range has long since aged past the
limit.

Using `max_age` correctly expresses "all parts fresh" and makes the
threshold a proper safety valve: as soon as any part ages past the limit,
the restriction is lifted and the backlog of stale small parts can merge.

Also align the setting description in `MergeTreeSettings` and the comment
in `SimpleMergeSelector.h` with the corrected semantics.

Addresses review on ClickHouse#100436.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member

@groeneai, investigate the AST fuzzer failure: Received signal 6 (STID: 3452-4527) and provide a fix in a separate PR. If the fix is already in progress, link it here.

Crash is in correlated-subquery planner (ColumnNode::getSourceWeakPointer → GlobalPlannerContext::collectTableExpressionDataForCorrelatedColumns in src/Planner/PlannerContext.cpp:72) — std::vector::operator[] out of bounds on ColumnNode::weak_pointers. Unrelated to this PR, which only touches SimpleMergeSelector and three new MergeTree settings. Same signature has hit master CI sporadically (2026-04-26, 2026-04-27, 2026-05-18 per CIDB).

The other failure (02180_group_by_lowcardinality in Stateless tests, ParallelReplicas) is the chronic master flake — also unrelated.

@groeneai

Copy link
Copy Markdown
Collaborator

@alexey-milovidov — confirming both failures are tracked and unrelated to this PR. Status of each:

STID 3452-4527 (AST fuzzer, amd_debug targeted, old_compatibility)

Fix PR already in flight: #103738 — "Fix vector OOB in ConvertQueryToCNFPass when WHERE is a correlated subquery (STID 3452-4527)" (groeneai, opened 2026-04-29, in response to your directive on PR #103539).

Root cause matches the stack you described: ConvertQueryToCNFPass enters a correlated_columns_list and replaces a ColumnNode with a _CAST(...) FunctionNode, leaving the column's weak_pointers source vector empty. A later walk in GlobalPlannerContext::collectTableExpressionDataForCorrelatedColumns calls ColumnNode::getColumnSource() → getSourceWeakPointer() → weak_pointers.operator[](0) → out-of-bounds abort (__libcpp_verbose_abort). The fix makes the visitor skip recursion into QueryNode/UnionNode parents so constraint substitution doesn't touch correlated column lists.

PR state right now (commit 89065eb):

  • 162/165 checks green ✅
  • 3 failing checks are all the same chronic function_prop_fuzzer flake (issue FunctionsStress.stress #104877 — 116 hits across 54 unrelated PRs in 30d) + its 2 meta-rollups (Mergeable Check, PR). Unrelated to this fix.
  • 0 reviews — has been awaiting review since 2026-04-30. Would appreciate a ping to @novikd / @KochetovNicolai (correlated-subqueries / analyzer area).

CIDB confirms 3452-4527 has only 3 hits in 30 days, all on unrelated PR runs (2026-04-26 PR #103539, 2026-04-27, 2026-05-18 PR #100436) — never master, never twice on the same PR. Matches "rare trunk bug exposed by fuzzer randomization" pattern, fully unrelated to amosbird's SimpleMergeSelector changes here.

02180_group_by_lowcardinality (Stateless tests, ParallelReplicas s3 storage)

Chronic master flake tracked under task umbrella 2026-05-18-github-pr-105176-… (your prior directive on PR #105176, deadline 2026-05-20). Non-deterministic LIMIT without ORDER BY under parallel-replicas s3 reads. Investigation in progress; not caused by this PR.

Summary

Both failures = pre-existing chronic issues with tracking tasks. No new fix PR needed from PR #100436 — the fix for 3452-4527 is #103738, just needs reviewer attention.

alexey-milovidov and others added 5 commits May 20, 2026 14:39
Workflow files in this branch were stale or had been deleted as a
workaround for GitHub's workflow-scope check. Restoring them to match
`master` so the PR diff no longer contains those unrelated changes.
The version on master is now 26.6.1.1 and `02995_new_settings_history`
requires new settings to be registered under a version strictly greater
than `26.5`. Move `merge_selector_small_parts_threshold`,
`merge_selector_small_parts_min_count` and `merge_selector_small_parts_max_age`
into a new `26.6` `merge_tree_settings_changes_history` section.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
alexey-milovidov and others added 4 commits May 26, 2026 04:31
Cursor Bugbot pointed out that `merge_selector_small_parts_min_count` was
enforced in `allow` before `Estimator::consider` ran the right-tail trimming
heuristic. A candidate passing with `size == small_parts_min_count` could then
be shortened to fewer parts and still scheduled, breaking the contract
"require at least this many parts".

Concrete case: 8 fresh parts, all `< merge_selector_small_parts_threshold`,
sizes `[9 MiB, 7 x 64 KiB]`, `small_parts_min_count = 8`. The range passes
`allow`, then trimming reduces it to 2-3 parts, so a `< 8` merge still runs.

Re-check the gate inside `Estimator::consider` after trimming. Since trimming
removes only small parts from the right end, the trimmed range's `max_size`
and `max_age` cannot exceed the originals, so passing the originals through
is conservative and correct.

Added a regression test that constructs the failing scenario directly.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…gate

Cursor Bugbot pointed out that the post-trim re-check added in 972ca72 was
still bypassable. The gate compared pre-trim `max_size`/`max_age`, so if the
right tail held the only large or only old part, the pre-trim max would see
"large" or "old" and skip the gate — even when the surviving trimmed range
was the all-small-fresh batch the user wanted to defer.

Concrete case: 8 small parts where the rightmost is tiny and old (age > 600,
size < 1% of sum). `allow` accepts the range because pre-trim `max_age` is
old, so the small-parts gate is bypassed. Right-tail trimming removes the
old tail, leaving < 8 parts that are all small and fresh. The post-trim
re-check still sees the old pre-trim `max_age` and lets the merge through.

Fix: compute `max_size` and `max_age` over the trimmed `[begin, end)` range
inside `Estimator::consider` and apply the gate to those values.

Added a regression test (`SmallPartsMinCountUsesTrimmedMaxAge`) that
reproduces the failing scenario directly: 7 x 1 MiB fresh + 1 x 8 KiB old
at the right tail. Trimming removes the tail; the trimmed range's `max_age`
is fresh, so the gate fires and the candidate is rejected.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
alexey-milovidov and others added 2 commits June 4, 2026 14:12
The simulation in `SmallPartsMinCountReducesWriteAmplification` is
deterministic, so `EXPECT_LE` would still pass if the
`merge_selector_small_parts_min_count` setting stopped affecting the
simulation entirely (`with_small.num_merges == baseline.num_merges`).
Use `EXPECT_LT` so the test actually guards the PR's merge-count
reduction claim (42 -> 26 merges for this workload).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member

Continued this PR:

  • Merged latest master (branch was 609 commits behind, merge-base ~3 days old, and red). Clean merge, no conflicts; settings history entries remain correctly placed under 26.6 (still the latest dev version block).
  • Addressed the one open review thread — strengthened the deterministic simulation assertion from EXPECT_LE to EXPECT_LT in SmallPartsMinCountReducesWriteAmplification, so the test now genuinely guards the merge-count reduction claim instead of passing silently if the setting stops having any effect. Verified locally: baseline 42 merges vs 26 with merge_selector_small_parts_min_count = 8 (−38%, matching the description); all 4 SimpleMergeSelector gtests pass.
  • CI: the only failure (Tests/Server died in Stateless tests (arm_asan_ubsan, targeted)) is the chronic master-wide flake — no specific test, generic "Server died", and the report's own CIDB query tracks it across master. It is unrelated to this change, which only touches SimpleMergeSelector C++ logic and a gtest. The fresh master merge re-triggers CI.

Reviewed the full diff (SimpleMergeSelector, MergeSelectorApplier, MergeTreeSettings, SettingsChangesHistory) — the settings are correctly wired and the post-trim re-check of max_size/max_age in Estimator::consider looks correct.

Comment thread src/Core/SettingsChangesHistory.cpp Resolved
… compatibility

The `SettingsChangesHistory` entries listed the previous values of
`merge_selector_small_parts_threshold` and `merge_selector_small_parts_max_age`
as `0`. Under `compatibility < 26.6` that reverted both knobs to `0`, so a user
who reads the changelog and enables batching by setting only
`merge_selector_small_parts_min_count` would still get no batching: no part can
satisfy `max_size < 0` / `max_age < 0`.

Set the previous values to the runtime defaults (`10 * 1024 * 1024` and `600`),
leaving `merge_selector_small_parts_min_count` as the sole compatibility gate.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@abashkeev abashkeev added the comp-background-ops Background pools/scheduling for merges, cleanup, maintenance. label Sep 4, 2026
… only

The `DECLARE` docstrings of `merge_selector_small_parts_threshold`,
`merge_selector_small_parts_min_count` and `merge_selector_small_parts_max_age` read as
if the gate always applies whenever the `Simple` / `StochasticSimple` selector is used,
but `fillSimpleSettings` zeroes `small_parts_min_count` for aggressive selection, so
`OPTIMIZE` without `FINAL` ignores it. Document the exemption in all three settings
descriptions - they are the durable user-facing docs - and in the `small_parts_*` comment
in `SimpleMergeSelector.h`.

Addresses the review thread on `MergeTreeSettings.cpp` and the AI review verdict.
@alexey-milovidov

Copy link
Copy Markdown
Member

🕵 Merged fresh master (the branch was ~4271 commits behind; clean merge, settings-history entries are already under the latest in-dev 26.9 block) and addressed the AI review's remaining Major in b6787e9: the three merge_selector_small_parts_* DECLARE descriptions - and the small_parts_* comment in SimpleMergeSelector.h - now state that the gate applies to background merge selection only and that aggressive selection (OPTIMIZE without FINAL) ignores it, matching what fillSimpleSettings does. Docs only, no behavior change.

The four affected translation units compile after the merge, and master did not touch src/Storages/MergeTree/Compaction/ in this window, so the previously verified selector behavior and gtests are unchanged.

Public CI was fully green before this push; the only red was CH Inc sync ("tests failed"), whose single private failure was Stress test (arm_asan_ubsan, meta in keeper) → Distributed cache registry is empty - a private-only infrastructure check unrelated to merge selection. The sync PR itself is mergeable, and this push re-triggers the sync run.

alexey-milovidov and others added 2 commits September 16, 2026 21:29
…hold

# Conflicts:
#	src/Core/SettingsChangesHistory.cpp
#	src/Storages/MergeTree/Compaction/MergeSelectors/SimpleMergeSelector.cpp
#	src/Storages/MergeTree/Compaction/MergeSelectors/SimpleMergeSelector.h
#	src/Storages/MergeTree/tests/gtest_simple_merge_selector.cpp
…at_once`

Address review: with `merge_selector_enable_heuristic_to_lower_max_parts_to_merge_at_once`
(default on) a nearly full partition lowers the effective cap to `base`, so a
user-set `min_parts_to_merge_at_once = N` above the cap could never form an
`N`-part candidate: `allow` only saw narrower widths, rejected them all, and
nothing merged until a force-merge setting fired. The compensation that the
small-parts gate already had in `selectWithinPartsRange` now also enumerates
up to `min_parts_to_merge_at_once` when the lowered cap is below it, with the
same exemptions (force-merge eligible ranges, and an explicit
`max_parts_to_merge_at_once` below the floor is left alone).

Also mirror master's new `min_partition_age_to_force_merge` in the post-trim
`min_parts_to_merge_at_once` and small-parts re-checks of `Estimator::consider`,
matching the precedence `allow` gives to it. After merging master the
`ForceMergeByPartitionAgeWaivesMinPartsToMergeAtOnce` gtest failed on this
branch because the re-check only knew about `min_age_to_force_merge`.

New gtests: `MinPartsToMergeAtOnceSurvivesLoweredMaxPartsCap`,
`MinPartsToMergeAtOnceCapCompensationStopsAtTheFloor`,
`MinPartsToMergeAtOnceDoesNotLiftCapForForceMergeEligibleParts`,
`MinPartsToMergeAtOnceDoesNotLiftCapForPartitionAgeForceMerge`.
All 19 `SimpleMergeSelector.*` gtests pass.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member

🕵 Continued this PR:

  • Merged latest master (the branch was CONFLICTING, ~4900 commits behind). Four conflicts, all additive: master added min_partition_age_to_force_merge to SimpleMergeSelector (allow parameter, Settings field, four gtests) next to this PR's max_age parameter and small-parts comment, and appended a new entry to the 26.9 merge-tree settings-history block. Kept both sides everywhere. The three merge_selector_small_parts_* history entries stay under 26.9, which is still the latest merge-tree block on master.
  • Addressed the open review thread / AI "Request changes" (min_parts_to_merge_at_once made unattainable by the lowered max-parts cap): the compensation in selectWithinPartsRange now also enumerates up to min_parts_to_merge_at_once when the fullness heuristic lowers the cap below it, with the same exemptions the small-parts compensation has (25b1452). Four new gtests cover the fix and the exemptions.
  • Reconciled with master's min_partition_age_to_force_merge: the post-trim min_parts_to_merge_at_once and small-parts re-checks in Estimator::consider only exempted min_age_to_force_merge, so after the merge master's own ForceMergeByPartitionAgeWaivesMinPartsToMergeAtOnce gtest failed on this branch. They now share a single qualifies_for_force_merge predicate that mirrors allow, including the partition-age force.
  • Built unit_tests_dbms locally; all 19 SimpleMergeSelector.* gtests pass.

@clickhouse-gh clickhouse-gh Bot added comp-mergetree MergeTree* family: parts, merges, primary index, column statistics, background data transformation. and removed comp-background-ops Background pools/scheduling for merges, cleanup, maintenance. labels Sep 16, 2026
alexey-milovidov and others added 2 commits September 23, 2026 16:22
Master bumped the version to 26.10, so the `settings_changes_history` style check
now requires the records of the three new `merge_selector_small_parts_*` settings
under the `26.10` block of `merge_tree_settings_changes_history`.

CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=100436&sha=25b145228965fbea6343a8281efec79dbd83550d&name_0=PR&name_1=Style%20check
PR: ClickHouse#100436

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…hold

Resolve the conflict with the move of the settings changes history into the setting declarations
(ee6b44f): the history records this PR added to `SettingsChangesHistory.cpp` now live as
trailing arguments of the `DECLARE` of each setting.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
alexey-milovidov and others added 2 commits October 3, 2026 08:37
# Conflicts:
#	src/Storages/MergeTree/Compaction/MergeSelectors/SimpleMergeSelector.cpp
…small_parts_min_count` doc

The lowered-cap exemption and the early escape for a contradictory
configuration apply to `min_partition_age_to_force_merge_seconds` as well
as to `min_age_to_force_merge_seconds`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
alexey-milovidov and others added 2 commits October 11, 2026 05:57
…-parts gate

Add `MinPartitionAgeToForceMergeOverridesSmallPartsMinCountAfterTrim`: with
`small_parts_min_count` armed, `min_age_to_force_merge = 0` and
`min_partition_age_to_force_merge` reached by the idle partition, the
trimmed range must still be selected. The test fails if the partition-age
clause is dropped from `qualifies_for_force_merge` in `Estimator::consider`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@alexey-milovidov alexey-milovidov self-assigned this Oct 12, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Oct 12, 2026
Merged via the queue into ClickHouse:master with commit 221f9b6 Oct 12, 2026
165 checks passed
@alexey-milovidov
alexey-milovidov deleted the min-age-merge-threshold branch October 12, 2026 03:04
@robot-ch-test-poll2 robot-ch-test-poll2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 12, 2026
@clickhouse-gh clickhouse-gh Bot added comp-merges Merges of data parts: choosing what to merge (merge selectors, merge predicates, part collectors)... and removed comp-mergetree MergeTree* family: parts, merges, primary index, column statistics, background data transformation. labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors comp-merges Merges of data parts: choosing what to merge (merge selectors, merge predicates, part collectors)... pr-improvement Pull request with some product improvements pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants