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 2022/11/14 13:39:34 UTC

[iotdb] branch multi_leader_memory_pendingBatch_control updated: fix UT

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

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


The following commit(s) were added to refs/heads/multi_leader_memory_pendingBatch_control by this push:
     new 1efe55b4c6 fix UT
1efe55b4c6 is described below

commit 1efe55b4c6250add06875fb566b16d86c4248898
Author: OneSizeFitQuorum <ta...@apache.org>
AuthorDate: Mon Nov 14 21:39:22 2022 +0800

    fix UT
    
    Signed-off-by: OneSizeFitQuorum <ta...@apache.org>
---
 .../org/apache/iotdb/consensus/config/MultiLeaderConfig.java  | 11 ++++++++++-
 .../multileader/logdispatcher/MultiLeaderMemoryManager.java   |  2 +-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/consensus/src/main/java/org/apache/iotdb/consensus/config/MultiLeaderConfig.java b/consensus/src/main/java/org/apache/iotdb/consensus/config/MultiLeaderConfig.java
index 072dc00c37..eef11bfaae 100644
--- a/consensus/src/main/java/org/apache/iotdb/consensus/config/MultiLeaderConfig.java
+++ b/consensus/src/main/java/org/apache/iotdb/consensus/config/MultiLeaderConfig.java
@@ -66,6 +66,7 @@ public class MultiLeaderConfig {
   }
 
   public static class RPC {
+
     private final int rpcSelectorThreadNum;
     private final int rpcMinConcurrentClientNum;
     private final int rpcMaxConcurrentClientNum;
@@ -131,6 +132,7 @@ public class MultiLeaderConfig {
     }
 
     public static class Builder {
+
       private int rpcSelectorThreadNum = 1;
       private int rpcMinConcurrentClientNum = Runtime.getRuntime().availableProcessors();
       private int rpcMaxConcurrentClientNum = 65535;
@@ -196,6 +198,7 @@ public class MultiLeaderConfig {
   }
 
   public static class Replication {
+
     private final int maxRequestNumPerBatch;
     private final int maxSizePerBatch;
     private final int maxPendingBatch;
@@ -282,6 +285,7 @@ public class MultiLeaderConfig {
     }
 
     public static class Builder {
+
       private int maxRequestNumPerBatch = 30;
       private int maxSizePerBatch = 4 * 1024 * 1024;
       // (IMPORTANT) Value of this variable should be the same with MAX_REQUEST_CACHE_SIZE
@@ -293,7 +297,7 @@ public class MultiLeaderConfig {
       private long walThrottleThreshold = 50 * 1024 * 1024 * 1024L;
       private long throttleTimeOutMs = TimeUnit.SECONDS.toMillis(30);
       private long checkpointGap = 500;
-      private long allocateMemoryForConsensus;
+      private long allocateMemoryForConsensus = Runtime.getRuntime().maxMemory() / 10;
       private double maxMemoryRatioForQueue = 0.6;
 
       public Replication.Builder setMaxRequestNumPerBatch(int maxRequestNumPerBatch) {
@@ -347,6 +351,11 @@ public class MultiLeaderConfig {
         return this;
       }
 
+      public Builder setMaxMemoryRatioForQueue(double maxMemoryRatioForQueue) {
+        this.maxMemoryRatioForQueue = maxMemoryRatioForQueue;
+        return this;
+      }
+
       public Replication build() {
         return new Replication(
             maxRequestNumPerBatch,
diff --git a/consensus/src/main/java/org/apache/iotdb/consensus/multileader/logdispatcher/MultiLeaderMemoryManager.java b/consensus/src/main/java/org/apache/iotdb/consensus/multileader/logdispatcher/MultiLeaderMemoryManager.java
index 1d0e237bce..9da0e7ad4c 100644
--- a/consensus/src/main/java/org/apache/iotdb/consensus/multileader/logdispatcher/MultiLeaderMemoryManager.java
+++ b/consensus/src/main/java/org/apache/iotdb/consensus/multileader/logdispatcher/MultiLeaderMemoryManager.java
@@ -31,7 +31,7 @@ public class MultiLeaderMemoryManager {
   private static final Logger logger = LoggerFactory.getLogger(MultiLeaderMemoryManager.class);
   private final AtomicLong memorySizeInByte = new AtomicLong(0);
   private Long maxMemorySizeInByte = Runtime.getRuntime().maxMemory() / 10;
-  private Long maxMemorySizeForQueueInByte = Runtime.getRuntime().maxMemory() / 100 * 8;
+  private Long maxMemorySizeForQueueInByte = Runtime.getRuntime().maxMemory() / 100 * 6;
 
   private MultiLeaderMemoryManager() {
     MetricService.getInstance().addMetricSet(new MultiLeaderMemoryManagerMetrics(this));