Skip to content

Fix mark cache keys and eviction of projection parts - #121829

Merged
tuanpach merged 7 commits into
ClickHouse:masterfrom
groeneai:fix-markcache-insert-evict-key
Nov 23, 2026
Merged

tuanpach merged 7 commits into
ClickHouse:masterfrom
groeneai:fix-markcache-insert-evict-key

Conversation

@groeneai

@groeneai groeneai commented Sep 23, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #107302

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

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

Fixed Mark index N is out of range (LOGICAL_ERROR) and similar errors in queries served by a projection after a part with the same name was created again, for example after TRUNCATE or SYSTEM RESTORE REPLICA: the mark cache entries of projection parts were not evicted. prewarm_mark_cache now also warms the marks of the projection parts an INSERT writes.

Description

On 26.10.2.103 and 26.8.34.13 the queries below fail with Code: 49 ... Mark index 26 is out of range [0, 26) (26.3.60.2: Unknown codec family code): the projection read finds the marks of the projection part that TRUNCATE removed.

A mark cache key must identify the part that owns the marks. Fixed sites:

  • the read path keyed on getFullPath(), which is <part>/<name>.proj/ for a projection, while the insert and every eviction site key on getRelativePathOfActivePart() = <part>/<name>/. Both read sites now share one getCacheKey();
  • prewarmCaches() added the marks of projection streams under the parent part, and dropped them with finalize_projection_parts_synchronously = 1; each stream is now attributed to its own part;
  • clearCaches() cleared only the part itself. A projection cleared its entries when destroyed, but on forcefullyMovePartToDetachedAndRemoveFromMemory (SYSTEM RESTORE REPLICA, broken or not byte-identical parts) that is after renameToDetached moved its keys under detached/. It now clears the projection parts too, replacing the loop that did this for the columns cache only;
  • removeIndexMarksFromCache() used the table's indices for a projection part, so the marks of a projection's own implicit minmax indices were never evicted.

ALTER TABLE ... DETACH PART clones the part and was not affected.

Tests: 05243_mark_cache_projection_key (a prewarmed projection read has no misses, both finalization modes) and 05243_mark_cache_projection_key_detached (after SYSTEM RESTORE REPLICA a projection read loads its data and index marks again). Both fail on master, the second also with only the clearCaches() change; 30 randomized runs each are green.

The mismatch is also the only way to reach LOGICAL_ERROR: Number of marks N is not divisible by number of columns in mark M (7 Stress test aborts in 150 days, latest 2026-08-28 arm_msan); I could not reproduce that abort locally.

Repro
CREATE TABLE pd (a UInt64, b UInt64, PROJECTION p (SELECT a, b ORDER BY b))
ENGINE = MergeTree ORDER BY a SETTINGS old_parts_lifetime = 0;
INSERT INTO pd SELECT number, number FROM numbers(100000);
SELECT sum(b) FROM pd WHERE b < 300000 SETTINGS force_optimize_projection = 1;
TRUNCATE TABLE pd; DETACH TABLE pd; ATTACH TABLE pd;
INSERT INTO pd SELECT number, number * 3 FROM numbers(300000); -- all_1_1_0 again
SELECT sum(b) FROM pd WHERE b < 300000 SETTINGS force_optimize_projection = 1; -- 14999850000

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

Version info

  • Merged into: 26.12.1.243-master (included in 26.12 and later)

A mark-cache key must identify the part that owns the marks. Two sites
disagreed about that, and for a projection part they compose into a cache
that is written and read under keys nothing else uses.

MergeTreeMarksLoader's read path built the key from
data_part_storage->getFullPath() = <disk>/<root_path>/<part_dir>/, while
addMarksToCache and all three eviction sites
(MergeTreeDataPartCompact::removeMarksFromCache,
MergeTreeDataPartWide::removeMarksFromCache,
IMergeTreeDataPart::removeIndexMarksFromCache) build it from
getRelativePathOfActivePart() = <disk>/<root_path>/<name>/. The only
difference is part_dir vs name, and for a projection part they differ
permanently: DataPartStorageOnDiskFull::getProjection gives the projection
storage part_dir = "<proj>.proj" while writeProjectionPart names the part
"<proj>". An Active top-level part always has part_dir == name, which is
why this stayed invisible.

