You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ej...@apache.org on 2020/12/11 04:10:20 UTC

[iotdb] branch sliding_mem_table updated: fix v2

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

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


The following commit(s) were added to refs/heads/sliding_mem_table by this push:
     new 2b0cf98  fix v2
2b0cf98 is described below

commit 2b0cf98a7ad9b41b6a86d514770119c4038a7b25
Author: EJTTianyu <16...@qq.com>
AuthorDate: Fri Dec 11 12:09:58 2020 +0800

    fix v2
---
 .../main/java/org/apache/iotdb/db/engine/flush/FlushManager.java    | 6 +++---
 .../org/apache/iotdb/db/engine/storagegroup/TsFileProcessor.java    | 6 +++---
 server/src/main/java/org/apache/iotdb/db/rescon/SystemInfo.java     | 6 +++---
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/engine/flush/FlushManager.java b/server/src/main/java/org/apache/iotdb/db/engine/flush/FlushManager.java
index b4041d3..05837b2 100644
--- a/server/src/main/java/org/apache/iotdb/db/engine/flush/FlushManager.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/flush/FlushManager.java
@@ -101,14 +101,14 @@ public class FlushManager implements FlushManagerMBean, IService {
             && System.currentTimeMillis() - startTime < config.getFlushWaitTime()) {
           // wait
           try {
-            TimeUnit.MILLISECONDS.sleep(config.getWaitingTimeWhenInsertBlocked());
+            TimeUnit.MILLISECONDS.sleep(config.getCheckPeriodWhenInsertBlocked());
           } catch (InterruptedException e) {
             logger.error("flush mem table wait error", e);
           }
         }
       }
-      if (tsFileProcessor.isSequence() && IoTDBDescriptor.getInstance().getConfig()
-          .isEnableSlidingMemTable() && tsFileProcessor.isFlushMemTableAlive()) {
+      if (tsFileProcessor.isSequence() && config.isEnableSlidingMemTable() &&
+          tsFileProcessor.isFlushMemTableAlive()) {
         tsFileProcessor.getUpdateLatestFlushTimeCallback().call(tsFileProcessor, true);
       }
       tsFileProcessor.flushOneMemTable();
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 547d0e8..41ab3de 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
@@ -522,15 +522,15 @@ public class TsFileProcessor {
 
       // we have to add the memtable into flushingList first and then set the shouldClose tag.
       // see https://issues.apache.org/jira/browse/IOTDB-510
-      IMemTable tmpWorkMemTable = workMemTable == null || workMemTable.memSize() == 0
+      IMemTable tmpMemTable = workMemTable == null || workMemTable.memSize() == 0
           ? new NotifyFlushMemTable()
           : workMemTable;
 
       try {
         // When invoke closing TsFile after insert data to memTable, we shouldn't flush until invoke
         // flushing memTable in System module.
-        addAMemtableIntoFlushingList(tmpWorkMemTable, true);
-        logger.info("Memtable {} has been added to flushing list", tmpWorkMemTable);
+        addAMemtableIntoFlushingList(tmpMemTable, true);
+        logger.info("Memtable {} has been added to flushing list", tmpMemTable);
         shouldClose = true;
       } catch (Exception e) {
         logger.error("{}: {} async close failed, because", storageGroupName,
diff --git a/server/src/main/java/org/apache/iotdb/db/rescon/SystemInfo.java b/server/src/main/java/org/apache/iotdb/db/rescon/SystemInfo.java
index 70af45a..81b7d5a 100644
--- a/server/src/main/java/org/apache/iotdb/db/rescon/SystemInfo.java
+++ b/server/src/main/java/org/apache/iotdb/db/rescon/SystemInfo.java
@@ -43,8 +43,8 @@ public class SystemInfo {
 
   private Map<StorageGroupInfo, Long> reportedSgMemCostMap = new HashMap<>();
 
-  private static final double QUICK_FLUSH_PROPORTION =
-      config.getAllocateMemoryForWrite() * config.getFlushProportion();
+  private static final double FORCE_FLUSH_THERSHOLD =
+      config.getAllocateMemoryForWrite() * config.getForceFlushProportion();
   private static final double FLUSH_THERSHOLD =
       config.getAllocateMemoryForWrite() * config.getFlushProportion();
   private static final double REJECT_THERSHOLD =
@@ -205,6 +205,6 @@ public class SystemInfo {
   }
 
   public boolean forceFlush(){
-    return totalSgMemCost >= QUICK_FLUSH_PROPORTION;
+    return totalSgMemCost >= FORCE_FLUSH_THERSHOLD;
   }
 }