Repository navigation
Backport #126549 to 26.9: Limit the total size of text bloom filter indexes and track their memory - #131059
Merged
Conversation
Contributor
|
Workflow [BackportPR], commit [b3dfa87] Summary: ✅ |
Member
|
Destroyed |
The text bloom filter skip indexes (`tokenbf_v1`, `ngrambf_v1`, `sparse_grams`) checked only the size of a single filter (at most `MAX_BLOOM_FILTER_SIZE`, 1 GiB), but every granule of the index eagerly allocates one filter per indexed column. Also, the filter was stored in a `std::vector` with the default allocator, and implicit `operator new` allocations are not refused by the memory tracker by default, so a one-row `INSERT` into a table with large filters could allocate past the available RAM and get the server killed by the OOM killer. - `BloomFilter::Container` now uses `AllocatorWithMemoryTracking`, so the allocation of a filter respects the memory limits and fails with `MEMORY_LIMIT_EXCEEDED`. This covers all users of `BloomFilter`, including the `bloom_filter` index and runtime filters. - `bloomFilterIndexTextValidator` rejects indexes where the filter size multiplied by the number of indexed columns exceeds `MAX_BLOOM_FILTER_SIZE`. The check is skipped on `ATTACH`, so existing tables still load. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Address review: an index inherited from the old metadata (for example, of a table attached after being created by an older version) is revalidated with `attach = false` on every `ALTER` by `MergeTreeData::checkProperties`, so the check in `bloomFilterIndexTextValidator` made unrelated alters of such tables fail. Move the check to `bloomFilterIndexTextCheckTotalSize`, called from `checkProperties`, which accepts an inherited index as long as its total size does not grow. Also use `VectorWithMemoryTracking` for `BloomFilter::Container`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
rschu1ze
force-pushed
the
backport/26.9/126549
branch
from
November 13, 2026 15:54
83c6873 to
b3dfa87
Compare
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.
Original pull-request #126549
Cherry-pick pull-request #130568
This pull-request is a last step of an automated backporting.
Treat it as a standard pull-request: look at the checks and resolve conflicts.
Merge it only if you intend to backport changes to the target branch, otherwise just close it.
The PR source
The PR is created in the CI job
Version info
26.9.28.163