MergeTreeTemporaryPart::prewarmCaches() called addMarksToCache(*part, ...)
for every entry of streams, but on the INSERT path streams also holds the
projections' output streams: writeTempPartImpl moves them into the parent's
list whenever finalize_projection_parts_synchronously is false, which is the
default. A compact writer keys its cached marks by the literal "data", and
addMarksToCache resolves both the filename and the key from the part it is
handed, so a compact projection's marks were written under the parent's
data.<ext> key with the projection's num_columns_in_mark.

Composed, the two mean prewarm_mark_cache never warmed a projection's marks
at all: the writer-side insert went to the parent's key, and even a
correctly attributed insert at <parent>/<proj>/ would not have been found by
a read that looks up <parent>/<proj>.proj/. The entries the read path did
cache for a projection were keyed on a string no eviction site ever
computes, so nothing could remove them.

Both read sites now share one private getCacheKey() helper built from
getFullRootPath() / getPartName() / mrk_path, so the expression exists once
instead of twice and cannot drift apart again; getPartName() returns
data_part->name, the same member getRelativePathOfActivePart() reads, so the
keys are byte-identical. prewarmCaches() resolves the owning part per stream
via getProjectionParts(). The index mark cache benefits from the same edit:
its loaders also go through loadMarksSync, so its read key moves into
agreement with its own eviction site at IMergeTreeDataPart.cpp:1060.

This convention is already written down in tree, at
IMergeTreeDataPart.cpp:742 and MergeTreeIndexReader.cpp:179, and both the
primary index cache and the vector similarity index cache already use the
name form on both sides. The data mark cache was the only part-level cache
that did not.

Alternatives considered and rejected: adding num_columns_in_mark to the key
converts the MergeTreeMarksGetter assertion into a silent cache miss and
leaves both the wrong-part write and the never-evicted entry in place;
downgrading that assertion to CORRUPTED_DATA is the same objection, and the
assertion is correct - after this change it is unreachable by construction;
changing the eviction sites to getFullPath() instead contradicts the two
in-tree comments, diverges from the other part-level caches, and would make
an entry inserted while a part sat in a tmp_* directory unevictable after
the rename, which is the same defect with the arrow reversed; gating the
insert on getState() == Active, as MergeTreeIndexReader::read does for
vector granules, is a perf change with a different justification, because
marks are the hot path and a query under a transaction legitimately reads
Outdated parts.

Neither getFullRootPath() nor getPartName() costs more than getFullPath(),
and getCacheKey() runs once per loader, not per mark.

There is no compatibility surface: the change is confined to in-memory cache
keys, with no on-disk format, no marks format, no setting and no versioning
involved. The first read after an upgrade simply repopulates the cache.

The new test 05243_mark_cache_projection_key asserts, from the per-query
ProfileEvents in system.query_log, that a projection-served query records
MarkCacheMisses = 0 and MarkCacheHits > 0 when prewarm_mark_cache = 1, and
that the projection really served it so the oracle cannot pass vacuously. It
is a per-query oracle on purpose: the mark cache is shared with every other
test in a parallel run, which would make a global cache-size assertion both
flaky and vacuous. The three settings that could silently disable the
measured path are pinned in the table's own SETTINGS and the query's own
SETTINGS rather than with a no-random-settings tag, and each of them was
confirmed to turn the oracle red rather than vacuous when perturbed.

The test fails with either edit applied alone and passes only with both,
which is the reason one change touches two sites.

Even so it carries no-parallel and no-parallel-replicas. The oracle is a
cache-hit oracle, so another test's SYSTEM CLEAR MARK CACHE landing between
the INSERT that warms the marks and the SELECT that reads them empties the
cache it measures, and a projection cannot serve the query at all when
parallel replicas run without a local plan or with aggregation in order.
Re-warming instead of tagging is not available: SYSTEM PREWARM MARK CACHE
does not recurse into projections, and its insert route is the read key,
which would make the test pass with only one of the two edits.
Cut the two comment lines that narrated the fix's design; kept the pre-existing-property lines.
@groeneai groeneai added can be tested Allows running workflows for external contributors groeneai-origin-oranjeai PR origin: delegated from the OranjeAI sibling fleet labels Sep 23, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author
Internal second-model review: adjudication log (click to expand)

Pre-publication review by an independent model (engine: codex; 3 gate findings plus 4 from my own
cold review; bounded: 1 full pass + 1 fix round + 1 delta recheck).

