This is an automated email from the ASF dual-hosted git repository.

lzljs3620320 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/paimon.git


The following commit(s) were added to refs/heads/master by this push:
     new 197c034e8 [core] fix the issue where exceptions in 
RowDataRollingFileWriter#write might be swallowed. (#3939)
197c034e8 is described below

commit 197c034e843e43e208fb8f140549583c6af43db7
Author: liming.1018 <[email protected]>
AuthorDate: Mon Aug 12 16:46:46 2024 +0800

    [core] fix the issue where exceptions in RowDataRollingFileWriter#write 
might be swallowed. (#3939)
---
 .../apache/paimon/operation/AppendOnlyFileStoreWrite.java  | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git 
a/paimon-core/src/main/java/org/apache/paimon/operation/AppendOnlyFileStoreWrite.java
 
b/paimon-core/src/main/java/org/apache/paimon/operation/AppendOnlyFileStoreWrite.java
index 744a130ca..d85087c43 100644
--- 
a/paimon-core/src/main/java/org/apache/paimon/operation/AppendOnlyFileStoreWrite.java
+++ 
b/paimon-core/src/main/java/org/apache/paimon/operation/AppendOnlyFileStoreWrite.java
@@ -41,6 +41,7 @@ import org.apache.paimon.table.BucketMode;
 import org.apache.paimon.table.source.DataSplit;
 import org.apache.paimon.types.RowType;
 import org.apache.paimon.utils.CommitIncrement;
+import org.apache.paimon.utils.ExceptionUtils;
 import org.apache.paimon.utils.FileStorePathFactory;
 import org.apache.paimon.utils.LongCounter;
 import org.apache.paimon.utils.RecordWriter;
@@ -173,6 +174,7 @@ public class AppendOnlyFileStoreWrite extends 
MemoryFileStoreWrite<InternalRow>
             if (toCompact.isEmpty()) {
                 return Collections.emptyList();
             }
+            Exception collectedExceptions = null;
             RowDataRollingFileWriter rewriter =
                     new RowDataRollingFileWriter(
                             fileIO,
@@ -189,8 +191,18 @@ public class AppendOnlyFileStoreWrite extends 
MemoryFileStoreWrite<InternalRow>
                             options.asyncFileWrite());
             try {
                 rewriter.write(bucketReader(partition, 
bucket).read(toCompact));
+            } catch (Exception e) {
+                collectedExceptions = e;
             } finally {
-                rewriter.close();
+                try {
+                    rewriter.close();
+                } catch (Exception e) {
+                    collectedExceptions = ExceptionUtils.firstOrSuppressed(e, 
collectedExceptions);
+                }
+            }
+
+            if (collectedExceptions != null) {
+                throw collectedExceptions;
             }
             return rewriter.result();
         };

Reply via email to