kbendick commented on a change in pull request #3977:
URL: https://github.com/apache/iceberg/pull/3977#discussion_r796159827
##########
File path: core/src/main/java/org/apache/iceberg/io/PartitionedFanoutWriter.java
##########
@@ -60,11 +93,18 @@ public void write(T row) throws IOException {
@Override
public void close() throws IOException {
- if (!writers.isEmpty()) {
- for (PartitionKey key : writers.keySet()) {
- writers.get(key).close();
+ ConcurrentMap<PartitionKey, RollingFileWriter> writersMap =
writers.asMap();
+ if (writersMap.size() > 0) {
+ // close all remaining rolling file writers
+ try {
+ Tasks.foreach(writersMap.values())
+ .throwFailureWhenFinished()
+ .noRetry()
+ .run(RollingFileWriter::close, IOException.class);
+ } catch (IOException e) {
+ throw new UncheckedIOException("Failed to close rolling file writer",
e);
}
- writers.clear();
}
+ writers.invalidateAll();
Review comment:
Yes I believe it would. The `Tasks.forEach` would call close on the
values, but I don't think that Caffeine would know they were closed.
And the removalListener is going to be called for sure on `invalidateAll`.
https://github.com/ben-manes/caffeine/wiki/Removal
--
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]