You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by qi...@apache.org on 2021/08/05 01:43:16 UTC

[iotdb] 01/01: close compaction by default

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

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

commit 340ea194a0a336a81ef75dd58562b16a43aae6d3
Author: qiaojialin <64...@qq.com>
AuthorDate: Thu Aug 5 09:42:34 2021 +0800

    close compaction by default
---
 server/src/assembly/resources/conf/iotdb-engine.properties  |  6 +++---
 .../src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java |  6 +++---
 .../engine/compaction/CompactionMergeTaskPoolManager.java   | 13 ++++++++-----
 3 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/server/src/assembly/resources/conf/iotdb-engine.properties b/server/src/assembly/resources/conf/iotdb-engine.properties
index c8fb395..641e9ab 100644
--- a/server/src/assembly/resources/conf/iotdb-engine.properties
+++ b/server/src/assembly/resources/conf/iotdb-engine.properties
@@ -381,16 +381,16 @@ timestamp_precision=ms
 ####################
 # LEVEL_COMPACTION, NO_COMPACTION
 # Datatype: CompactionStrategy
-# compaction_strategy=LEVEL_COMPACTION
+# compaction_strategy=NO_COMPACTION
 
 # Works when the compaction_strategy is LEVEL_COMPACTION.
 # Whether to merge unseq files into seq files or not.
 # Datatype: boolean
-# enable_unseq_compaction=true
+# enable_unseq_compaction=false
 
 # Works when the compaction_strategy is LEVEL_COMPACTION.
 # Whether to start next compaction task automatically after finish one compaction task
-# enable_continuous_compaction=true
+# enable_continuous_compaction=false
 
 # Works when the compaction_strategy is LEVEL_COMPACTION.
 # The max seq file num of each level.
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 1ed7acd..c4c4dd3 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
@@ -325,19 +325,19 @@ public class IoTDBConfig {
   private int mergePagePointNumberThreshold = 100;
 
   /** LEVEL_COMPACTION, NO_COMPACTION */
-  private CompactionStrategy compactionStrategy = CompactionStrategy.LEVEL_COMPACTION;
+  private CompactionStrategy compactionStrategy = CompactionStrategy.NO_COMPACTION;
 
   /**
    * Works when the compaction_strategy is LEVEL_COMPACTION. Whether to merge unseq files into seq
    * files or not.
    */
-  private boolean enableUnseqCompaction = true;
+  private boolean enableUnseqCompaction = false;
 
   /**
    * Works when the compaction_strategy is LEVEL_COMPACTION. Whether to start next compaction task
    * automatically after finish one compaction task
    */
-  private boolean enableContinuousCompaction = true;
+  private boolean enableContinuousCompaction = false;
 
   /**
    * Works when the compaction_strategy is LEVEL_COMPACTION. The max seq file num of each level.
diff --git a/server/src/main/java/org/apache/iotdb/db/engine/compaction/CompactionMergeTaskPoolManager.java b/server/src/main/java/org/apache/iotdb/db/engine/compaction/CompactionMergeTaskPoolManager.java
index cdf6f4a..79b5d29 100644
--- a/server/src/main/java/org/apache/iotdb/db/engine/compaction/CompactionMergeTaskPoolManager.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/compaction/CompactionMergeTaskPoolManager.java
@@ -161,11 +161,14 @@ public class CompactionMergeTaskPoolManager implements IService {
 
   public void submitTask(String storageGroupName, Callable<Void> compactionMergeTask)
       throws RejectedExecutionException {
-    if (pool != null && !pool.isTerminated()) {
-      Future<Void> future = pool.submit(compactionMergeTask);
-      storageGroupTasks
-          .computeIfAbsent(storageGroupName, k -> new ConcurrentSkipListSet<>())
-          .add(future);
+    if (IoTDBDescriptor.getInstance().getConfig().getCompactionStrategy()
+        == CompactionStrategy.LEVEL_COMPACTION) {
+      if (pool != null && !pool.isTerminated()) {
+        Future<Void> future = pool.submit(compactionMergeTask);
+        storageGroupTasks
+            .computeIfAbsent(storageGroupName, k -> new ConcurrentSkipListSet<>())
+            .add(future);
+      }
     }
   }