You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@paimon.apache.org by lz...@apache.org on 2023/11/09 08:11:35 UTC

(incubator-paimon) branch master updated: [bug] close write anyway to avoid connection leak (#2285)

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/incubator-paimon.git


The following commit(s) were added to refs/heads/master by this push:
     new 534a71cf8 [bug] close write anyway to avoid connection leak (#2285)
534a71cf8 is described below

commit 534a71cf82f52264033f56dc557fd5ea5b0d9715
Author: YeJunHao <41...@users.noreply.github.com>
AuthorDate: Thu Nov 9 16:11:32 2023 +0800

    [bug] close write anyway to avoid connection leak (#2285)
---
 .../paimon/operation/AppendOnlyFileStoreWrite.java  | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

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 eb4353f8c..556520de8 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
@@ -159,15 +159,18 @@ public class AppendOnlyFileStoreWrite extends MemoryFileStoreWrite<InternalRow>
                             new LongCounter(toCompact.get(0).minSequenceNumber()),
                             fileCompression,
                             statsCollectors);
-            rewriter.write(
-                    new RecordReaderIterator<>(
-                            read.createReader(
-                                    DataSplit.builder()
-                                            .withPartition(partition)
-                                            .withBucket(bucket)
-                                            .withDataFiles(toCompact)
-                                            .build())));
-            rewriter.close();
+            try {
+                rewriter.write(
+                        new RecordReaderIterator<>(
+                                read.createReader(
+                                        DataSplit.builder()
+                                                .withPartition(partition)
+                                                .withBucket(bucket)
+                                                .withDataFiles(toCompact)
+                                                .build())));
+            } finally {
+                rewriter.close();
+            }
             return rewriter.result();
         };
     }