You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ta...@apache.org on 2023/07/10 15:36:36 UTC

[iotdb] branch rel/1.1 updated: [To rel/1.2][IOTDB-6030] Improve efficiency of ConfigNode PartitionInfo takeSnapshot (#10336) (#10494)

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

tanxinyu pushed a commit to branch rel/1.1
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/rel/1.1 by this push:
     new 73e8cd17422 [To rel/1.2][IOTDB-6030] Improve efficiency of ConfigNode PartitionInfo takeSnapshot (#10336) (#10494)
73e8cd17422 is described below

commit 73e8cd17422a06b0d096dc3ab740fe3bff203ebf
Author: Potato <ta...@apache.org>
AuthorDate: Mon Jul 10 23:36:29 2023 +0800

    [To rel/1.2][IOTDB-6030] Improve efficiency of ConfigNode PartitionInfo takeSnapshot (#10336) (#10494)
    
    
    Signed-off-by: OneSizeFitQuorum <ta...@apache.org>
    Co-authored-by: YongzaoDan <33...@users.noreply.github.com>
---
 .../iotdb/confignode/persistence/partition/PartitionInfo.java  | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/confignode/src/main/java/org/apache/iotdb/confignode/persistence/partition/PartitionInfo.java b/confignode/src/main/java/org/apache/iotdb/confignode/persistence/partition/PartitionInfo.java
index 468d50b0070..0ed372920b3 100644
--- a/confignode/src/main/java/org/apache/iotdb/confignode/persistence/partition/PartitionInfo.java
+++ b/confignode/src/main/java/org/apache/iotdb/confignode/persistence/partition/PartitionInfo.java
@@ -69,10 +69,11 @@ import org.apache.thrift.transport.TIOStreamTransport;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.io.BufferedOutputStream;
 import java.io.File;
 import java.io.FileInputStream;
-import java.io.FileOutputStream;
 import java.io.IOException;
+import java.nio.file.Files;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashSet;
@@ -96,6 +97,9 @@ public class PartitionInfo implements SnapshotProcessor {
 
   private static final Logger LOGGER = LoggerFactory.getLogger(PartitionInfo.class);
 
+  // Allocate 8MB buffer for load snapshot of PartitionInfo
+  private static final int PARTITION_TABLE_BUFFER_SIZE = 32 * 1024 * 1024;
+
   /** For Cluster Partition */
   // For allocating Regions
   private final AtomicInteger nextRegionGroupId;
@@ -728,7 +732,9 @@ public class PartitionInfo implements SnapshotProcessor {
     // snapshot operation.
     File tmpFile = new File(snapshotFile.getAbsolutePath() + "-" + UUID.randomUUID());
 
-    try (FileOutputStream fileOutputStream = new FileOutputStream(tmpFile);
+    try (BufferedOutputStream fileOutputStream =
+            new BufferedOutputStream(
+                Files.newOutputStream(tmpFile.toPath()), PARTITION_TABLE_BUFFER_SIZE);
         TIOStreamTransport tioStreamTransport = new TIOStreamTransport(fileOutputStream)) {
       TProtocol protocol = new TBinaryProtocol(tioStreamTransport);