# Sev Finding Verdict Evidence / action
1 ⚠️ The new test's oracle reads the process-global mark cache and projection usage, with no Tags: line (05243_mark_cache_projection_key.sql) AGREE, fixed 05111_json_metadata_streams_not_reopened.sh:37 clears the mark cache in the same parallel bucket, and the ParallelReplicas job rejects every projection unless two randomized settings align (projectionsCommon.cpp:96-107). Added no-parallel-replicas, no-parallel, matching 03759_marks_cache_events, and verified each tag takes effect (an unknown tag is silently ignored)
2 ⚠️ finalize_projection_parts_synchronously = 1 still discards a projection's marks instead of prewarming them (MergeTreeDataWriter.cpp:1169-1177) AGREE on the claim, DISAGREE on the prescribed code change True and pre-existing: the branch is byte-unchanged from master and calls finalizer.finish() without moving the streams into temp_part->streams, so prewarmCaches() cannot see them. Not extended: it exists to release writer-buffer memory at finalize time (Settings.cpp:355) and the setting is off by default. The entry now names the setting; the test is not exposed to it (not randomized, in no CI profile)
3 ⚠️ Startup, fetch and merge prewarming still operate on parent parts only, contradicting an unqualified promise (MergeTreeData.cpp:4027, StorageReplicatedMergeTree.cpp:5823, MergePlainMergeTreeTask.cpp:171) AGREE on the claim, DISAGREE on the prescribed code change Verified, including that MergeTask.cpp:2484-2504 never folds a projection sub-task's cached marks. All pre-existing and untouched here; recursing those paths into projections is a separate feature. Applied the alternative the finding offers: the entry now says "the projection parts an INSERT writes" and states that merge-, fetch- and startup-produced projection parts are still not prewarmed
4 ⚠️ The test never exercises the changed index-mark-cache branch (MergeTreeDataWriter.cpp:495-502) DISAGREE That branch has no content to discriminate: a projection gains secondary indices only from the implicit-minmax settings at ProjectionsDescription.cpp:549-557 (all default false, none randomized), and the PROJECTION grammar has no INDEX clause, so releaseCachedIndexMarks() is empty for a projection stream. The index-mark realignment is unobservable through SQL, since a top-level active part has part_dir == name and both spellings already produced the same key. Softened that sentence in the description instead of adding a non-default setting and a second index to the fixture
5 💡 streamOwner() returns null and silently drops the marks if a projection is missing from getProjectionParts() DISAGREE Unreachable on the only producing path: addProjectionPart runs at MergeTreeDataWriter.cpp:1167, before the streams move at :1182-1186, and neither sink detaches projections before prewarmCaches(). Dropping the prewarm is the fail-safe direction; falling back to the parent would reinstate the defect

The one quantitative claim in the description was re-measured against the public CI database before
freezing: rows whose context contains MergeTreeMarksGetter over 150 days are exactly 7, on 3
branches, all Stress test, most recent 2026-08-28 arm_msan.

Round 2 was a delta re-review of the single fix round (the tags line; src/ verified byte-identical).
It produced no new findings, and the second-model pass ended at zero once the changelog entry named
finalize_projection_parts_synchronously.

Severity: ❌ blocker / ⚠️ major / 💡 nit. DISAGREE verdicts carry recorded evidence and are
terminal per finding. Findings on hunks unchanged by the fix round are auto-dropped.

