Skip to content

Remove unused memory accounting from text index granules - #119927

Merged
CurtizJ merged 1 commit into
ClickHouse:masterfrom
CurtizJ:text-index-remove-unused-methods
Sep 14, 2026
Merged

CurtizJ merged 1 commit into
ClickHouse:masterfrom
CurtizJ:text-index-remove-unused-methods

Conversation

@CurtizJ

@CurtizJ CurtizJ commented Sep 14, 2026 •

Copy link
Copy Markdown
Member

MergeTreeIndexGranuleText::memoryUsageBytes and MergeTreeIndexGranuleTextWritable::memoryUsageBytes were never called anywhere, so they now throw NOT_IMPLEMENTED. The helper methods that existed only to serve them are removed as well.

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

🤖 Generated with Claude Code


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

Version info

  • Merged into: 26.9.1.1480 (included in 26.9 and later)

`MergeTreeIndexGranuleText::memoryUsageBytes` and
`MergeTreeIndexGranuleTextWritable::memoryUsageBytes` were never called,
so they now throw `NOT_IMPLEMENTED`. The helper methods that existed only
to serve them are removed as well: `TextIndexAnalyzer::memoryUsageBytes`
with the `estimateAbslFlatContainerBytes` helper, and
`PositionListBuilder::allocatedBytes`.

`DictionarySparseIndex::memoryUsageBytes` is kept because it is the
weight function of `TextIndexHeaderCache`.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [24cf7fd]

Summary: ✅


AI Review

Summary

This PR removes dead text-index granule memory-accounting code: the two IMergeTreeIndexGranule::memoryUsageBytes overrides now throw NOT_IMPLEMENTED, and the helper methods that only existed to support those overrides are deleted. I traced the current call sites for memoryUsageBytes and did not find any live path that reaches the text-index granules; the generic skip-index reader only caches vector-similarity granules, while the text-index caches still weigh only DictionarySparseIndex, postings, and token metadata. I do not have a correctness concern with the current diff.

Final Verdict

✅ Approve

LLVM Coverage Report

Measured on commit 24cf7fd.

Metric Baseline Current Δ
Lines 89.10% 89.10% +0.00%
Functions 91.80% 91.80% +0.00%
Branches 81.50% 81.50% +0.00%

Changed lines: Changed C/C++ lines covered: 2/8 (25.00%) · Uncovered code

Full report · Diff report

@clickhouse-gh clickhouse-gh Bot added pr-not-for-changelog This PR should not be mentioned in the changelog comp-text-index Full-text search: inverted/text index in MergeTree (tokenizers, posting lists, GIN-style index bu... labels Sep 14, 2026
@clickhouse-gh

clickhouse-gh Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing 24cf7fd6f with master 5de5d86a8 (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.

Compile time of recompiled translation units

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

Median compile-time ratio to the baselines is ×0.93 (machine-speed difference or a change affecting every TU); per-TU deltas below are relative to that ratio.
The matched translation units cost -21.4 s (-7%) in total before that adjustment.

Job report

@CurtizJ CurtizJ self-assigned this Sep 14, 2026
@CurtizJ
CurtizJ added this pull request to the merge queue Sep 14, 2026
Merged via the queue into ClickHouse:master with commit a8b2372 Sep 14, 2026
176 checks passed
@CurtizJ
CurtizJ deleted the text-index-remove-unused-methods branch September 14, 2026 17:30
@robot-clickhouse-ci-1 robot-clickhouse-ci-1 added the pr-synced-to-cloud The PR is synced to the cloud repo label Sep 14, 2026
CurtizJ added a commit to CurtizJ/ClickHouse that referenced this pull request Sep 19, 2026
Resolves conflicts with the `pfor` posting list codec from
ClickHouse#118123:

- `SegmentedPostingListCodecBase` keeps master's class hierarchy and takes over
  `getSegmentSize`, `createEncoder` and the `decode` overloads bounded by the
  token metadata; `createEncoder` uses the codec's own type, so `pfor` indexes
  are built with a PFor encoder
- `addDocumentsFromMap` from master takes the `PostingListBuildContext`
- the memory accounting of posting list encoders is removed together with the
  granule memory accounting removed in
  ClickHouse#119927

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-text-index Full-text search: inverted/text index in MergeTree (tokenizers, posting lists, GIN-style index bu... pr-not-for-changelog This PR should not be mentioned in the changelog 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.

2 participants