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

qiaojialin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git


The following commit(s) were added to refs/heads/master by this push:
     new 6fe6501  Concurrently write time partition (#1174)
6fe6501 is described below

commit 6fe6501585223b633e5abf5060cf24618be23cc8
Author: SilverNarcissus <[email protected]>
AuthorDate: Fri May 15 09:37:14 2020 +0800

    Concurrently write time partition (#1174)
    
    * add time partition when recovery
---
 docs/UserGuide/3-Server/4-Config Manual.md         |   8 +-
 .../resources/conf/iotdb-engine.properties         |  10 +--
 .../java/org/apache/iotdb/db/conf/IoTDBConfig.java |  10 +--
 .../org/apache/iotdb/db/conf/IoTDBDescriptor.java  |   6 +-
 .../db/conf/adapter/IoTDBConfigDynamicAdapter.java | 100 ++++++++++-----------
 .../engine/storagegroup/StorageGroupProcessor.java |  45 ++++++----
 .../db/engine/storagegroup/TsFileProcessor.java    |   5 +-
 .../adapter/IoTDBConfigDynamicAdapterTest.java     |   3 +-
 8 files changed, 100 insertions(+), 87 deletions(-)

diff --git a/docs/UserGuide/3-Server/4-Config Manual.md 
b/docs/UserGuide/3-Server/4-Config Manual.md
index 8717d0f..5163315 100644
--- a/docs/UserGuide/3-Server/4-Config Manual.md        
+++ b/docs/UserGuide/3-Server/4-Config Manual.md        
@@ -273,13 +273,13 @@ The permission definitions are in 
${IOTDB\_CONF}/conf/jmx.access.
 |Effective|Should not be changed after first start up|
 
 
-* memtable\_num\_in\_each\_storage\_group
+* concurrent\_writing\_time\_partition
 
-|Name| memtable\_num\_in\_each\_storage\_group |
+|Name| concurrent\_writing\_time\_partition |
 |:---:|:---|
-|Description| This config decides how many time partitions in a storage group 
can be inserted concurrently </br> For example, your partitionInterval is 86400 
and you want to insert data in 3 different days, you should set this param >= 6 
(for sequence and unsequence) |
+|Description| This config decides how many time partitions in a storage group 
can be inserted concurrently </br> For example, your partitionInterval is 86400 
and you want to insert data in 5 different days, |
 |Type|Int32|
-|Default| 10 |
+|Default| 5 |
 |Effective|After restart system|
 
 * multi\_dir\_strategy
diff --git a/server/src/assembly/resources/conf/iotdb-engine.properties 
b/server/src/assembly/resources/conf/iotdb-engine.properties
index 4df48bb..9f5676a 100644
--- a/server/src/assembly/resources/conf/iotdb-engine.properties
+++ b/server/src/assembly/resources/conf/iotdb-engine.properties
@@ -207,12 +207,12 @@ concurrent_query_thread=0
 # (i.e., whether use ChunkBufferPool), value true, false
 chunk_buffer_pool_enable=false
 
-# the num of memtables in each storage group
+# the num of time partition which can be concurrently write in each storage 
group
 # This config decides how many time partitions in a storage group can be 
inserted concurrently
-# For example, your partitionInterval is 86400 and you want to insert data in 
3 different days,
-# you should set this param >= 6 (for sequence and unsequence)
-# default number is 10
-memtable_num_in_each_storage_group=10
+# For example, your partitionInterval is 86400 and you want to insert data in 
5 different days,
+# you should set this param >= 5
+# default number is 5
+concurrent_writing_time_partition=5
 
 # The amount of data iterate each time in server (the number of data strips, 
that is, the number of different timestamps.)
 batch_size=100000
diff --git a/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java 
b/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java
index 51bb3fc..e61d5e4 100644
--- a/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java
+++ b/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java
@@ -516,7 +516,7 @@ public class IoTDBConfig {
   /**
    * the num of memtable in each storage group
    */
-  private int memtableNumInEachStorageGroup = 10;
+  private int concurrentWritingTimePartition = 10;
 
   /**
    * the default fill interval in LinearFill and PreviousFill, -1 means 
infinite past time
@@ -547,12 +547,12 @@ public class IoTDBConfig {
     // empty constructor
   }
 
-  public int getMemtableNumInEachStorageGroup() {
-    return memtableNumInEachStorageGroup;
+  public int getConcurrentWritingTimePartition() {
+    return concurrentWritingTimePartition;
   }
 
-  void setMemtableNumInEachStorageGroup(int memtableNumInEachStorageGroup) {
-    this.memtableNumInEachStorageGroup = memtableNumInEachStorageGroup;
+  void setConcurrentWritingTimePartition(int concurrentWritingTimePartition) {
+    this.concurrentWritingTimePartition = concurrentWritingTimePartition;
   }
 
   public int getDefaultFillInterval() {
diff --git a/server/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java 
b/server/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java
index 4389fa8..1ca12d2 100644
--- a/server/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java
+++ b/server/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java
@@ -371,9 +371,9 @@ public class IoTDBDescriptor {
               .getProperty("partition_interval", 
String.valueOf(conf.getPartitionInterval()))));
 
       // the num of memtables in each storage group
-      conf.setMemtableNumInEachStorageGroup(
-          
Integer.parseInt(properties.getProperty("memtable_num_in_each_storage_group",
-              String.valueOf(conf.getMemtableNumInEachStorageGroup()))));
+      conf.setConcurrentWritingTimePartition(
+          
Integer.parseInt(properties.getProperty("concurrent_writing_time_partition",
+              String.valueOf(conf.getConcurrentWritingTimePartition()))));
 
       // the default fill interval in LinearFill and PreviousFill
       conf.setDefaultFillInterval(
diff --git 
a/server/src/main/java/org/apache/iotdb/db/conf/adapter/IoTDBConfigDynamicAdapter.java
 
b/server/src/main/java/org/apache/iotdb/db/conf/adapter/IoTDBConfigDynamicAdapter.java
index ac7d4be..5580e43 100644
--- 
a/server/src/main/java/org/apache/iotdb/db/conf/adapter/IoTDBConfigDynamicAdapter.java
+++ 
b/server/src/main/java/org/apache/iotdb/db/conf/adapter/IoTDBConfigDynamicAdapter.java
@@ -30,10 +30,10 @@ import org.slf4j.LoggerFactory;
  * This class is to dynamically adjust some important parameters of the 
system, determine the speed
  * of MenTable brushing disk, the speed of file sealing and so on, with the 
continuous change of
  * load in the process of system operation.
- *
+ * <p>
  * There are three dynamically adjustable parameters: maxMemTableNum, 
memtableSize and
  * tsFileSizeThreshold.
- *
+ * <p>
  * 1. maxMemTableNum. This parameter represents the size of the MemTable 
available in the MemTable
  * pool, which is closely related to the number of storage groups. When adding 
or deleting a storage
  * group, the parameter also adds or deletes four MemTables. The reason why 
adding or deleting four
@@ -41,17 +41,19 @@ import org.slf4j.LoggerFactory;
  * than that of data writing, so one is used for the Flush process and the 
other is used for data
  * writing. Otherwise, the system should limit the speed of data writing to 
maintain stability. And
  * two for sequence data, two for unsequence data.
- *
+ * <p>
  * 2. memtableSize. This parameter determines the threshold value for the 
MemTable in memory to be
  * flushed into disk. When the system load increases, the parameter should be 
set smaller so that
  * the data in memory can be flushed into disk as soon as possible.
- *
+ * <p>
  * 3. tsFileSizeThreshold. This parameter determines the speed of the tsfile 
seal, and then
  * determines the maximum size of metadata information maintained in memory. 
When the system load
  * increases, the parameter should be smaller to seal the file as soon as 
possible, release the
  * memory occupied by the corresponding metadata information as soon as 
possible.
- *
+ * <p>
  * The following equation is used to adjust the dynamic parameters of the data:
+ * <p>
+ * *
  *
  * Abbreviation of parameters:
  * 1 memtableSize: m
@@ -69,47 +71,39 @@ import org.slf4j.LoggerFactory;
  */
 public class IoTDBConfigDynamicAdapter implements IDynamicAdapter {
 
-  private static final Logger LOGGER = 
LoggerFactory.getLogger(IoTDBConfigDynamicAdapter.class);
-
-  private static final IoTDBConfig CONFIG = 
IoTDBDescriptor.getInstance().getConfig();
-
   public static final String CREATE_STORAGE_GROUP = "create storage group";
-
   public static final String ADD_TIMESERIES = "add timeseries";
-
-  // static parameter section
-
   /**
-   * Maximum amount of memory allocated for write process.
+   * Average queue length in memtable pool
    */
-  private static long allocateMemoryForWrite = 
CONFIG.getAllocateMemoryForWrite();
+  static final int MEM_TABLE_AVERAGE_QUEUE_LEN = 5;
+  private static final Logger LOGGER = 
LoggerFactory.getLogger(IoTDBConfigDynamicAdapter.class);
 
+  // static parameter section
+  private static final IoTDBConfig CONFIG = 
IoTDBDescriptor.getInstance().getConfig();
   /**
    * Metadata size of per timeseries, the default value is 2KB.
    */
   private static final long TIMESERIES_METADATA_SIZE_IN_BYTE = 2L * 1024;
-
+  private static final double WAL_MEMORY_RATIO = 0.1;
+  public static final int MEMTABLE_NUM_FOR_EACH_PARTITION = 4;
   /**
-   * Metadata size of per chunk, the default value is 1.5 KB.
+   * Maximum amount of memory allocated for write process.
    */
-  private static long CHUNK_METADATA_SIZE_IN_BYTE = 1536L;
-
-  private static final double WAL_MEMORY_RATIO = 0.1;
-
+  private static long allocateMemoryForWrite = 
CONFIG.getAllocateMemoryForWrite();
   /**
-   * Average queue length in memtable pool
+   * Metadata size of per chunk, the default value is 1.5 KB.
    */
-  static final int MEM_TABLE_AVERAGE_QUEUE_LEN = 5;
+  private static long CHUNK_METADATA_SIZE_IN_BYTE = 1536L;
 
   // static memory section
-
   /**
    * Static memory, includes all timeseries metadata, which equals to
    * TIMESERIES_METADATA_SIZE_IN_BYTE * totalTimeseriesNum, the unit is byte.
-   *
-   * Currently, we think that static memory only consists of time series 
metadata information.
-   * We ignore the memory occupied by the tsfile information maintained in 
memory,
-   * because we think that this part occupies very little memory.
+   * <p>
+   * Currently, we think that static memory only consists of time series 
metadata information. We
+   * ignore the memory occupied by the tsfile information maintained in 
memory, because we think
+   * that this part occupies very little memory.
    */
   private long staticMemory;
 
@@ -127,9 +121,20 @@ public class IoTDBConfigDynamicAdapter implements 
IDynamicAdapter {
 
   private boolean initialized = false;
 
+  private IoTDBConfigDynamicAdapter() {
+  }
+
+  public static void setChunkMetadataSizeInByte(long chunkMetadataSizeInByte) {
+    CHUNK_METADATA_SIZE_IN_BYTE = chunkMetadataSizeInByte;
+  }
+
+  public static IoTDBConfigDynamicAdapter getInstance() {
+    return IoTDBConfigAdapterHolder.INSTANCE;
+  }
+
   @Override
   public synchronized boolean tryToAdaptParameters() {
-    if(!CONFIG.isEnableParameterAdapter()){
+    if (!CONFIG.isEnableParameterAdapter()) {
       return true;
     }
     boolean canAdjust = true;
@@ -138,7 +143,7 @@ public class IoTDBConfigDynamicAdapter implements 
IDynamicAdapter {
     long memTableSizeFloorThreshold = getMemTableSizeFloorThreshold();
     long tsFileSizeThreshold = CONFIG.getTsFileSizeThreshold();
     if (memtableSizeInByte < memTableSizeFloorThreshold) {
-      if(LOGGER.isDebugEnabled() && initialized) {
+      if (LOGGER.isDebugEnabled() && initialized) {
         LOGGER.debug("memtableSizeInByte {} is smaller than 
memTableSizeFloorThreshold {}",
             memtableSizeInByte, memTableSizeFloorThreshold);
       }
@@ -148,15 +153,17 @@ public class IoTDBConfigDynamicAdapter implements 
IDynamicAdapter {
       } else {
         // memtableSizeInByte need to be larger than memTableSizeFloorThreshold
         memtableSizeInByte = Math.max(memTableSizeFloorThreshold,
-            memTableSizeFloorThreshold + (((long) (tsFileSizeThreshold * 
ratio) - memTableSizeFloorThreshold)
-                >> 1));
+            memTableSizeFloorThreshold + (
+                ((long) (tsFileSizeThreshold * ratio) - 
memTableSizeFloorThreshold)
+                    >> 1));
       }
     }
 
     if (canAdjust) {
       CONFIG.setMaxMemtableNumber(maxMemTableNum);
       CONFIG.setWalBufferSize(
-          (int) Math.min(Integer.MAX_VALUE, allocateMemoryForWrite * 
WAL_MEMORY_RATIO / maxMemTableNum));
+          (int) Math
+              .min(Integer.MAX_VALUE, allocateMemoryForWrite * 
WAL_MEMORY_RATIO / maxMemTableNum));
       CONFIG.setTsFileSizeThreshold(tsFileSizeThreshold);
       CONFIG.setMemtableSizeThreshold(memtableSizeInByte);
       if (LOGGER.isDebugEnabled() && initialized) {
@@ -176,8 +183,7 @@ public class IoTDBConfigDynamicAdapter implements 
IDynamicAdapter {
   }
 
   /**
-   * Calculate appropriate MemTable size.
-   * Computing method refers to class annotations.
+   * Calculate appropriate MemTable size. Computing method refers to class 
annotations.
    *
    * @return MemTable byte size. If the value is -1, there is no valid 
solution.
    */
@@ -198,8 +204,8 @@ public class IoTDBConfigDynamicAdapter implements 
IDynamicAdapter {
   }
 
   /**
-   * Calculate appropriate Tsfile size based on MemTable size.
-   * Computing method refers to class annotations.
+   * Calculate appropriate Tsfile size based on MemTable size. Computing 
method refers to class
+   * annotations.
    *
    * @param memTableSize MemTable size
    * @return Tsfile byte threshold
@@ -224,7 +230,8 @@ public class IoTDBConfigDynamicAdapter implements 
IDynamicAdapter {
   public void addOrDeleteStorageGroup(int diff) throws ConfigAdjusterException 
{
     totalStorageGroup += diff;
     maxMemTableNum +=
-        
IoTDBDescriptor.getInstance().getConfig().getMemtableNumInEachStorageGroup() * 
diff;
+        MEMTABLE_NUM_FOR_EACH_PARTITION * 
IoTDBDescriptor.getInstance().getConfig().getConcurrentWritingTimePartition() * 
diff
+            + diff;
     if (!CONFIG.isEnableParameterAdapter()) {
       CONFIG.setMaxMemtableNumber(maxMemTableNum);
       return;
@@ -233,14 +240,15 @@ public class IoTDBConfigDynamicAdapter implements 
IDynamicAdapter {
     if (!tryToAdaptParameters()) {
       totalStorageGroup -= diff;
       maxMemTableNum -=
-          
IoTDBDescriptor.getInstance().getConfig().getMemtableNumInEachStorageGroup() * 
diff;
+          MEMTABLE_NUM_FOR_EACH_PARTITION * 
IoTDBDescriptor.getInstance().getConfig().getConcurrentWritingTimePartition() * 
diff
+              + diff;
       throw new ConfigAdjusterException(CREATE_STORAGE_GROUP);
     }
   }
 
   @Override
   public void addOrDeleteTimeSeries(int diff) throws ConfigAdjusterException {
-    if(!CONFIG.isEnableParameterAdapter()){
+    if (!CONFIG.isEnableParameterAdapter()) {
       return;
     }
     totalTimeseries += diff;
@@ -268,11 +276,6 @@ public class IoTDBConfigDynamicAdapter implements 
IDynamicAdapter {
     return totalStorageGroup;
   }
 
-
-  public static void setChunkMetadataSizeInByte(long chunkMetadataSizeInByte) {
-    CHUNK_METADATA_SIZE_IN_BYTE = chunkMetadataSizeInByte;
-  }
-
   /**
    * Only for test
    */
@@ -284,13 +287,6 @@ public class IoTDBConfigDynamicAdapter implements 
IDynamicAdapter {
     initialized = false;
   }
 
-  private IoTDBConfigDynamicAdapter() {
-  }
-
-  public static IoTDBConfigDynamicAdapter getInstance() {
-    return IoTDBConfigAdapterHolder.INSTANCE;
-  }
-
   private static class IoTDBConfigAdapterHolder {
 
     private static final IoTDBConfigDynamicAdapter INSTANCE = new 
IoTDBConfigDynamicAdapter();
diff --git 
a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
 
b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
index d559482..f543c5a 100755
--- 
a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
+++ 
b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
@@ -18,6 +18,27 @@
  */
 package org.apache.iotdb.db.engine.storagegroup;
 
+import static org.apache.iotdb.db.engine.merge.task.MergeTask.MERGE_SUFFIX;
+import static 
org.apache.iotdb.db.engine.storagegroup.TsFileResource.TEMP_SUFFIX;
+import static 
org.apache.iotdb.tsfile.common.constant.TsFileConstant.TSFILE_SUFFIX;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.TreeSet;
+import java.util.concurrent.locks.ReadWriteLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
 import org.apache.commons.io.FileUtils;
 import org.apache.iotdb.db.conf.IoTDBConstant;
 import org.apache.iotdb.db.conf.IoTDBDescriptor;
@@ -40,7 +61,12 @@ import 
org.apache.iotdb.db.engine.querycontext.QueryDataSource;
 import org.apache.iotdb.db.engine.querycontext.ReadOnlyMemChunk;
 import org.apache.iotdb.db.engine.version.SimpleFileVersionController;
 import org.apache.iotdb.db.engine.version.VersionController;
-import org.apache.iotdb.db.exception.*;
+import org.apache.iotdb.db.exception.DiskSpaceInsufficientException;
+import org.apache.iotdb.db.exception.LoadFileException;
+import org.apache.iotdb.db.exception.MergeException;
+import org.apache.iotdb.db.exception.StorageGroupProcessorException;
+import org.apache.iotdb.db.exception.TsFileProcessorException;
+import org.apache.iotdb.db.exception.WriteProcessException;
 import org.apache.iotdb.db.exception.metadata.MetadataException;
 import org.apache.iotdb.db.exception.query.OutOfTTLException;
 import org.apache.iotdb.db.exception.query.QueryProcessException;
@@ -48,9 +74,9 @@ import org.apache.iotdb.db.metadata.MManager;
 import org.apache.iotdb.db.metadata.mnode.InternalMNode;
 import org.apache.iotdb.db.metadata.mnode.LeafMNode;
 import org.apache.iotdb.db.metadata.mnode.MNode;
-import org.apache.iotdb.db.qp.physical.crud.InsertTabletPlan;
 import org.apache.iotdb.db.qp.physical.crud.DeletePlan;
 import org.apache.iotdb.db.qp.physical.crud.InsertPlan;
+import org.apache.iotdb.db.qp.physical.crud.InsertTabletPlan;
 import org.apache.iotdb.db.query.context.QueryContext;
 import org.apache.iotdb.db.query.control.QueryFileManager;
 import org.apache.iotdb.db.utils.CopyOnReadLinkedList;
@@ -70,17 +96,6 @@ import 
org.apache.iotdb.tsfile.write.writer.RestorableTsFileIOWriter;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.File;
-import java.io.IOException;
-import java.util.*;
-import java.util.Map.Entry;
-import java.util.concurrent.locks.ReadWriteLock;
-import java.util.concurrent.locks.ReentrantReadWriteLock;
-
-import static org.apache.iotdb.db.engine.merge.task.MergeTask.MERGE_SUFFIX;
-import static 
org.apache.iotdb.db.engine.storagegroup.TsFileResource.TEMP_SUFFIX;
-import static 
org.apache.iotdb.tsfile.common.constant.TsFileConstant.TSFILE_SUFFIX;
-
 /**
  * For sequence data, a StorageGroupProcessor has some TsFileProcessors, in 
which there is only one
  * TsFileProcessor in the working status. <br/>
@@ -732,12 +747,12 @@ public class StorageGroupProcessor {
         // we have to remove oldest processor to control the num of the 
memtables
         // TODO: use a method to control the number of memtables
         if (tsFileProcessorTreeMap.size()
-            >= 
IoTDBDescriptor.getInstance().getConfig().getMemtableNumInEachStorageGroup() / 
2) {
+            >= 
IoTDBDescriptor.getInstance().getConfig().getConcurrentWritingTimePartition()) {
           Map.Entry<Long, TsFileProcessor> processorEntry = 
tsFileProcessorTreeMap.firstEntry();
           logger.info(
               "will close a TsFile because too many memtables ({} > {}) in the 
storage group {},",
               tsFileProcessorTreeMap.size(),
-              
IoTDBDescriptor.getInstance().getConfig().getMemtableNumInEachStorageGroup() / 
2,
+              
IoTDBDescriptor.getInstance().getConfig().getConcurrentWritingTimePartition(),
               storageGroupName);
           asyncCloseOneTsFileProcessor(sequence, processorEntry.getValue());
         }
diff --git 
a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileProcessor.java
 
b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileProcessor.java
index 97bd200..b0f308e 100644
--- 
a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileProcessor.java
+++ 
b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileProcessor.java
@@ -18,6 +18,8 @@
  */
 package org.apache.iotdb.db.engine.storagegroup;
 
+import static 
org.apache.iotdb.db.conf.adapter.IoTDBConfigDynamicAdapter.MEMTABLE_NUM_FOR_EACH_PARTITION;
+
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
@@ -33,7 +35,6 @@ import org.apache.iotdb.db.conf.IoTDBDescriptor;
 import org.apache.iotdb.db.conf.adapter.ActiveTimeSeriesCounter;
 import org.apache.iotdb.db.conf.adapter.CompressionRatio;
 import org.apache.iotdb.db.conf.adapter.IoTDBConfigDynamicAdapter;
-import org.apache.iotdb.db.engine.cache.RamUsageEstimator;
 import org.apache.iotdb.db.engine.flush.FlushManager;
 import org.apache.iotdb.db.engine.flush.MemTableFlushTask;
 import org.apache.iotdb.db.engine.flush.NotifyFlushMemTable;
@@ -276,7 +277,7 @@ public class TsFileProcessor {
       return config.getMemtableSizeThreshold();
     }
     long memTableSize = (long) (config.getMemtableSizeThreshold() * 
config.getMaxMemtableNumber()
-        / 
IoTDBDescriptor.getInstance().getConfig().getMemtableNumInEachStorageGroup()
+        / 
IoTDBDescriptor.getInstance().getConfig().getConcurrentWritingTimePartition() / 
MEMTABLE_NUM_FOR_EACH_PARTITION
         * ActiveTimeSeriesCounter.getInstance()
         .getActiveRatio(storageGroupName));
     return Math.max(memTableSize, config.getMemtableSizeThreshold());
diff --git 
a/server/src/test/java/org/apache/iotdb/db/conf/adapter/IoTDBConfigDynamicAdapterTest.java
 
b/server/src/test/java/org/apache/iotdb/db/conf/adapter/IoTDBConfigDynamicAdapterTest.java
index 5c2cefa..5f34b51 100644
--- 
a/server/src/test/java/org/apache/iotdb/db/conf/adapter/IoTDBConfigDynamicAdapterTest.java
+++ 
b/server/src/test/java/org/apache/iotdb/db/conf/adapter/IoTDBConfigDynamicAdapterTest.java
@@ -18,6 +18,7 @@
  */
 package org.apache.iotdb.db.conf.adapter;
 
+import static 
org.apache.iotdb.db.conf.adapter.IoTDBConfigDynamicAdapter.MEMTABLE_NUM_FOR_EACH_PARTITION;
 import static org.junit.Assert.assertEquals;
 
 import org.apache.iotdb.db.conf.IoTDBConfig;
@@ -66,7 +67,7 @@ public class IoTDBConfigDynamicAdapterTest {
     for (int i = 1; i < 1000000; i++) {
       try {
         IoTDBConfigDynamicAdapter.getInstance().addOrDeleteStorageGroup(1);
-        memTableNum += 
IoTDBDescriptor.getInstance().getConfig().getMemtableNumInEachStorageGroup();
+        memTableNum += 
IoTDBDescriptor.getInstance().getConfig().getConcurrentWritingTimePartition() * 
MEMTABLE_NUM_FOR_EACH_PARTITION + 1;
         
assertEquals(IoTDBConfigDynamicAdapter.getInstance().getCurrentMemTableSize(),
             CONFIG.getMemtableSizeThreshold());
         assertEquals(CONFIG.getMaxMemtableNumber(), memTableNum);

Reply via email to