Close cached PinotDataBuffer in FilePerIndexDirectory.removeIndex() to stop mmap/heap buffer leaks#18320
Open
rsrkpatwari1234 wants to merge 3 commits intoapache:masterfrom
Open
Close cached PinotDataBuffer in FilePerIndexDirectory.removeIndex() to stop mmap/heap buffer leaks#18320rsrkpatwari1234 wants to merge 3 commits intoapache:masterfrom
rsrkpatwari1234 wants to merge 3 commits intoapache:masterfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #18320 +/- ##
============================================
- Coverage 63.61% 63.43% -0.18%
- Complexity 1659 1683 +24
============================================
Files 3246 3253 +7
Lines 197514 198809 +1295
Branches 30578 30787 +209
============================================
+ Hits 125656 126124 +468
- Misses 61813 62619 +806
- Partials 10045 10066 +21
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:
|
xiangfu0
reviewed
Apr 28, 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.
Problem
removeIndex()dropped entries from_indexBuffersbut did not close the associatedPinotDataBuffer. Those buffers are no longer reached byclose(), so mmap (and other) mappings could stay alive until GC/finalize behavior, which is incorrect and can leak file descriptors and native memory.Change
On removal, take the buffer out of the map, call
close()on it, then run the existing cleanup (text index, vector index, or per-file delete). I/O errors while closing are surfaced as error logs.Tests
testRemoveIndexso it relies onremoveIndex()to release the forward buffer.testRemoveIndexClosesReadBufferto cover the getBuffer (read) path with the class-levelPinotBuffersAfterMethodCheckRuleleak check.Scope note
Text- and vector-specific cleanup still runs after the buffer is released, so we do not keep stale mapped buffers over directory deletes.
Fixes #18218