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 2024/08/05 08:35:17 UTC
(paimon) branch master updated: [core] Increase write-max-writers-to-spill and logging (#3897)
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 fdaff8c85 [core] Increase write-max-writers-to-spill and logging (#3897)
fdaff8c85 is described below
commit fdaff8c85c2119a8c37bd784600f75c8ca96349a
Author: Jingsong Lee <ji...@gmail.com>
AuthorDate: Mon Aug 5 16:35:12 2024 +0800
[core] Increase write-max-writers-to-spill and logging (#3897)
---
docs/layouts/shortcodes/generated/core_configuration.html | 2 +-
paimon-common/src/main/java/org/apache/paimon/CoreOptions.java | 2 +-
.../org/apache/paimon/operation/AppendOnlyFileStoreWrite.java | 8 ++++++++
.../org/apache/paimon/operation/AppendOnlyFileStoreWriteTest.java | 4 ++++
4 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/docs/layouts/shortcodes/generated/core_configuration.html b/docs/layouts/shortcodes/generated/core_configuration.html
index 446931aca..bc6f8b5c4 100644
--- a/docs/layouts/shortcodes/generated/core_configuration.html
+++ b/docs/layouts/shortcodes/generated/core_configuration.html
@@ -854,7 +854,7 @@ If the data size allocated for the sorting task is uneven,which may lead to perf
</tr>
<tr>
<td><h5>write-max-writers-to-spill</h5></td>
- <td style="word-wrap: break-word;">5</td>
+ <td style="word-wrap: break-word;">10</td>
<td>Integer</td>
<td>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. </td>
</tr>
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 17bff3653..156915e23 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<Integer> 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 12757df9b..94744887b 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.RecordWriter;
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 @@ import java.util.concurrent.ExecutorService;
/** {@link FileStoreWrite} for {@link AppendOnlyFileStore}. */
public class AppendOnlyFileStoreWrite extends MemoryFileStoreWrite<InternalRow> {
+ 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 @@ public class AppendOnlyFileStoreWrite extends MemoryFileStoreWrite<InternalRow>
return;
}
forceBufferSpill = true;
+ LOG.info(
+ "Force buffer spill for append-only file store write, writer number is: {}",
+ writers.size());
for (Map<Integer, WriterContainer<InternalRow>> bucketWriters : writers.values()) {
for (WriterContainer<InternalRow> writerContainer : bucketWriters.values()) {
((AppendOnlyWriter) writerContainer.writer).toBufferedWriter();
diff --git a/paimon-core/src/test/java/org/apache/paimon/operation/AppendOnlyFileStoreWriteTest.java b/paimon-core/src/test/java/org/apache/paimon/operation/AppendOnlyFileStoreWriteTest.java
index 4d95a91a9..6384729b8 100644
--- a/paimon-core/src/test/java/org/apache/paimon/operation/AppendOnlyFileStoreWriteTest.java
+++ b/paimon-core/src/test/java/org/apache/paimon/operation/AppendOnlyFileStoreWriteTest.java
@@ -44,10 +44,13 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
import java.util.Arrays;
+import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Random;
+import static org.apache.paimon.CoreOptions.WRITE_MAX_WRITERS_TO_SPILL;
+
/** Tests for {@link AppendOnlyFileStoreWrite}. */
public class AppendOnlyFileStoreWriteTest {
@@ -58,6 +61,7 @@ public class AppendOnlyFileStoreWriteTest {
@Test
public void testWritesInBatch() throws Exception {
FileStoreTable table = createFileStoreTable();
+ table = table.copy(Collections.singletonMap(WRITE_MAX_WRITERS_TO_SPILL.key(), "5"));
AppendOnlyFileStoreWrite write = (AppendOnlyFileStoreWrite) table.store().newWrite("ss");
write.withIOManager(IOManager.create(tempDir.toString()));