mxm commented on code in PR #18894:
URL: https://github.com/apache/iceberg/pull/18894#discussion_r4631477106
##########
flink/v2.3/flink/src/main/java/org/apache/iceberg/flink/sink/dynamic/DynamicWriter.java:
##########
@@ -156,8 +157,10 @@ public void flush(boolean endOfInput) {
@Override
public void close() throws Exception {
- for (TaskWriter<RowData> writer : writers.values()) {
- writer.close();
+ try (Closeable ignored = DynamicSinkUtil.closeable(catalog)) {
+ for (TaskWriter<RowData> writer : writers.values()) {
+ writer.close();
+ }
Review Comment:
This will mean that we won't close the writers if we fail closing the
catalog.
##########
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 will not be closed if we fail closing the catalog.
##########
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:
```suggestion
static Closeable closeable(@Nullable Object obj) {
```
I think that makes more sense, unless we name the method "closeableCatalog".
--
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]