fix(segment): close removed PinotDataBuffer in FilePerIndexDirectory#18405
Merged
Jackie-Jiang merged 3 commits intoapache:masterfrom May 7, 2026
Merged
Conversation
Contributor
Author
|
@xiangfu0 can you please review this pr. thanks |
xiangfu0
reviewed
May 4, 2026
xiangfu0
reviewed
May 4, 2026
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #18405 +/- ##
============================================
+ Coverage 63.46% 63.60% +0.14%
- Complexity 1701 1717 +16
============================================
Files 3254 3252 -2
Lines 199104 199141 +37
Branches 30830 30876 +46
============================================
+ Hits 126354 126668 +314
+ Misses 62665 62400 -265
+ Partials 10085 10073 -12
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Jackie-Jiang
reviewed
May 6, 2026
Co-authored-by: Xiang Fu <xiangfu.1024@gmail.com>
ad46be0 to
44afbfa
Compare
Contributor
Author
|
@Jackie-Jiang updated the pr. can you please review. thanks |
Jackie-Jiang
approved these changes
May 7, 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.
FilePerIndexDirectory.removeIndex()was dropping the buffer entryfrom the cache map without calling
close()on it. For mmap-backedbuffers (the default for offline segments), this means the kernel
mapping leaks for the lifetime of the JVM — the on-disk file does
get deleted, but the address-space mapping stays until the process
exits (or the
Cleanerhappens to fire, which we shouldn't rely onfor deterministic cleanup).
removeIndex()is hit during segment reloads, minion-driven segmentconversions, and the various
*IndexHandlerdrop/replace flows, so onlong-running servers that churn through reloads this shows up as the
classic.
The class itself had a
// TODOflagging this, so this PR justfinishes it.
Scope
Single file: pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/store/FilePerIndexDirectory.java
~10 lines changed
No public API change, no behavior change for callers and removeIndex still returns void. It still cleans up the on-disk files exactly the same way, just additionally closes the cached buffer.
Testing
Existing FilePerIndexDirectoryTest still passes.
Manually verified the flow: with the fix, the PinotDataBuffer.close() on the removed entry is invoked once; without the fix it never was.
Fixes #18404
Release note
none (memory leak fix, no user-visible behavior change)