Skip to content

Fix high memory usage of text index materialization on packed or compact parts - #132964

Merged
CurtizJ merged 5 commits into
masterfrom
ahmadov/fts-packed-memory
Nov 23, 2026
Merged

CurtizJ merged 5 commits into
masterfrom
ahmadov/fts-packed-memory

Conversation

@ahmadov

@ahmadov ahmadov commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

MATERIALIZE INDEX of a text index on a packed or compact part kept the whole index in memory and ignored the setting text_index_max_memory_usage_before_flush value.

It now flushes the index in segments, as other mutations and merges do.

Fixes #132706.

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):

Fix high memory usage of MATERIALIZE INDEX for text indexes on packed or compact parts.


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

Version info

  • Merged into: 26.12.1.266-master (included in 26.12 and later)
  • Backported to: 26.11.1.2931, 26.10.13.5, 26.9.39.5

`MATERIALIZE INDEX` on a packed or `Compact` part built text indexes entirely
in memory, ignoring `text_index_max_memory_usage_before_flush`.

Build them in flushed segments, as mutations of other parts and merges already do.

Fixes #132706.
@ahmadov ahmadov added the comp-text-index Full-text search: inverted/text index in MergeTree (tokenizers, posting lists, GIN-style index bu... label Nov 19, 2026
@clickhouse-gh

clickhouse-gh Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [af6c4cb]

Summary: ✅


AI Review

Summary

PR #132964 makes text index materialization on packed and Compact parts flush temporary segments, preserves their checksums during finalization, and normalizes long stream names. Reviewed head af6c4cbf0b3d722eccc4e23b395f143d6a12bb51 and all prior discussion. The earlier filename and flush-coverage findings are addressed; no remaining blocker or major findings.

Stream-name consumers checked: MergeTextIndexesTask and query readers resolve original or hashed names; index discovery, size accounting, and mark loading resolve names through checksums; mutation carry/drop paths enumerate and resolve each substream. The stream manifest registers the normalized output names.

The head Fast test report records both 05829_text_index_materialize_packed_part_flush and 04630_text_index_serialization_version_compatibility passing. Validation used existing CI results; no local build or test run was performed.

Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-bugfix Pull request with bugfix, not backported by default label Nov 19, 2026
Comment thread src/Storages/MergeTree/MutateTask.cpp Resolved
@clickhouse-gh

clickhouse-gh Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing af6c4cbf0 with master 0b5613b71 (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

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

Job report

@CurtizJ CurtizJ self-assigned this Nov 20, 2026
@CurtizJ
CurtizJ added this pull request to the merge queue Nov 23, 2026
Merged via the queue into master with commit bc014a1 Nov 23, 2026
196 checks passed
@CurtizJ
CurtizJ deleted the ahmadov/fts-packed-memory branch November 23, 2026 14:22
@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
@CurtizJ

CurtizJ commented Nov 23, 2026

Copy link
Copy Markdown
Member

Let's backport it.

CurtizJ added a commit that referenced this pull request Nov 24, 2026
Resolve conflicts of the cherry-pick of #132964

Co-Authored-By: Claude Opus 5.5 <[email protected]>
CurtizJ added a commit that referenced this pull request Nov 24, 2026
Resolve conflicts of the cherry-pick of #132964

Co-Authored-By: Claude Opus 5.5 <[email protected]>
robot-clickhouse-ci-1 added a commit that referenced this pull request Nov 24, 2026
Cherry pick #132964 to 26.8: Fix high memory usage of text index materialization on packed or compact parts
robot-clickhouse added a commit that referenced this pull request Nov 24, 2026
robot-clickhouse-ci-1 added a commit that referenced this pull request Nov 24, 2026
Cherry pick #132964 to 26.9: Fix high memory usage of text index materialization on packed or compact parts
robot-clickhouse added a commit that referenced this pull request Nov 24, 2026
robot-clickhouse-ci-1 added a commit that referenced this pull request Nov 24, 2026
Cherry pick #132964 to 26.10: Fix high memory usage of text index materialization on packed or compact parts
robot-clickhouse added a commit that referenced this pull request Nov 24, 2026
@robot-ch-test-poll2 robot-ch-test-poll2 added the pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore label Nov 24, 2026
ahmadov added a commit that referenced this pull request Nov 24, 2026
ahmadov added a commit that referenced this pull request Nov 24, 2026
ahmadov added a commit that referenced this pull request Nov 24, 2026
clickhouse-gh Bot added a commit that referenced this pull request Nov 24, 2026
Backport #132964 to 26.10: Fix high memory usage of text index materialization on packed or compact parts
clickhouse-gh Bot added a commit that referenced this pull request Nov 24, 2026
Backport #132964 to 26.9: Fix high memory usage of text index materialization on packed or compact parts
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-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore pr-bugfix Pull request with bugfix, not backported by default pr-must-backport Pull request should be backported intentionally. Use this label with great care! pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR 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.

MATERIALIZE INDEX on packed or compact parts builds text indexes fully in memory and ignores text_index_max_memory_usage_before_flush

4 participants