rohangarg opened a new pull request, #14986:
URL: https://github.com/apache/druid/pull/14986

   Currently, `CloseableIterator#flatMap` closes an inner iterator while 
returning the last element present in it through `next` method. This forces an 
unnecessary contract on the last returned object to be fully materialized, 
since the inner iterator's `close` might return back the resources needed for 
materialization. If not handled carefully, it can lead to corruption of 
resources where a lazily materialized object from the inner iterator uses 
resources which have been returned to the resource manager through `close` 
inovcation.
   The change ensures that an inner iterator is closed only on the `hasNext` 
call subsequent to the last `next` call.
   
   This PR has:
   
   - [x] been self-reviewed.
      - [ ] using the [concurrency 
checklist](https://github.com/apache/druid/blob/master/dev/code-review/concurrency.md)
 (Remove this item if the PR doesn't have any relation to concurrency.)
   - [ ] added documentation for new or modified features or behaviors.
   - [ ] a release note entry in the PR description.
   - [ ] added Javadocs for most classes and all non-trivial methods. Linked 
related entities via Javadoc links.
   - [ ] added or updated version, license, or notice information in 
[licenses.yaml](https://github.com/apache/druid/blob/master/dev/license.md)
   - [x] added comments explaining the "why" and the intent of the code 
wherever would not be obvious for an unfamiliar reader.
   - [x] added unit tests or modified existing tests to cover new code paths, 
ensuring the threshold for [code 
coverage](https://github.com/apache/druid/blob/master/dev/code-review/code-coverage.md)
 is met.
   - [ ] added integration tests.
   - [ ] been tested in a test Druid cluster.
   


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to