rdblue commented on a change in pull request #3977:
URL: https://github.com/apache/iceberg/pull/3977#discussion_r794849236



##########
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:
       Won't this close all of the writers a second time because of the removal 
listener?




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