You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by lt...@apache.org on 2019/07/28 01:51:18 UTC

[incubator-iotdb] branch master updated: add log to show dynamic parameters after updating compression ratio

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

lta 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 2ff3f56  add log to show dynamic parameters after updating compression ratio
2ff3f56 is described below

commit 2ff3f56ec2084976fecdf10e31681d42c3cc8ac1
Author: lta <li...@163.com>
AuthorDate: Sun Jul 28 09:50:35 2019 +0800

    add log to show dynamic parameters after updating compression ratio
---
 .../iotdb/db/conf/adapter/CompressionRatio.java      | 18 +++++++++++++++++-
 .../db/conf/adapter/IoTDBConfigDynamicAdapter.java   | 20 ++++++++++++--------
 2 files changed, 29 insertions(+), 9 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/conf/adapter/CompressionRatio.java b/server/src/main/java/org/apache/iotdb/db/conf/adapter/CompressionRatio.java
index 389076c..c7819fe 100644
--- a/server/src/main/java/org/apache/iotdb/db/conf/adapter/CompressionRatio.java
+++ b/server/src/main/java/org/apache/iotdb/db/conf/adapter/CompressionRatio.java
@@ -21,7 +21,6 @@ package org.apache.iotdb.db.conf.adapter;
 import java.io.File;
 import java.io.IOException;
 import java.util.Locale;
-
 import org.apache.commons.io.FileUtils;
 import org.apache.iotdb.db.conf.IoTDBConfig;
 import org.apache.iotdb.db.conf.IoTDBDescriptor;
@@ -87,8 +86,25 @@ public class CompressionRatio {
     File newFile = new File(directory,
         String.format(Locale.ENGLISH, RATIO_FILE_PATH_FORMAT, compressionRatioSum, calcTimes));
     persist(oldFile, newFile);
+    if (LOGGER.isInfoEnabled()) {
+      LOGGER.info("Compression ratio is {}", getRatio());
+    }
     if (CONFIG.isEnableParameterAdapter()) {
+      if (LOGGER.isInfoEnabled()) {
+        LOGGER.info(
+            "After updating compression ratio, trying to adjust parameters, the original parameters: "
+                + "MemTableSize threshold is {}B, TsfileSize threshold is {}B, MemTableNumber is {}",
+            CONFIG.getMemtableSizeThreshold(), CONFIG.getTsFileSizeThreshold(),
+            CONFIG.getMaxMemtableNumber());
+      }
       IoTDBConfigDynamicAdapter.getInstance().tryToAdaptParameters();
+      if(LOGGER.isInfoEnabled()) {
+        LOGGER.info(
+            "After updating compression ratio, trying to adjust parameters, the modified parameters: "
+                + "MemTableSize threshold is {}B, TsfileSize threshold is {}B, MemTableNumber is {}",
+            CONFIG.getMemtableSizeThreshold(), CONFIG.getTsFileSizeThreshold(),
+            CONFIG.getMaxMemtableNumber());
+      }
     }
   }
 
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 92fea6d..04cbf1f 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
@@ -129,8 +129,10 @@ public class IoTDBConfigDynamicAdapter implements IDynamicAdapter {
     long memTableSizeFloorThreshold = getMemTableSizeFloorThreshold();
     long tsFileSizeThreshold = CONFIG.getTsFileSizeThreshold();
     if (memtableSizeInByte < memTableSizeFloorThreshold) {
-      LOGGER.debug("memtableSizeInByte {} is smaller than memTableSizeFloorThreshold {}",
-          memtableSizeInByte, memTableSizeFloorThreshold);
+      if(LOGGER.isDebugEnabled()) {
+        LOGGER.debug("memtableSizeInByte {} is smaller than memTableSizeFloorThreshold {}",
+            memtableSizeInByte, memTableSizeFloorThreshold);
+      }
       tsFileSizeThreshold = calcTsFileSizeThreshold(memTableSizeFloorThreshold, ratio);
       if ((long) (tsFileSizeThreshold * ratio) < memTableSizeFloorThreshold) {
         canAdjust = false;
@@ -146,10 +148,12 @@ public class IoTDBConfigDynamicAdapter implements IDynamicAdapter {
       CONFIG.setMaxMemtableNumber(maxMemTableNum);
       CONFIG.setTsFileSizeThreshold(tsFileSizeThreshold);
       CONFIG.setMemtableSizeThreshold(memtableSizeInByte);
-      LOGGER.debug(
-          "After adjusting, max memTable num is {}, tsFile threshold is {}, memtableSize is {}, memTableSizeFloorThreshold is {}",
-          maxMemTableNum, tsFileSizeThreshold, memtableSizeInByte, memTableSizeFloorThreshold);
-      currentMemTableSize = memtableSizeInByte;
+      if(LOGGER.isDebugEnabled()) {
+        LOGGER.debug(
+            "After adjusting, max memTable num is {}, tsFile threshold is {}, memtableSize is {}, memTableSizeFloorThreshold is {}",
+            maxMemTableNum, tsFileSizeThreshold, memtableSizeInByte, memTableSizeFloorThreshold);
+        currentMemTableSize = memtableSizeInByte;
+      }
     }
     if (!initialized) {
       CONFIG.setMaxMemtableNumber(maxMemTableNum);
@@ -208,7 +212,7 @@ public class IoTDBConfigDynamicAdapter implements IDynamicAdapter {
    * TODO: Currently IoTDB only supports to add a storage group.
    */
   @Override
-  public void addOrDeleteStorageGroup(int diff) throws ConfigAdjusterException {
+  public synchronized void addOrDeleteStorageGroup(int diff) throws ConfigAdjusterException {
     totalStorageGroup += diff;
     maxMemTableNum += 4 * diff;
     if(!CONFIG.isEnableParameterAdapter()){
@@ -224,7 +228,7 @@ public class IoTDBConfigDynamicAdapter implements IDynamicAdapter {
   }
 
   @Override
-  public void addOrDeleteTimeSeries(int diff) throws ConfigAdjusterException {
+  public synchronized void addOrDeleteTimeSeries(int diff) throws ConfigAdjusterException {
     if(!CONFIG.isEnableParameterAdapter()){
       return;
     }