Skip to content

[AMORO-4147] [Improvement]: Resource leak in CombinedDeleteFilter and MixedDeleteFilter position delete iterators.#4148

Merged
xxubai merged 2 commits intoapache:masterfrom
slfan1989:auron-4147
Mar 30, 2026
Merged

[AMORO-4147] [Improvement]: Resource leak in CombinedDeleteFilter and MixedDeleteFilter position delete iterators.#4148
xxubai merged 2 commits intoapache:masterfrom
slfan1989:auron-4147

Conversation

@slfan1989
Copy link
Copy Markdown
Contributor

@slfan1989 slfan1989 commented Mar 29, 2026

Why are the changes needed?

Fix resource leak issues in position delete processing. CloseableIterator<Record> instances are not properly closed in CombinedDeleteFilter and MixedDeleteFilter, which can lead to:

  • Memory leaks in long-running processes
  • File descriptor exhaustion under heavy workloads
  • Potential resource cleanup issues

Close #4147.

Brief change log

  • CombinedDeleteFilter.java: Wrap CloseableIterator<Record> in try-with-resources block in positionMap initialization (line 397-410)
  • MixedDeleteFilter.java: Wrap CloseableIterator<Record> in try-with-resources block in positionMap initialization (line 369-386)
  • Add proper exception handling for iterator close failures in both classes

How was this patch tested?

  • Add some test cases that check the changes thoroughly including negative and positive cases if possible
  • Add screenshots for manual tests if appropriate
  • Run test locally before making a pull request
  • Existing unit tests pass successfully

Documentation

  • Does this pull request introduce a new feature? (yes / no)
  • If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)

Copy link
Copy Markdown
Contributor

@xxubai xxubai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution ! @slfan1989 . LGTM

@xxubai xxubai merged commit 5313608 into apache:master Mar 30, 2026
6 checks passed
@slfan1989
Copy link
Copy Markdown
Contributor Author

@xxubai Thank you so much for reviewing the code!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Improvement]: Resource leak in CombinedDeleteFilter and MixedDeleteFilter position delete iterators

2 participants