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 02:17:10 UTC

[incubator-iotdb] 01/01: 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

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

    add log to show dynamic parameters after updating compression ratio
---
 .../apache/iotdb/db/conf/adapter/CompressionRatio.java | 18 +++++++++++++++++-
 .../db/conf/adapter/IoTDBConfigDynamicAdapter.java     | 14 +++++++++-----
 2 files changed, 26 insertions(+), 6 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..cb4bae1 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,9 +148,11 @@ 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);
+      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) {