From 68ed9994222b4a24d959e3403a7aaaff8f94ca5c Mon Sep 17 00:00:00 2001 From: Jingsong Date: Mon, 5 Aug 2024 15:30:37 +0800 Subject: [PATCH] [core] Increase write-max-writers-to-spill and logging --- docs/layouts/shortcodes/generated/core_configuration.html | 2 +- .../src/main/java/org/apache/paimon/CoreOptions.java | 2 +- .../apache/paimon/operation/AppendOnlyFileStoreWrite.java | 8 ++++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/docs/layouts/shortcodes/generated/core_configuration.html b/docs/layouts/shortcodes/generated/core_configuration.html index 446931acacda..bc6f8b5c4efc 100644 --- a/docs/layouts/shortcodes/generated/core_configuration.html +++ b/docs/layouts/shortcodes/generated/core_configuration.html @@ -854,7 +854,7 @@
write-max-writers-to-spill
- 5 + 10 Integer When in batch append inserting, if the writer number is greater than this option, we open the buffer cache and spill function to avoid out-of-memory. diff --git a/paimon-common/src/main/java/org/apache/paimon/CoreOptions.java b/paimon-common/src/main/java/org/apache/paimon/CoreOptions.java index 17bff3653229..156915e2365d 100644 --- a/paimon-common/src/main/java/org/apache/paimon/CoreOptions.java +++ b/paimon-common/src/main/java/org/apache/paimon/CoreOptions.java @@ -410,7 +410,7 @@ public class CoreOptions implements Serializable { public static final ConfigOption WRITE_MAX_WRITERS_TO_SPILL = key("write-max-writers-to-spill") .intType() - .defaultValue(5) + .defaultValue(10) .withDescription( "When in batch append inserting, if the writer number is greater than this option, we open the buffer cache and spill function to avoid out-of-memory. "); 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 12757df9b272..94744887bbc7 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 @@ -47,6 +47,9 @@ import org.apache.paimon.utils.SnapshotManager; import org.apache.paimon.utils.StatsCollectorFactories; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import javax.annotation.Nullable; import java.io.IOException; @@ -58,6 +61,8 @@ /** {@link FileStoreWrite} for {@link AppendOnlyFileStore}. */ public class AppendOnlyFileStoreWrite extends MemoryFileStoreWrite { + private static final Logger LOG = LoggerFactory.getLogger(AppendOnlyFileStoreWrite.class); + private final FileIO fileIO; private final RawFileSplitRead read; private final long schemaId; @@ -228,6 +233,9 @@ protected void forceBufferSpill() throws Exception { return; } forceBufferSpill = true; + LOG.info( + "Force buffer spill for append-only file store write, writer number is: {}", + writers.size()); for (Map> bucketWriters : writers.values()) { for (WriterContainer writerContainer : bucketWriters.values()) { ((AppendOnlyWriter) writerContainer.writer).toBufferedWriter();