Skip to content

Fix FileHandle Leak in BaseDataReader for MetadataFiles#1374

Merged
aokolnychyi merged 3 commits intoapache:masterfrom
RussellSpitzer:FixManifestReaderFileLeak
Aug 25, 2020
Merged

Fix FileHandle Leak in BaseDataReader for MetadataFiles#1374
aokolnychyi merged 3 commits intoapache:masterfrom
RussellSpitzer:FixManifestReaderFileLeak

Conversation

@RussellSpitzer
Copy link
Member

The core issue here was that previously when using CloseableIterable.filter
The iterator generated by the wrapped Iterable would be wrapped by a Guava
Iterator regardless of the wrapped iterators closable status. This means
Calling Filter on an iterable would result in a CloseableIterable which
generated incorrectly unclosable Iterators.

To fix this we replace the Guava IterablesFilter operation with the
FilterIterator class. This properly wraps the underlying closable iterator
so that when we generate iterators we still get classes that can close
their wrapped implementations.

The core issue here was that previously when using CloseableIterable.filter
The iterator generated by the wrapped Iterable would be wrapped by a Guava
Iterator regardless of the wrapped iterators closable status. This means
Calling Filter on an iterable would result in a CloseableIterable which
generated incorrectly unclosable Iterators.

To fix this we replace the Guava IterablesFilter operation with the
FilterIterator class. This properly wraps the underlying closable iterator
so that when we generate iterators we still get classes that can close
their wrapped implementations.
@RussellSpitzer
Copy link
Member Author

cc @aokolnychyi + @rdblue

@aokolnychyi
Copy link
Contributor

Looks good to me except formatting nits.

@RussellSpitzer
Copy link
Member Author

All cleaned up style wise

@aokolnychyi
Copy link
Contributor

I'd put FilterIterator into the io package instead of util. I think it makes more sense there. Other than that, LGTM.

@aokolnychyi
Copy link
Contributor

I've tested locally and it solves the problem in metadata tables. I am merging it.

@aokolnychyi aokolnychyi merged commit bbcc2fb into apache:master Aug 25, 2020
@RussellSpitzer RussellSpitzer deleted the FixManifestReaderFileLeak branch August 25, 2020 20:24
parthchandra pushed a commit to parthchandra/iceberg that referenced this pull request Oct 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants