kumarpritam863 commented on code in PR #18894:
URL: https://github.com/apache/iceberg/pull/18894#discussion_r4697589226


##########
flink/v2.3/flink/src/main/java/org/apache/iceberg/flink/sink/dynamic/DynamicCommitter.java:
##########
@@ -451,6 +452,8 @@ void commitOperation(
 
   @Override
   public void close() throws IOException {
-    workerPool.shutdown();
+    try (Closeable ignored = DynamicSinkUtil.closeable(catalog)) {
+      workerPool.shutdown();
+    }

Review Comment:
   Same here. workerPool.shutdown() runs in the body and the catalog is closed 
afterwards, so a failing catalog.close() can't leave the pool running. I added 
shutsDownWorkerPoolWhenClosingCatalogFails, which makes close() throw and 
asserts the pool is shut down.



##########
flink/v2.3/flink/src/main/java/org/apache/iceberg/flink/sink/dynamic/DynamicSinkUtil.java:
##########
@@ -86,6 +88,11 @@ static Set<Integer> distributionFieldIds(Set<String> 
distributionFields, Schema
     return distributionFieldIds;
   }
 
+  @Nullable
+  static Closeable closeable(@Nullable Catalog catalog) {

Review Comment:
   Agreed, done. It's now closeable(@Nullable Object obj), and I dropped the 
unused Catalog import.



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