slfan1989 opened a new issue, #4147:
URL: https://github.com/apache/amoro/issues/4147

   ### Search before asking
   
   - [x] I have searched in the 
[issues](https://github.com/apache/amoro/issues?q=is%3Aissue) and found no 
similar issues.
   
   
   ### What would you like to be improved?
   
   ### Description
   
   **Problem:**
   `CloseableIterator<Record>` instances are not properly closed in the 
position delete processing logic of `CombinedDeleteFilter` and 
`MixedDeleteFilter`, causing potential resource leaks.
   
   **Affected Code:**
   - `CombinedDeleteFilter.java:397-410` - `positionMap` initialization
   - `MixedDeleteFilter.java:369-386` - `positionMap` initialization
   
   ### Current Behavior
   
   The iterator is created but never explicitly closed:
   ```
   CloseableIterator<Record> iterator = 
CloseableIterable.concat(deletes).iterator();
   while (iterator.hasNext()) {
     // process records
   }
   // iterator is never closed
   ```
   
   ### Expected Behavior
   
   The iterator should be managed with try-with-resources to ensure proper 
cleanup:
   ```
   try (CloseableIterator<Record> iterator = 
CloseableIterable.concat(deletes).iterator()) {
     while (iterator.hasNext()) {
       // process records
     }
   } catch (IOException e) {
     throw new RuntimeException("Failed to close position delete iterator", e);
   }
   ```
   
   ### Impact
   - Memory leaks in long-running processes
   - File descriptor exhaustion under heavy workloads
   - Potential data corruption if underlying resources are not properly released
   
   ### Environment
   - Component: amoro-format-iceberg
   - Classes: CombinedDeleteFilter, MixedDeleteFilter
   
   
   ### How should we improve?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Subtasks
   
   _No response_
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to