[BugFix] Bound and expose the Iceberg partition cache memory (backport #76165)#76181
Merged
Merged
Conversation
Contributor
Author
|
Cherry-pick of 893d888 has failed: To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally |
Contributor
Author
|
@mergify[bot]: Backport conflict, please reslove the conflict and resubmit the pr |
Signed-off-by: Youngwb <yangwenbo_mailbox@163.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com> (cherry picked from commit 893d888) # Conflicts: # fe/fe-core/src/main/java/com/starrocks/connector/iceberg/CachingIcebergCatalog.java
b9e34a8 to
2b8666c
Compare
Youngwb
approved these changes
Jul 10, 2026
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.
Why I'm doing:
CachingIcebergCatalog's partition cache stores one whole-table partition map (Map<String, Partition>) per entry, but was bounded only by entry count (maximumSize), not bytes. A handful of tables with many partitions (a table can have millions) can therefore grow it without limit. It is also the only metadata cache left out ofestimateSize(), so its footprint is invisible in/api/memory_usageand the minute-level memory logs.This is a real growth path, not a corner case: materialized views over Iceberg tables track base-table partitions, so MV rewrite/refresh populates the partition cache across many base tables.
Alongside it, the auxiliary maps
tableLatestAccessTime/tableLatestRefreshTime/tableRefreshLockMapwere likewise absent fromestimateSize().What I'm doing:
maximumWeightbound to the partition cache, sized by a new catalog propertyiceberg_partition_cache_memory_usage_ratio(default0.1), mirroring the data/delete/table file caches. The weigher samples the partition values (sample size 3) so weighing stays cheap on large maps.estimateSize(), so their bytes are reported. This benefits from the recently merged Estimator container-overhead fix ([BugFix] Count container node/table overhead in memory Estimator #75971), which makes the estimate accurate.Fixes #issue: N/A — FE memory-safety/observability fix for the Iceberg partition cache (no separate tracking issue).
What type of PR is this:
Does this PR entail a change in behavior?
If yes, please specify the type of change:
New catalog property
iceberg_partition_cache_memory_usage_ratio(default 0.1). The partition cache is now bounded by memory weight instead of a fixed 100k entry count, so under memory pressure it may hold fewer entries than before; the ratio is tunable and can be raised to restore the previous footprint.Checklist:
Bugfix cherry-pick branch check:
This is an automatic backport of pull request #76165 done by [Mergify](https://mergify.com).