From 672fc4dac61852e29e9a1b1fbcd5752785995995 Mon Sep 17 00:00:00 2001 From: yuzelin Date: Tue, 19 Nov 2024 10:37:15 +0800 Subject: [PATCH] [core] RollingFileWriter#abort shouldn't abort currentWriter twice --- .../org/apache/paimon/io/RollingFileWriter.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/paimon-core/src/main/java/org/apache/paimon/io/RollingFileWriter.java b/paimon-core/src/main/java/org/apache/paimon/io/RollingFileWriter.java index 109b7574304e..a3057fa483fd 100644 --- a/paimon-core/src/main/java/org/apache/paimon/io/RollingFileWriter.java +++ b/paimon-core/src/main/java/org/apache/paimon/io/RollingFileWriter.java @@ -78,7 +78,12 @@ public void write(T row) throws IOException { openCurrentWriter(); } - currentWriter.write(row); + try { + currentWriter.write(row); + } catch (Throwable e) { + currentWriter = null; + throw e; + } recordCount += 1; if (rollingFile()) { @@ -102,7 +107,12 @@ public void writeBundle(BundleRecords bundle) throws IOException { openCurrentWriter(); } - currentWriter.writeBundle(bundle); + try { + currentWriter.writeBundle(bundle); + } catch (Throwable e) { + currentWriter = null; + throw e; + } recordCount += bundle.rowCount(); if (rollingFile()) {