You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ha...@apache.org on 2024/03/29 01:45:52 UTC
(iotdb) 17/19: Random schedule compaction of bound data regions in one compaction schedule worker (#12167)
This is an automated email from the ASF dual-hosted git repository.
haonan pushed a commit to branch rc/1.3.1
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 9e17d0790898ee9dc89a17d58f50cfd4002b009b
Author: shuwenwei <55...@users.noreply.github.com>
AuthorDate: Thu Mar 14 09:50:01 2024 +0800
Random schedule compaction of bound data regions in one compaction schedule worker (#12167)
---
.../src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java | 2 +-
.../compaction/schedule/CompactionScheduleTaskWorker.java | 7 ++++++-
.../src/assembly/resources/conf/iotdb-common.properties | 2 +-
3 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java
index e997b042547..c286a9c6490 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java
@@ -535,7 +535,7 @@ public class IoTDBConfig {
private boolean enableTsFileValidation = false;
/** The size of candidate compaction task queue. */
- private int candidateCompactionTaskQueueSize = 50;
+ private int candidateCompactionTaskQueueSize = 200;
/**
* When the size of the mods file corresponding to TsFile exceeds this value, inner compaction
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/schedule/CompactionScheduleTaskWorker.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/schedule/CompactionScheduleTaskWorker.java
index b6b438e1b80..e3f8318c63f 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/schedule/CompactionScheduleTaskWorker.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/schedule/CompactionScheduleTaskWorker.java
@@ -27,6 +27,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import java.util.concurrent.Callable;
@@ -53,11 +54,15 @@ public class CompactionScheduleTaskWorker implements Callable<Void> {
continue;
}
List<DataRegion> dataRegionListSnapshot = new ArrayList<>(dataRegionList);
+ List<DataRegion> dataRegionsToScheduleCompaction = new ArrayList<>();
for (int i = 0; i < dataRegionListSnapshot.size(); i++) {
if (i % workerNum != workerId) {
continue;
}
- DataRegion dataRegion = dataRegionListSnapshot.get(i);
+ dataRegionsToScheduleCompaction.add(dataRegionListSnapshot.get(i));
+ }
+ Collections.shuffle(dataRegionsToScheduleCompaction);
+ for (DataRegion dataRegion : dataRegionsToScheduleCompaction) {
if (Thread.interrupted()) {
throw new InterruptedException();
}
diff --git a/iotdb-core/node-commons/src/assembly/resources/conf/iotdb-common.properties b/iotdb-core/node-commons/src/assembly/resources/conf/iotdb-common.properties
index 81e0daa33bd..e261d967462 100644
--- a/iotdb-core/node-commons/src/assembly/resources/conf/iotdb-common.properties
+++ b/iotdb-core/node-commons/src/assembly/resources/conf/iotdb-common.properties
@@ -601,7 +601,7 @@ data_replication_factor=1
# The size of candidate compaction task queue.
# Datatype: int
-# candidate_compaction_task_queue_size = 50
+# candidate_compaction_task_queue_size = 200
# This parameter is used in two places:
# 1. The target tsfile size of inner space compaction.