@clickhouse-gh clickhouse-gh Bot closed this Sep 23, 2026
@clickhouse-gh clickhouse-gh Bot reopened this Sep 23, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? YES. 05243_mark_cache_projection_key against a Debug server: 1 0 0 vs reference 1 1 1 on master, 20/20 under randomization. Not probabilistic: the mechanism is a key mismatch, so the miss is certain.
b Root cause explained? YES. The read path keyed on getFullPath() = <root>/<part_dir>/ while the insert and every eviction site key on getRelativePathOfActivePart() = <root>/<name>/, and a projection's directory is <name>.proj; independently, prewarmCaches() handed every stream in streams to the parent part, and on the INSERT path that list also holds the projections' streams. Composed: prewarm_mark_cache never warmed a projection's marks, and what the read path cached was keyed where no eviction site could remove it.
c Fix matches root cause? YES. The key is the identity of the cached object, so the key is the source. Rejected: adding num_columns_in_mark to the key or downgrading the LOGICAL_ERROR (both turn the assert into a silent miss and leave the two sites disagreeing), keying eviction on getFullPath() (contradicts the two in-tree comments and leaves an entry inserted under a tmp_* directory unevictable after the rename), and gating the insert on getState() == Active (a perf change with a different justification).
d Test intent preserved / new tests added? YES. No existing test modified; one new stateless test, and it asserts the projection actually served the query, so it cannot pass vacuously. Its oracle is per-query ProfileEvents from system.query_log; since the mark cache is process-global it carries no-parallel and no-parallel-replicas, matching 03759_marks_cache_events and 03640_load_marks_synchronously, both verified to take effect.
e Both directions demonstrated? YES, on six Build-ID-verified binaries, each server asserted via SELECT lower(buildId()): master 6530df2e FAIL, Edit 1 only bd1b8a9f FAIL, Edit 2 only 4d2a2143 FAIL, both aee73d02/52992597 OK, and the final tree on CI-pinned clang-22 d1733143 OK (20/20 randomized, 20/20 fixed). The single oracle needs both edits, which is why one PR touches two sites.
f Fix is general across code paths? YES. Both read sites now go through one getCacheKey() helper so they cannot drift apart; the insert and all three eviction sites were already conformant and are unchanged; the same edit agrees the index mark cache's read key with its eviction site at IMergeTreeDataPart.cpp:1060. system.merge_tree_index (lookup-only, same helper) still returns the same rows, and every remaining getFullPath() in the changed files must report the real directory (two diagnostics, one getDirectorySyncGuard).
g Fix generalizes across inputs (params/datatypes/wrappers)? YES. Compact and Wide parents by Compact and Wide projection parts, all four proven byte-identical across the read, insert and eviction keys by instrumenting the three sites; patch parts verified (19/19 03100_lwu_* OK). Settings exercised: prewarm_mark_cache 0/1, min_bytes_to_prewarm_caches 0 and 1e9, min_bytes_for_wide_part 0 and 1G, optimize_use_projections 0/1, plus 50 randomized runs. Boundaries: marks_count == 0 returns before the key is built, and mark_cache == nullptr never reaches the helper.
h Backward compatible? YES, trivially. In-memory cache keys only: no on-disk format, no marks format, no setting, no SettingsChangesHistory.cpp entry, no versioning. The first read after an upgrade repopulates the cache.
i Invariants and contracts preserved? YES. getCacheKey() is const and pure, reads only already-immutable loader members, and is called only inside the two existing if (mark_cache) branches. prewarmCaches() keeps its structure: releaseCachedMarks() and releaseCachedIndexMarks() are still called exactly once per stream (they swap-and-clear), and the primary_index_cache branch is untouched. A projection missing from getProjectionParts() drops its marks rather than attributing them to the wrong part, the conservative direction and unreachable today. No lock-ordering, atomicity or early-return change; the mark cache is RAM-only.

Session id: cron:clickhouse-impl-slot-4:20260923-174200

@clickhouse-gh

clickhouse-gh Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [b77b018]

Summary: ✅


AI Review

Summary

The PR aligns projection mark-cache keys across reads, insert prewarming, and eviction; preserves projection marks during synchronous finalization; and clears projection caches before detach. Review of b77b0188676990f484f440f82fea85649994ff8f found no new actionable issues. The earlier bot findings are addressed in the current code.

Missing context / blind spots
  • ⚠️ No local build or test rerun was available. Both added regression tests passed in CI on d28a021c; the only subsequent commit changes comments. Regression results for the current head were not yet available.
Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-improvement Pull request with some product improvements label Sep 23, 2026
@clickhouse-gh clickhouse-gh Bot added the comp-projections Projections: precomputed layouts for accelerating queries (projection parts, maintenance). label Sep 23, 2026
`prewarm_mark_cache` warmed the marks of the projection parts an INSERT
writes only when `finalize_projection_parts_synchronously` is 0. With the
setting on, each projection stream's finalizer is finished in place and the
projection's temporary part is destroyed at the end of the loop iteration, so
the stream never reaches `temp_part->streams` and `prewarmCaches()` never sees
its cached marks: the projection's marks were dropped instead of inserted.

Measured on the previous head of this PR (build id d17331439dca), with
`prewarm_mark_cache = 1` and a projection-served aggregation:

  finalize_projection_parts_synchronously = 0 -> MarkCacheHits 1, Misses 0
  finalize_projection_parts_synchronously = 1 -> MarkCacheHits 0, Misses 1

and on this head (build id c6321883f121) both modes report 1 hit / 0
misses. Pristine master (95a6488) fails both arms of the test, 1 0 0.

