danny0405 commented on code in PR #19503:
URL: https://github.com/apache/hudi/pull/19503#discussion_r3717608370


##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/table/lookup/HoodieLookupFunction.java:
##########
@@ -155,15 +155,18 @@ private void checkCacheReload() throws IOException {
       try {
         long count = 0;
         GenericRowData reuse = new GenericRowData(rowType.getFieldCount());
-        partitionReader.open();
-        RowData row;
-        while ((row = partitionReader.read(reuse)) != null) {
-          count++;
-          RowData rowData = serializer.copy(row);
-          RowData key = extractLookupKey(rowData);
-          cache.addRow(key, rowData);
+        try {
+          partitionReader.open();
+          RowData row;
+          while ((row = partitionReader.read(reuse)) != null) {
+            count++;
+            RowData rowData = serializer.copy(row);
+            RowData key = extractLookupKey(rowData);
+            cache.addRow(key, rowData);
+          }

Review Comment:
   Addressed in 536fed58bcd7. `HoodieLookupTableReader` now implements 
`Closeable`, and each reload attempt uses try-with-resources. If reading fails 
and cleanup also fails, the read failure remains primary and the cleanup 
failure is attached as suppressed instead of masking it.



##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/table/lookup/HoodieLookupTableReader.java:
##########
@@ -78,11 +88,32 @@ public RowData read(RowData reuse) throws IOException {
   }
 
   public void close() throws IOException {
-    if (this.inputFormat != null) {
-      inputFormat.close();
+    InputFormat format = this.inputFormat;
+    this.inputFormat = null;
+    this.inputSplits = null;
+    if (format == null) {
+      return;
+    }
+
+    IOException exception = null;
+    try {
+      format.close();
+    } catch (IOException e) {

Review Comment:
   Addressed in 536fed58bcd7. `open()` now uses Hudi’s `closeSuppressing` 
helper during rollback, and `close()` uses try-with-resources to guarantee 
`closeInputFormat()` runs after both checked and runtime split-close failures 
while preserving suppression order. Added regression tests with 
`HoodieIOException` for runtime rollback and runtime split-close failures. The 
7 focused lookup tests pass.



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

Reply via email to