The finished stream's marks are taken where the stream is released and warmed
after the part is renamed, which is the only point where the cache key names
the final path. Only the mark maps are kept (60 bytes for the test's
projection part; marks x columns x 16 bytes in general), not the writer
buffers that branch exists to free, so the setting's memory reduction is
preserved. Nothing is kept when prewarming is off, because the writer then
caches no marks and both maps come back empty.
@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - 0527953

Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
whose fixing-PR link will be posted here when it opens. Only CH Inc sync is exempt.

Check / test Reason Owner / fixing PR
Upgrade check (amd_release) / Segmentation fault (STID: 5726-4458) crash, not from this PR (it changes only the mark cache keys of projection parts): segfault in the TemporaryBlockStreamHolder constructor under GraceHashJoin::addBuckets; the same STID is in 13 runs on 11 PRs and master since 2026-10-15 #126204 (mine, open)
Upgrade check (amd_release) / the 4 Cannot list/count/submit/run ... mutation rows fallout of the crash above: the server was down (Connection refused on port 9000) #126204 (the owner of the row above)
Stateless tests (arm_binary, s3 storage, DBReplicated, parallel, 1/2) / 04625_hash_table_sizes_stats_table_expression_modifiers flaky, test timeout: the randomized MergeTree settings had index_granularity 10 with compact parts, so the FINAL reads on S3 storage are very slow; passed on rerun #126168 (external, open)
Stateless tests (arm_asan_ubsan, targeted) infra, the job ran no test: its test-selection read got HTTP 500 (total) memory limit exceeded from the CI database (Failed to load test selection), like 14 targeted jobs on 14 PRs in the last day #125613 (mine, open)
Mergeable Check, PR praktika rollups of the rows above #126204, #126168 and #125613 (the owners of the rows above)

Session id: cron:our-pr-ci-monitor:20261017-143010

@groeneai

groeneai commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator Author

The key mismatch this PR fixes is also reachable as a failing query. On 26.10.2.103:

CREATE TABLE pd (a UInt64, b UInt64, PROJECTION p (SELECT a, b ORDER BY b))
ENGINE = MergeTree ORDER BY a SETTINGS old_parts_lifetime = 0;
INSERT INTO pd SELECT number, number FROM numbers(100000);
SELECT sum(b) FROM pd WHERE b < 300000 SETTINGS force_optimize_projection = 1;
TRUNCATE TABLE pd; DETACH TABLE pd; ATTACH TABLE pd;
INSERT INTO pd SELECT number, number * 3 FROM numbers(300000); -- all_1_1_0/p.proj again
SELECT sum(b) FROM pd WHERE b < 300000 SETTINGS force_optimize_projection = 1; -- expected 14999850000

The last query fails with Code: 49 ... Mark index 26 is out of range [0, 26) (LOGICAL_ERROR), and a debug build of master aborts in MarksInCompressedFile::get. With SYSTEM DROP MARK CACHE before it the result is correct: the read finds the marks the removed projection part left in the cache.

#125404 fixes the same mismatch from the other side: it makes getRelativePathOfActivePart return <part>/<projection>.proj/ and leaves MergeTreeMarksLoader keyed on getFullPath(). Each PR alone makes the read and eviction keys agree, but with both merged they disagree again (this PR keys the reads on getFullRootPath() / getPartName(), i.e. <part>/<projection>/). The two diffs touch disjoint files, so they merge without a conflict; whichever lands second has to drop its key change.

@tuanpach

tuanpach commented Nov 9, 2026

Copy link
Copy Markdown
Member

The key alignment looks correct, but the detach path still leaves projection marks in the cache. clearCaches evicts only the parent's marks before renameToDetached. The projection evicts its own marks later, after changeRootPath has moved its key to detached/…, so the old entry stays. Could clearCaches also evict projection_parts marks, like the columns cache already does, with a test for DETACH PART?

@tuanpach tuanpach self-assigned this Nov 9, 2026
groeneai and others added 2 commits November 9, 2026 03:12
`forcefullyMovePartToDetachedAndRemoveFromMemory` clears the caches of the
part before `renameToDetached`, because the rename changes the root path that
the cache keys are built from. It cleared only the parent part: its projection
parts cleared their own entries later, when they were destroyed, by which time
`changeRootPath` had moved their keys under `detached/`, so the entries of the
active path stayed in the mark cache. A part attached back under the same name
(`SYSTEM RESTORE REPLICA`, or a part fetched again after being detached as
broken or not byte-identical) then read the marks of the detached one.

`clearCaches` now calls `clearCaches` of each projection part, which also
covers the index mark cache, the primary index cache and the statistics cache
of projections, and replaces the loop that did this for the columns cache only.

`removeIndexMarksFromCache` enumerated the indices of the table for a
projection part too, while a projection part holds the indices of its
projection (the implicit minmax indices enabled by `add_minmax_index_for_*`
in the projection's `WITH SETTINGS`), so their index marks were never evicted,
not even by `DROP TABLE ... SYNC`. It now uses the projection's metadata.

`ALTER TABLE ... DETACH PART` is not affected: it clones the part into
`detached` and removes the original under its own path.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai groeneai changed the title Key mark-cache entries on the part that owns the marks so prewarm_mark_cache warms projections Fix mark cache keys and eviction of projection parts Nov 9, 2026
@groeneai

groeneai commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks, confirmed and fixed in d28a021.

  • clearCaches now calls clearCaches of each projection part, replacing the columns cache loop (I merged master first, since that loop only exists there). This also covers the projections' index marks, primary index and statistics entries.
  • While testing it I found that removeIndexMarksFromCache used the table's indices for a projection part, so the marks of a projection's own implicit minmax indices (WITH SETTINGS (add_minmax_index_for_numeric_columns = 1)) were never evicted, not even by DROP TABLE ... SYNC. It now uses the projection's metadata.
  • ALTER TABLE ... DETACH PART does not take this path: it clones the part into detached and the original is removed under its own path, so both entries were already gone right after it. The rename-first path is forcefullyMovePartToDetachedAndRemoveFromMemory, so the new test 05243_mark_cache_projection_key_detached goes through SYSTEM RESTORE REPLICA and checks that the read of the re-attached part loads its data and index marks again. It fails on master, on the previous head, and with only the clearCaches change.
  • Not covered: a read still running when the part is detached can put its marks back after clearCaches, because CacheBase::remove does not cancel an in-flight getOrSet. The parent part's own marks have the same window today, so I left it out of this PR.

I also changed the category to Bug Fix: the repro now in the description fails with Mark index 26 is out of range on 26.10.2.103 and 26.8.34.13.

@clickhouse-gh clickhouse-gh Bot added pr-bugfix Pull request with bugfix, not backported by default and removed pr-improvement Pull request with some product improvements labels Nov 9, 2026
@clickhouse-gh

clickhouse-gh Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing b77b01886 with master 31dd125f5 (stripped binary size, per-symbol sizes and ThinLTO time; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes

programs/clickhouse-stripped: smaller than the master baseline by the known offset between the two builds, so the difference is not shown. A delta that differs from the offset by more than 50% of it is shown, in either direction.

The official master build is compiled with -g and a pull request build is not, and XRay counts debug instructions towards its instrumentation threshold, so master instruments thousands of functions more and its binary is ~0.4% larger no matter what the pull request does.

Slowest function optimization changes (ThinLTO)

Median per-function time ratio to the master baseline: programs/clickhouse-keeper ×1.12 (each binary is linked separately, on a different machine and with different build flags); deltas below are relative to it.

Binary Function Master PR Δ vs median
programs/clickhouse DB::registerFunctionConversion(DB::FunctionFactory&) 7.9 s 18.4 s +10.7 s (+139%)
Compile time of recompiled translation units

310 translation units recompiled, 3439 s compile time in total, 310 of them have a recent master baseline.

Job report

…cleared

`forcefullyMovePartToDetachedAndRemoveFromMemory` clears the caches of a part
before renaming it to `detached`, and that part may still be held by a running
read, which can write columns cache entries again afterwards. The comments in
`clearCaches` and `ColumnsCache::removePart` described only the destructor and
the uniquely owned outdated parts, where no reader is left. Comments only.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@clickhouse-gh clickhouse-gh Bot added comp-part-formats Formats of MergeTree data parts in the public repository, that is how a part is laid out on disk ... and removed comp-projections Projections: precomputed layouts for accelerating queries (projection parts, maintenance). labels Nov 19, 2026
@tuanpach
tuanpach added this pull request to the merge queue Nov 23, 2026
Merged via the queue into ClickHouse:master with commit 54bae75 Nov 23, 2026
373 of 374 checks passed
@robot-ch-test-poll2 robot-ch-test-poll2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Nov 23, 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-part-formats Formats of MergeTree data parts in the public repository, that is how a part is laid out on disk ... groeneai-origin-oranjeai PR origin: delegated from the OranjeAI sibling fleet pr-bugfix Pull request with bugfix, not backported by default 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.

4 participants