This is an automated email from the ASF dual-hosted git repository.
tanxinyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new 18ac5bcd645 Add cpu usage metrics for confignode (#10307)
18ac5bcd645 is described below
commit 18ac5bcd64511453ac2163bb9ffde2ef5a06aa3f
Author: Liu Xuxin <[email protected]>
AuthorDate: Mon Jul 10 09:05:13 2023 +0800
Add cpu usage metrics for confignode (#10307)
---
.../statemachine/ConfigRegionStateMachine.java | 5 +-
.../confignode/manager/RetryFailedTasksThread.java | 4 +-
.../iotdb/confignode/manager/cq/CQManager.java | 5 +-
.../manager/load/service/HeartbeatService.java | 4 +-
.../manager/load/service/StatisticsService.java | 4 +-
.../manager/partition/PartitionManager.java | 4 +-
.../confignode/procedure/ProcedureExecutor.java | 9 +-
.../iotdb/confignode/service/ConfigNode.java | 21 ++
.../iotdb/consensus/ratis/RatisConsensus.java | 6 +-
.../apache/iotdb/db/schemaengine/SchemaEngine.java | 6 +-
.../iotdb/db/service/RegionMigrateService.java | 4 +-
.../db/service/metrics/DataNodeMetricsHelper.java | 5 +-
.../dataregion/wal/recover/WALRecoverManager.java | 2 +-
.../trigger/service/TriggerInformationUpdater.java | 3 +-
.../metrics/metricsets/cpu/CpuUsageMetrics.java | 9 +
...DataNodeThreadModule.java => ThreadModule.java} | 9 +-
.../iotdb/commons/concurrent/ThreadName.java | 228 ++++++++++++++-------
.../apache/iotdb/commons/service/ServiceType.java | 1 -
18 files changed, 233 insertions(+), 96 deletions(-)
diff --git
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/statemachine/ConfigRegionStateMachine.java
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/statemachine/ConfigRegionStateMachine.java
index 5646b9255ba..fdec21c1c00 100644
---
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/statemachine/ConfigRegionStateMachine.java
+++
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/statemachine/ConfigRegionStateMachine.java
@@ -23,6 +23,7 @@ import org.apache.iotdb.common.rpc.thrift.TEndPoint;
import org.apache.iotdb.common.rpc.thrift.TSStatus;
import org.apache.iotdb.commons.auth.AuthException;
import org.apache.iotdb.commons.concurrent.IoTDBThreadPoolFactory;
+import org.apache.iotdb.commons.concurrent.ThreadName;
import org.apache.iotdb.commons.concurrent.threadpool.ScheduledExecutorUtil;
import org.apache.iotdb.commons.conf.CommonDescriptor;
import org.apache.iotdb.commons.consensus.ConsensusGroupId;
@@ -64,7 +65,7 @@ public class ConfigRegionStateMachine
private static final Logger LOGGER =
LoggerFactory.getLogger(ConfigRegionStateMachine.class);
private static final ExecutorService threadPool =
-
IoTDBThreadPoolFactory.newCachedThreadPool("ConfigNode-Manager-Recovery");
+
IoTDBThreadPoolFactory.newCachedThreadPool(ThreadName.CONFIG_NODE_RECOVER.getName());
private static final ConfigNodeConfig CONF =
ConfigNodeDescriptor.getInstance().getConf();
private final ConfigPlanExecutor executor;
private ConfigManager configManager;
@@ -348,7 +349,7 @@ public class ConfigRegionStateMachine
ScheduledExecutorService simpleConsensusThread =
IoTDBThreadPoolFactory.newSingleThreadScheduledExecutor(
- "ConfigNode-Simple-Consensus-WAL-Flush-Thread");
+ ThreadName.CONFIG_NODE_SIMPLE_CONSENSUS_WAL_FLUSH.getName());
ScheduledExecutorUtil.safelyScheduleWithFixedDelay(
simpleConsensusThread,
this::flushWALForSimpleConsensus,
diff --git
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/RetryFailedTasksThread.java
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/RetryFailedTasksThread.java
index 021ef308f5a..48685b92f5f 100644
---
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/RetryFailedTasksThread.java
+++
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/RetryFailedTasksThread.java
@@ -22,6 +22,7 @@ import org.apache.iotdb.common.rpc.thrift.TDataNodeLocation;
import org.apache.iotdb.common.rpc.thrift.TSStatus;
import org.apache.iotdb.commons.cluster.NodeStatus;
import org.apache.iotdb.commons.concurrent.IoTDBThreadPoolFactory;
+import org.apache.iotdb.commons.concurrent.ThreadName;
import org.apache.iotdb.commons.concurrent.threadpool.ScheduledExecutorUtil;
import org.apache.iotdb.confignode.conf.ConfigNodeConfig;
import org.apache.iotdb.confignode.conf.ConfigNodeDescriptor;
@@ -56,7 +57,8 @@ public class RetryFailedTasksThread {
private final NodeManager nodeManager;
private final LoadManager loadManager;
private final ScheduledExecutorService retryFailTasksExecutor =
-
IoTDBThreadPoolFactory.newSingleThreadScheduledExecutor("Cluster-RetryFailedTasks-Service");
+ IoTDBThreadPoolFactory.newSingleThreadScheduledExecutor(
+ ThreadName.CONFIG_NODE_RETRY_FAILED_TASK.getName());
private final Object scheduleMonitor = new Object();
private Future<?> currentFailedTasksRetryThreadFuture;
diff --git
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/cq/CQManager.java
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/cq/CQManager.java
index e3c514ddd35..f44c5749655 100644
---
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/cq/CQManager.java
+++
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/cq/CQManager.java
@@ -64,7 +64,7 @@ public class CQManager {
this.lock = new ReentrantReadWriteLock();
this.executor =
IoTDBThreadPoolFactory.newScheduledThreadPool(
- CONF.getCqSubmitThread(), ThreadName.CQ_MANAGER.getName());
+ CONF.getCqSubmitThread(), ThreadName.CQ_SCHEDULER.getName());
}
public TSStatus createCQ(TCreateCQReq req) {
@@ -132,7 +132,8 @@ public class CQManager {
// 2. start a new schedule thread pool
executor =
-
IoTDBThreadPoolFactory.newScheduledThreadPool(CONF.getCqSubmitThread(),
"CQ-Scheduler");
+ IoTDBThreadPoolFactory.newScheduledThreadPool(
+ CONF.getCqSubmitThread(), ThreadName.CQ_SCHEDULER.getName());
// 3. get all CQs
List<CQInfo.CQEntry> allCQs = null;
diff --git
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/service/HeartbeatService.java
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/service/HeartbeatService.java
index ea42eb3f49c..9e8f7fdabaf 100644
---
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/service/HeartbeatService.java
+++
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/service/HeartbeatService.java
@@ -22,6 +22,7 @@ package org.apache.iotdb.confignode.manager.load.service;
import org.apache.iotdb.common.rpc.thrift.TConfigNodeLocation;
import org.apache.iotdb.common.rpc.thrift.TDataNodeConfiguration;
import org.apache.iotdb.commons.concurrent.IoTDBThreadPoolFactory;
+import org.apache.iotdb.commons.concurrent.ThreadName;
import org.apache.iotdb.commons.concurrent.threadpool.ScheduledExecutorUtil;
import org.apache.iotdb.commons.pipe.config.PipeConfig;
import
org.apache.iotdb.confignode.client.async.AsyncConfigNodeHeartbeatClientPool;
@@ -63,7 +64,8 @@ public class HeartbeatService {
private Future<?> currentHeartbeatFuture;
private final ScheduledExecutorService heartBeatExecutor =
-
IoTDBThreadPoolFactory.newSingleThreadScheduledExecutor("Cluster-Heartbeat-Service");
+ IoTDBThreadPoolFactory.newSingleThreadScheduledExecutor(
+ ThreadName.CONFIG_NODE_HEART_BEAT_SERVICE.getName());
private final AtomicLong heartbeatCounter = new AtomicLong(0);
public HeartbeatService(IManager configManager, LoadCache loadCache) {
diff --git
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/service/StatisticsService.java
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/service/StatisticsService.java
index 17d2d11b156..01f8fab8934 100644
---
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/service/StatisticsService.java
+++
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/service/StatisticsService.java
@@ -25,6 +25,7 @@ import org.apache.iotdb.common.rpc.thrift.TRegionReplicaSet;
import org.apache.iotdb.common.rpc.thrift.TSStatus;
import org.apache.iotdb.commons.cluster.NodeStatus;
import org.apache.iotdb.commons.concurrent.IoTDBThreadPoolFactory;
+import org.apache.iotdb.commons.concurrent.ThreadName;
import org.apache.iotdb.commons.concurrent.threadpool.ScheduledExecutorUtil;
import org.apache.iotdb.confignode.client.DataNodeRequestType;
import org.apache.iotdb.confignode.client.async.AsyncDataNodeClientPool;
@@ -81,7 +82,8 @@ public class StatisticsService implements
IClusterStatusSubscriber {
private Future<?> currentLoadStatisticsFuture;
private final ScheduledExecutorService loadStatisticsExecutor =
-
IoTDBThreadPoolFactory.newSingleThreadScheduledExecutor("Cluster-LoadStatistics-Service");
+ IoTDBThreadPoolFactory.newSingleThreadScheduledExecutor(
+ ThreadName.CONFIG_NODE_LOAD_STATISTIC.getName());
/** Start the load statistics service. */
public void startLoadStatisticsService() {
diff --git
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/partition/PartitionManager.java
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/partition/PartitionManager.java
index f42192a8d59..46850b26746 100644
---
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/partition/PartitionManager.java
+++
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/partition/PartitionManager.java
@@ -27,6 +27,7 @@ import
org.apache.iotdb.common.rpc.thrift.TSeriesPartitionSlot;
import org.apache.iotdb.common.rpc.thrift.TTimePartitionSlot;
import org.apache.iotdb.commons.cluster.RegionRoleType;
import org.apache.iotdb.commons.concurrent.IoTDBThreadPoolFactory;
+import org.apache.iotdb.commons.concurrent.ThreadName;
import org.apache.iotdb.commons.concurrent.threadpool.ScheduledExecutorUtil;
import org.apache.iotdb.commons.conf.CommonConfig;
import org.apache.iotdb.commons.conf.CommonDescriptor;
@@ -139,7 +140,8 @@ public class PartitionManager {
this.configManager = configManager;
this.partitionInfo = partitionInfo;
this.regionMaintainer =
-
IoTDBThreadPoolFactory.newSingleThreadScheduledExecutor("IoTDB-Region-Maintainer");
+ IoTDBThreadPoolFactory.newSingleThreadScheduledExecutor(
+ ThreadName.CONFIG_NODE_REGION_MAINTAINER.getName());
setSeriesPartitionExecutor();
}
diff --git
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/ProcedureExecutor.java
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/ProcedureExecutor.java
index 13e637f5630..f3ef15bd948 100644
---
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/ProcedureExecutor.java
+++
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/ProcedureExecutor.java
@@ -19,6 +19,7 @@
package org.apache.iotdb.confignode.procedure;
+import org.apache.iotdb.commons.concurrent.ThreadName;
import org.apache.iotdb.confignode.procedure.exception.ProcedureException;
import
org.apache.iotdb.confignode.procedure.exception.ProcedureSuspendedException;
import org.apache.iotdb.confignode.procedure.exception.ProcedureYieldException;
@@ -94,11 +95,13 @@ public class ProcedureExecutor<Env> {
public void init(int numThreads) {
this.corePoolSize = numThreads;
this.maxPoolSize = 10 * numThreads;
- this.threadGroup = new ThreadGroup("ProcedureWorkerGroup");
+ this.threadGroup = new
ThreadGroup(ThreadName.CONFIG_NODE_PROCEDURE_WORKER.getName());
this.timeoutExecutor =
- new TimeoutExecutorThread<>(this, threadGroup,
"ProcedureTimeoutExecutor");
+ new TimeoutExecutorThread<>(
+ this, threadGroup,
ThreadName.CONFIG_NODE_TIMEOUT_EXECUTOR.getName());
this.workerMonitorExecutor =
- new TimeoutExecutorThread<>(this, threadGroup,
"ProcedureWorkerThreadMonitor");
+ new TimeoutExecutorThread<>(
+ this, threadGroup,
ThreadName.CONFIG_NODE_WORKER_THREAD_MONITOR.getName());
workId.set(0);
workerThreads = new CopyOnWriteArrayList<>();
for (int i = 0; i < corePoolSize; i++) {
diff --git
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/service/ConfigNode.java
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/service/ConfigNode.java
index 0a934f98366..e446bec812c 100644
---
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/service/ConfigNode.java
+++
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/service/ConfigNode.java
@@ -22,6 +22,8 @@ package org.apache.iotdb.confignode.service;
import org.apache.iotdb.common.rpc.thrift.TConfigNodeLocation;
import org.apache.iotdb.common.rpc.thrift.TEndPoint;
import org.apache.iotdb.common.rpc.thrift.TSStatus;
+import org.apache.iotdb.commons.concurrent.ThreadModule;
+import org.apache.iotdb.commons.concurrent.ThreadName;
import org.apache.iotdb.commons.conf.IoTDBConstant;
import org.apache.iotdb.commons.exception.StartupException;
import org.apache.iotdb.commons.service.JMXService;
@@ -44,6 +46,7 @@ import org.apache.iotdb.db.service.metrics.ProcessMetrics;
import org.apache.iotdb.db.service.metrics.SystemMetrics;
import org.apache.iotdb.metrics.config.MetricConfigDescriptor;
import org.apache.iotdb.metrics.metricsets.UpTimeMetrics;
+import org.apache.iotdb.metrics.metricsets.cpu.CpuUsageMetrics;
import org.apache.iotdb.metrics.metricsets.disk.DiskMetrics;
import org.apache.iotdb.metrics.metricsets.jvm.JvmMetrics;
import org.apache.iotdb.metrics.metricsets.logback.LogbackMetrics;
@@ -56,6 +59,9 @@ import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
import java.util.concurrent.TimeUnit;
public class ConfigNode implements ConfigNodeMBean {
@@ -238,6 +244,21 @@ public class ConfigNode implements ConfigNodeMBean {
MetricService.getInstance().addMetricSet(new SystemMetrics(false));
MetricService.getInstance().addMetricSet(new
DiskMetrics(IoTDBConstant.CN_ROLE));
MetricService.getInstance().addMetricSet(new
NetMetrics(IoTDBConstant.CN_ROLE));
+ initCpuMetrics();
+ }
+
+ private void initCpuMetrics() {
+ List<String> threadModules = new ArrayList<>();
+ Arrays.stream(ThreadModule.values()).forEach(x ->
threadModules.add(x.toString()));
+ List<String> pools = new ArrayList<>();
+ Arrays.stream(ThreadName.values()).forEach(x -> pools.add(x.name()));
+ MetricService.getInstance()
+ .addMetricSet(
+ new CpuUsageMetrics(
+ threadModules,
+ pools,
+ x -> ThreadName.getModuleTheThreadBelongs(x).toString(),
+ x -> ThreadName.getThreadPoolTheThreadBelongs(x).name()));
}
private void initConfigManager() {
diff --git
a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/ratis/RatisConsensus.java
b/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/ratis/RatisConsensus.java
index 44d3b935136..cfa88d0edd6 100644
---
a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/ratis/RatisConsensus.java
+++
b/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/ratis/RatisConsensus.java
@@ -28,6 +28,7 @@ import org.apache.iotdb.commons.client.IClientPoolFactory;
import org.apache.iotdb.commons.client.exception.ClientManagerException;
import org.apache.iotdb.commons.client.property.ClientPoolProperty;
import org.apache.iotdb.commons.concurrent.IoTDBThreadPoolFactory;
+import org.apache.iotdb.commons.concurrent.ThreadName;
import org.apache.iotdb.commons.concurrent.threadpool.ScheduledExecutorUtil;
import org.apache.iotdb.commons.consensus.ConsensusGroupId;
import org.apache.iotdb.commons.service.metric.MetricService;
@@ -146,9 +147,10 @@ class RatisConsensus implements IConsensus {
this.ratisMetricSet = new RatisMetricSet();
this.triggerSnapshotThreshold =
this.config.getImpl().getTriggerSnapshotFileSize();
- addExecutor = IoTDBThreadPoolFactory.newCachedThreadPool("ratis-add");
+ addExecutor =
IoTDBThreadPoolFactory.newCachedThreadPool(ThreadName.RATIS_ADD.getName());
diskGuardian =
-
IoTDBThreadPoolFactory.newSingleThreadScheduledExecutor("ratis-bg-disk-guardian");
+ IoTDBThreadPoolFactory.newSingleThreadScheduledExecutor(
+ ThreadName.RATIS_BG_DISK_GUARDIAN.getName());
clientManager =
new IClientManager.Factory<RaftGroup, RatisClient>()
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/SchemaEngine.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/SchemaEngine.java
index f4a6b2d8b04..f335304f5c0 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/SchemaEngine.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/SchemaEngine.java
@@ -20,6 +20,7 @@
package org.apache.iotdb.db.schemaengine;
import org.apache.iotdb.commons.concurrent.IoTDBThreadPoolFactory;
+import org.apache.iotdb.commons.concurrent.ThreadName;
import org.apache.iotdb.commons.concurrent.threadpool.ScheduledExecutorUtil;
import org.apache.iotdb.commons.conf.CommonDescriptor;
import org.apache.iotdb.commons.consensus.SchemaRegionId;
@@ -122,7 +123,7 @@ public class SchemaEngine {
&& config.getSyncMlogPeriodInMs() != 0) {
timedForceMLogThread =
IoTDBThreadPoolFactory.newSingleThreadScheduledExecutor(
- "SchemaEngine-TimedForceMLog-Thread");
+ ThreadName.SCHEMA_FORCE_MLOG.getName());
ScheduledExecutorUtil.unsafelyScheduleAtFixedRate(
timedForceMLogThread,
this::forceMlog,
@@ -148,7 +149,8 @@ public class SchemaEngine {
// recover SchemaRegion concurrently
ExecutorService schemaRegionRecoverPools =
IoTDBThreadPoolFactory.newFixedThreadPool(
- Runtime.getRuntime().availableProcessors(),
"SchemaRegion-recover-task");
+ Runtime.getRuntime().availableProcessors(),
+ ThreadName.SCHEMA_REGION_RECOVER_TASK.getName());
List<Future<ISchemaRegion>> futures = new ArrayList<>();
for (File file : sgDirList) {
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/RegionMigrateService.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/RegionMigrateService.java
index d3f0dbafb44..35b495c8c1b 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/RegionMigrateService.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/RegionMigrateService.java
@@ -25,6 +25,7 @@ import
org.apache.iotdb.common.rpc.thrift.TRegionMigrateFailedType;
import org.apache.iotdb.common.rpc.thrift.TSStatus;
import org.apache.iotdb.commons.client.exception.ClientManagerException;
import org.apache.iotdb.commons.concurrent.IoTDBThreadPoolFactory;
+import org.apache.iotdb.commons.concurrent.ThreadName;
import org.apache.iotdb.commons.consensus.ConsensusGroupId;
import org.apache.iotdb.commons.consensus.DataRegionId;
import org.apache.iotdb.commons.consensus.SchemaRegionId;
@@ -161,7 +162,8 @@ public class RegionMigrateService implements IService {
private final Logger poolLogger =
LoggerFactory.getLogger(RegionMigratePool.class);
private RegionMigratePool() {
- this.pool =
IoTDBThreadPoolFactory.newSingleThreadExecutor("Region-Migrate-Pool");
+ this.pool =
+
IoTDBThreadPoolFactory.newSingleThreadExecutor(ThreadName.REGION_MIGRATE.getName());
}
@Override
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/metrics/DataNodeMetricsHelper.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/metrics/DataNodeMetricsHelper.java
index 7ea08bf90e6..c2853fb2fa7 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/metrics/DataNodeMetricsHelper.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/metrics/DataNodeMetricsHelper.java
@@ -19,7 +19,7 @@
package org.apache.iotdb.db.service.metrics;
-import org.apache.iotdb.commons.concurrent.DataNodeThreadModule;
+import org.apache.iotdb.commons.concurrent.ThreadModule;
import org.apache.iotdb.commons.concurrent.ThreadName;
import org.apache.iotdb.commons.concurrent.ThreadPoolMetrics;
import org.apache.iotdb.commons.conf.IoTDBConstant;
@@ -75,9 +75,8 @@ public class DataNodeMetricsHelper {
}
private static void initCpuMetrics() {
-
List<String> threadModules = new ArrayList<>();
- Arrays.stream(DataNodeThreadModule.values()).forEach(x ->
threadModules.add(x.toString()));
+ Arrays.stream(ThreadModule.values()).forEach(x ->
threadModules.add(x.toString()));
List<String> pools = new ArrayList<>();
Arrays.stream(ThreadName.values()).forEach(x -> pools.add(x.name()));
MetricService.getInstance()
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/recover/WALRecoverManager.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/recover/WALRecoverManager.java
index d306e69cb42..44c80cad828 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/recover/WALRecoverManager.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/recover/WALRecoverManager.java
@@ -139,7 +139,7 @@ public class WALRecoverManager {
List<Future<Void>> futures = new ArrayList<>();
ExecutorService recoverTsFilesThreadPool =
IoTDBThreadPoolFactory.newFixedThreadPool(
- Runtime.getRuntime().availableProcessors(), "TsFile-Recover");
+ Runtime.getRuntime().availableProcessors(),
ThreadName.TSFILE_RECOVER.getName());
// async recover
for (UnsealedTsFileRecoverPerformer recoverPerformer :
absolutePath2RecoverPerformer.values()) {
Callable<Void> recoverTsFileTask =
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/trigger/service/TriggerInformationUpdater.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/trigger/service/TriggerInformationUpdater.java
index 4371ea48dc1..dae446f8988 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/trigger/service/TriggerInformationUpdater.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/trigger/service/TriggerInformationUpdater.java
@@ -21,6 +21,7 @@ package org.apache.iotdb.db.trigger.service;
import org.apache.iotdb.commons.client.IClientManager;
import org.apache.iotdb.commons.concurrent.IoTDBThreadPoolFactory;
+import org.apache.iotdb.commons.concurrent.ThreadName;
import org.apache.iotdb.commons.concurrent.threadpool.ScheduledExecutorUtil;
import org.apache.iotdb.commons.consensus.ConfigRegionId;
import org.apache.iotdb.commons.exception.IoTDBException;
@@ -49,7 +50,7 @@ public class TriggerInformationUpdater {
private final ScheduledExecutorService triggerInformationUpdateExecutor =
IoTDBThreadPoolFactory.newSingleThreadScheduledExecutor(
- "Stateful-Trigger-Information-Updater");
+ ThreadName.STATEFUL_TRIGGER_INFORMATION_UPDATER.getName());
private Future<?> updateFuture;
diff --git
a/iotdb-core/metrics/interface/src/main/java/org/apache/iotdb/metrics/metricsets/cpu/CpuUsageMetrics.java
b/iotdb-core/metrics/interface/src/main/java/org/apache/iotdb/metrics/metricsets/cpu/CpuUsageMetrics.java
index e21ff0471c7..04f2e52daf9 100644
---
a/iotdb-core/metrics/interface/src/main/java/org/apache/iotdb/metrics/metricsets/cpu/CpuUsageMetrics.java
+++
b/iotdb-core/metrics/interface/src/main/java/org/apache/iotdb/metrics/metricsets/cpu/CpuUsageMetrics.java
@@ -26,6 +26,9 @@ import org.apache.iotdb.metrics.type.AutoGauge;
import org.apache.iotdb.metrics.utils.MetricLevel;
import org.apache.iotdb.metrics.utils.MetricType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.lang.management.ManagementFactory;
import java.lang.management.ThreadInfo;
import java.lang.management.ThreadMXBean;
@@ -39,6 +42,7 @@ import java.util.function.UnaryOperator;
import java.util.stream.Collectors;
public class CpuUsageMetrics implements IMetricSet {
+ private static final Logger logger =
LoggerFactory.getLogger(CpuUsageMetrics.class);
private static final String MODULE_CPU_USAGE = "module_cpu_usage";
private static final String POOL_CPU_USAGE = "pool_cpu_usage";
private static final String POOL = "pool";
@@ -62,6 +66,7 @@ public class CpuUsageMetrics implements IMetricSet {
AutoGauge processCpuLoadGauge = null;
private final ThreadMXBean threadMxBean =
ManagementFactory.getThreadMXBean();
private AtomicLong lastUpdateTime = new AtomicLong(0L);
+ private AtomicLong updateCount = new AtomicLong(0);
public CpuUsageMetrics(
List<String> modules,
@@ -170,6 +175,7 @@ public class CpuUsageMetrics implements IMetricSet {
if (!checkCpuMonitorEnable()) {
return;
}
+ final long startTime = System.nanoTime();
// update
long[] taskIds = threadMxBean.getAllThreadIds();
ThreadInfo[] threadInfos = threadMxBean.getThreadInfo(taskIds);
@@ -211,6 +217,9 @@ public class CpuUsageMetrics implements IMetricSet {
lastThreadCpuTime.putAll(currentThreadCpuTime);
lastThreadUserTime.clear();
lastThreadUserTime.putAll(currentThreadUserTime);
+ long timeCost = System.nanoTime() - startTime;
+ updateCount.incrementAndGet();
+ logger.debug("Time for update cpu usage is {} ns", timeCost);
}
private boolean checkCpuMonitorEnable() {
diff --git
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/concurrent/DataNodeThreadModule.java
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/concurrent/ThreadModule.java
similarity index 89%
rename from
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/concurrent/DataNodeThreadModule.java
rename to
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/concurrent/ThreadModule.java
index f0d61466497..b057e8dcdbe 100644
---
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/concurrent/DataNodeThreadModule.java
+++
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/concurrent/ThreadModule.java
@@ -19,7 +19,7 @@
package org.apache.iotdb.commons.concurrent;
-public enum DataNodeThreadModule {
+public enum ThreadModule {
QUERY,
MPP,
COMPACTION,
@@ -34,6 +34,13 @@ public enum DataNodeThreadModule {
JVM,
LOG_BACK,
METRICS,
+ RPC,
+ WRITE,
+ HEARTBEAT,
+ LOAD_BALANCE,
+ REGION_MANAGEMENT,
+ RECOVER,
+ PROCEDURE,
OTHER,
UNKNOWN
}
diff --git
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/concurrent/ThreadName.java
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/concurrent/ThreadName.java
index fbd56d6c82e..6464d6129a3 100644
---
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/concurrent/ThreadName.java
+++
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/concurrent/ThreadName.java
@@ -31,19 +31,19 @@ public enum ThreadName {
QUERY_WORKER("Query-Worker-Thread"),
QUERY_SENTINEL("Query-Sentinel-Thread"),
TIMED_QUERY_SQL_COUNT("Timed-Query-SQL-Count"),
- MPP_DATA_EXCHANGE_TASK_EXECUTOR("MPP-Data-Exchange-Task-Executors"),
FRAGMENT_INSTANCE_MANAGEMENT("Fragment-Instance-Management"),
FRAGMENT_INSTANCE_NOTIFICATION("Fragment-Instance-Notification"),
- DATANODE_INTERNAL_RPC_SERVICE("DataNodeInternalRPC-Service"),
- DATANODE_INTERNAL_RPC_PROCESSOR("DataNodeInternalRPC-Processor"),
DRIVER_TASK_SCHEDULER_NOTIFICATION("Driver-Task-Scheduler-Notification"),
// -------------------------- MPP --------------------------
MPP_COORDINATOR_SCHEDULED_EXECUTOR("MPP-Coordinator-Scheduled-Executor"),
-
+ MPP_DATA_EXCHANGE_TASK_EXECUTOR("MPP-Data-Exchange-Task-Executors"),
ASYNC_DATANODE_CLIENT_POOL("AsyncDataNodeInternalServiceClientPool"),
MPP_DATA_EXCHANGE_RPC_SERVICE("MPPDataExchangeRPC-Service"),
MPP_DATA_EXCHANGE_RPC_PROCESSOR("MPPDataExchangeRPC-Processor"),
MPP_COORDINATOR_EXECUTOR_POOL("MPP-Coordinator-Executor"),
+ DATANODE_INTERNAL_RPC_SERVICE("DataNodeInternalRPC-Service"),
+ DATANODE_INTERNAL_RPC_PROCESSOR("DataNodeInternalRPC-Processor"),
+ MPP_COORDINATOR_WRITE_EXECUTOR("MPP-Coordinator-Write-Executor"),
ASYNC_DATANODE_MPP_DATA_EXCHANGE_CLIENT_POOL("AsyncDataNodeMPPDataExchangeServiceClientPool"),
// -------------------------- Compaction --------------------------
@@ -55,8 +55,7 @@ public enum ThreadName {
WAL_SYNC("WAL-Sync"),
WAL_DELETE("WAL-Delete"),
WAL_RECOVER("WAL-Recover"),
- // -------------------------- Write --------------------------
- MPP_COORDINATOR_WRITE_EXECUTOR("MPP-Coordinator-Write-Executor"),
+ TSFILE_RECOVER("TsFile-Recover"),
// -------------------------- Flush --------------------------
FLUSH("Flush"),
FLUSH_SUB_TASK("Flush-SubTask"),
@@ -65,20 +64,39 @@ public enum ThreadName {
TIMED_FLUSH_UNSEQ_MEMTABLE("Timed-Flush-Unseq-Memtable"),
// -------------------------- SchemaEngine --------------------------
SCHEMA_REGION_RELEASE_PROCESSOR("SchemaRegion-Release-Task-Processor"),
+ SCHEMA_REGION_RECOVER_TASK("SchemaRegion-recover-task"),
SCHEMA_RELEASE_MONITOR("Schema-Release-Task-Monitor"),
SCHEMA_REGION_FLUSH_PROCESSOR("SchemaRegion-Flush-Task-Processor"),
SCHEMA_FLUSH_MONITOR("Schema-Flush-Task-Monitor"),
+ SCHEMA_FORCE_MLOG("SchemaEngine-TimedForceMLog-Thread"),
// -------------------------- ClientService --------------------------
CLIENT_RPC_SERVICE("ClientRPC-Service"),
CLIENT_RPC_PROCESSOR("ClientRPC-Processor"),
// -------------------------- ConfigNode-RPC --------------------------
CONFIGNODE_RPC_SERVICE("ConfigNodeRPC-Service"),
CONFIGNODE_RPC_PROCESSOR("ConfigNodeRPC-Processor"),
-
ASYNC_CONFIGNODE_HEARTBEAT_CLIENT_POOL("AsyncConfigNodeHeartbeatServiceClientPool"),
-
ASYNC_DATANODE_HEARTBEAT_CLIENT_POOL("AsyncDataNodeHeartbeatServiceClientPool"),
ASYNC_CONFIGNODE_CLIENT_POOL("AsyncConfigNodeIServiceClientPool"),
// -------------------------- ConfigNode-Query --------------------------
- CQ_MANAGER("CQ-Scheduler"),
+ CQ_SCHEDULER("CQ-Scheduler"),
+ // -------------------------- ConfigNode-Write --------------------------
+
CONFIG_NODE_SIMPLE_CONSENSUS_WAL_FLUSH("ConfigNode-Simple-Consensus-WAL-Flush-Thread"),
+ // -------------------------- ConfigNode-Heartbeat --------------------------
+ CONFIG_NODE_HEART_BEAT_SERVICE("Cluster-Heartbeat-Service"),
+
ASYNC_CONFIGNODE_HEARTBEAT_CLIENT_POOL("AsyncConfigNodeHeartbeatServiceClientPool"),
+
ASYNC_DATANODE_HEARTBEAT_CLIENT_POOL("AsyncDataNodeHeartbeatServiceClientPool"),
+ // -------------------------- ConfigNode-LoadBalance
--------------------------
+ CONFIG_NODE_LOAD_STATISTIC("Cluster-LoadStatistics-Service"),
+ // -------------------------- ConfigNode-RegionManagement
--------------------------
+ CONFIG_NODE_REGION_MAINTAINER("IoTDB-Region-Maintainer"),
+ // -------------------------- ConfigNode-Recover --------------------------
+ CONFIG_NODE_RECOVER("ConfigNode-Manager-Recovery"),
+ // -------------------------- ConfigNode-Procedure ------------------------
+ // TODO: Use Thread Pool to manage the procedure thread @Potato
+ CONFIG_NODE_PROCEDURE_WORKER("ProcedureWorkerGroup"),
+ CONFIG_NODE_TIMEOUT_EXECUTOR("ProcedureTimeoutExecutor"),
+ CONFIG_NODE_WORKER_THREAD_MONITOR("ProcedureWorkerThreadMonitor"),
+ CONFIG_NODE_RETRY_FAILED_TASK("Cluster-RetryFailedTasks-Service"),
+
// -------------------------- IoTConsensus --------------------------
IOT_CONSENSUS_RPC_SERVICE("IoTConsensusRPC-Service"),
IOT_CONSENSUS_RPC_PROCESSOR("IoTConsensusRPC-Processor"),
@@ -90,6 +108,7 @@ public enum ThreadName {
RAFT_SERVER_PROXY_EXECUTOR("\\d+-impl-thread"),
RAFT_SERVER_EXECUTOR("\\d+-server-thread"),
RAFT_SERVER_CLIENT_EXECUTOR("\\d+-client-thread"),
+ RATIS_ADD("Ratis-Add"),
SEGMENT_RAFT_WORKER("SegmentedRaftLogWorker"),
STATE_MACHINE_UPDATER("StateMachineUpdater"),
FOLLOWER_STATE("FollowerState"),
@@ -97,7 +116,7 @@ public enum ThreadName {
LEADER_ELECTION("LeaderElection"),
LOG_APPENDER("GrpcLogAppender"),
EVENT_PROCESSOR("EventProcessor"),
- RATIS_BG_DISK_GUARDIAN("ratis-bg-disk-guardian"),
+ RATIS_BG_DISK_GUARDIAN("RatisBgDiskGuardian"),
GRPC_DEFAULT_BOSS_ELG("grpc-default-boss-ELG"),
GRPC_DEFAULT_EXECUTOR("grpc-default-executor"),
GPRC_DEFAULT_WORKER_ELG("grpc-default-worker-ELG"),
@@ -112,6 +131,7 @@ public enum ThreadName {
PIPE_RUNTIME_PROCEDURE_SUBMITTER("Pipe-Runtime-Procedure-Submitter"),
PIPE_WAL_RESOURCE_TTL_CHECKER("Pipe-WAL-Resource-TTL-Checker"),
WINDOW_EVALUATION_SERVICE("WindowEvaluationTaskPoolManager"),
+ STATEFUL_TRIGGER_INFORMATION_UPDATER("Stateful-Trigger-Information-Updater"),
// -------------------------- JVM --------------------------
// NOTICE: The thread name of jvm cannot be edited here!
// We list the thread name here just for distinguishing what module the
thread belongs to.
@@ -135,8 +155,8 @@ public enum ThreadName {
// -------------------------- Metrics --------------------------
SYSTEM_SCHEDULE_METRICS("SystemScheduleMetrics"),
RESOURCE_CONTROL_DISK_STATISTIC("ResourceControl-DataRegionDiskStatistics"),
- PROMETHEUS_REACTOR_HTTP_NIO("reactor-http-nio"),
PROMETHEUS_REACTOR_HTTP_EPOLL("reactor-http-epoll"),
+ PROMETHEUS_REACTOR_HTTP_NIO("reactor-http-nio"),
PROMETHEUS_BOUNDED_ELASTIC("boundedElastic-evictor"),
// -------------------------- Other --------------------------
TTL_CHECK("TTL-CHECK"),
@@ -146,41 +166,44 @@ public enum ThreadName {
STORAGE_ENGINE_CACHED_POOL("StorageEngine"),
MLNODE_RPC_SERVICE("MLNodeRpc-Service"),
IOTDB_SHUTDOWN_HOOK("IoTDB-Shutdown-Hook"),
+ UPGRADE_TASK("UpgradeThread"),
+ REGION_MIGRATE("Region-Migrate-Pool"),
STORAGE_ENGINE_RECOVER_TRIGGER("StorageEngine-RecoverTrigger"),
// the unknown thread name is used for metrics
UNKOWN("UNKNOWN");
private final String name;
private static final Logger log = LoggerFactory.getLogger(ThreadName.class);
- private static Set<ThreadName> queryThreadNames =
+ private static final Set<ThreadName> queryThreadNames =
new HashSet<>(
Arrays.asList(
QUERY_WORKER,
QUERY_SENTINEL,
TIMED_QUERY_SQL_COUNT,
- MPP_DATA_EXCHANGE_TASK_EXECUTOR,
FRAGMENT_INSTANCE_MANAGEMENT,
FRAGMENT_INSTANCE_NOTIFICATION,
- DATANODE_INTERNAL_RPC_SERVICE,
- DATANODE_INTERNAL_RPC_PROCESSOR,
DRIVER_TASK_SCHEDULER_NOTIFICATION));
- private static Set<ThreadName> mppThreadNames =
+ private static final Set<ThreadName> mppThreadNames =
new HashSet<>(
Arrays.asList(
MPP_COORDINATOR_SCHEDULED_EXECUTOR,
+ MPP_DATA_EXCHANGE_TASK_EXECUTOR,
ASYNC_DATANODE_CLIENT_POOL,
- MPP_COORDINATOR_WRITE_EXECUTOR,
MPP_DATA_EXCHANGE_RPC_SERVICE,
MPP_DATA_EXCHANGE_RPC_PROCESSOR,
MPP_COORDINATOR_EXECUTOR_POOL,
+ DATANODE_INTERNAL_RPC_SERVICE,
+ DATANODE_INTERNAL_RPC_PROCESSOR,
+ MPP_COORDINATOR_WRITE_EXECUTOR,
ASYNC_DATANODE_MPP_DATA_EXCHANGE_CLIENT_POOL));
- private static Set<ThreadName> compactionThreadNames =
+ private static final Set<ThreadName> compactionThreadNames =
new HashSet<>(Arrays.asList(COMPACTION_WORKER, COMPACTION_SUB_TASK,
COMPACTION_SCHEDULE));
- private static Set<ThreadName> walThreadNames =
- new HashSet<>(Arrays.asList(WAL_DELETE, WAL_SERIALIZE, WAL_SYNC,
WAL_DELETE, WAL_RECOVER));
+ private static final Set<ThreadName> walThreadNames =
+ new HashSet<>(
+ Arrays.asList(WAL_SERIALIZE, WAL_SYNC, WAL_DELETE, WAL_RECOVER,
TSFILE_RECOVER));
- private static Set<ThreadName> flushThreadNames =
+ private static final Set<ThreadName> flushThreadNames =
new HashSet<>(
Arrays.asList(
FLUSH,
@@ -188,19 +211,20 @@ public enum ThreadName {
FLUSH_TASK_SUBMIT,
TIMED_FLUSH_SEQ_MEMTABLE,
TIMED_FLUSH_UNSEQ_MEMTABLE));
-
- private static Set<ThreadName> schemaEngineThreadNames =
+ private static final Set<ThreadName> schemaEngineThreadNames =
new HashSet<>(
Arrays.asList(
- SCHEMA_REGION_FLUSH_PROCESSOR,
- SCHEMA_RELEASE_MONITOR,
SCHEMA_REGION_RELEASE_PROCESSOR,
- SCHEMA_FLUSH_MONITOR));
+ SCHEMA_REGION_RECOVER_TASK,
+ SCHEMA_RELEASE_MONITOR,
+ SCHEMA_REGION_FLUSH_PROCESSOR,
+ SCHEMA_FLUSH_MONITOR,
+ SCHEMA_FORCE_MLOG));
- private static Set<ThreadName> clientServiceThreadNames =
+ private static final Set<ThreadName> clientServiceThreadNames =
new HashSet<>(Arrays.asList(CLIENT_RPC_SERVICE, CLIENT_RPC_PROCESSOR));
- private static Set<ThreadName> iotConsensusThrreadNames =
+ private static final Set<ThreadName> iotConsensusThreadNames =
new HashSet<>(
Arrays.asList(
IOT_CONSENSUS_RPC_SERVICE,
@@ -208,12 +232,13 @@ public enum ThreadName {
ASYNC_DATANODE_IOT_CONSENSUS_CLIENT_POOL,
LOG_DISPATCHER));
- private static Set<ThreadName> ratisThreadNames =
+ private static final Set<ThreadName> ratisThreadNames =
new HashSet<>(
Arrays.asList(
RAFT_SERVER_PROXY_EXECUTOR,
RAFT_SERVER_EXECUTOR,
RAFT_SERVER_CLIENT_EXECUTOR,
+ RATIS_ADD,
SEGMENT_RAFT_WORKER,
STATE_MACHINE_UPDATER,
FOLLOWER_STATE,
@@ -226,7 +251,7 @@ public enum ThreadName {
GPRC_DEFAULT_WORKER_ELG,
GRPC_DEFAULT_EXECUTOR,
GROUP_MANAGEMENT));
- private static Set<ThreadName> computeThreadNames =
+ private static final Set<ThreadName> computeThreadNames =
new HashSet<>(
Arrays.asList(
PIPE_ASSIGNER_EXECUTOR_POOL,
@@ -236,9 +261,10 @@ public enum ThreadName {
PIPE_RUNTIME_META_SYNCER,
PIPE_RUNTIME_PROCEDURE_SUBMITTER,
PIPE_WAL_RESOURCE_TTL_CHECKER,
- WINDOW_EVALUATION_SERVICE));
+ WINDOW_EVALUATION_SERVICE,
+ STATEFUL_TRIGGER_INFORMATION_UPDATER));
- private static Set<ThreadName> jvmThreadNames =
+ private static final Set<ThreadName> jvmThreadNames =
new HashSet<>(
Arrays.asList(
JVM_PAUSE_MONITOR,
@@ -256,16 +282,51 @@ public enum ThreadName {
SIGNAL_DISPATCHER,
DESTROY_JVM,
COMMON_CLEANER));
+ private static final Set<ThreadName> configNodeRpcThreadNames =
+ new HashSet<>(
+ Arrays.asList(
+ CONFIGNODE_RPC_SERVICE, CONFIGNODE_RPC_PROCESSOR,
ASYNC_CONFIGNODE_CLIENT_POOL));
+
+ private static final Set<ThreadName> configNodeQueryThreadNames =
+ new HashSet<>(Arrays.asList(CQ_SCHEDULER));
- private static Set<ThreadName> metricsThreadNames =
+ private static final Set<ThreadName> configNodeWriteThreadNames =
+ new HashSet<>(Arrays.asList(CONFIG_NODE_SIMPLE_CONSENSUS_WAL_FLUSH));
+
+ private static final Set<ThreadName> configNodeHeartbeatThreadNames =
+ new HashSet<>(
+ Arrays.asList(
+ CONFIG_NODE_HEART_BEAT_SERVICE,
+ ASYNC_CONFIGNODE_HEARTBEAT_CLIENT_POOL,
+ ASYNC_DATANODE_HEARTBEAT_CLIENT_POOL));
+
+ private static final Set<ThreadName> configNodeLoadBalanceThreadNames =
+ new HashSet<>(Arrays.asList(CONFIG_NODE_LOAD_STATISTIC));
+
+ private static final Set<ThreadName> configNodeRegionManagementThreadNames =
+ new HashSet<>(Arrays.asList(CONFIG_NODE_REGION_MAINTAINER));
+
+ private static final Set<ThreadName> configNodeRecoverThreadNames =
+ new HashSet<>(Arrays.asList(CONFIG_NODE_RECOVER));
+
+ private static final Set<ThreadName> configNodeProcedureThreadNames =
+ new HashSet<>(
+ Arrays.asList(
+ CONFIG_NODE_PROCEDURE_WORKER,
+ CONFIG_NODE_WORKER_THREAD_MONITOR,
+ CONFIG_NODE_TIMEOUT_EXECUTOR,
+ CONFIG_NODE_RETRY_FAILED_TASK));
+
+ private static final Set<ThreadName> metricsThreadNames =
new HashSet<>(
Arrays.asList(
SYSTEM_SCHEDULE_METRICS,
RESOURCE_CONTROL_DISK_STATISTIC,
+ PROMETHEUS_REACTOR_HTTP_EPOLL,
PROMETHEUS_REACTOR_HTTP_NIO,
PROMETHEUS_REACTOR_HTTP_EPOLL,
PROMETHEUS_BOUNDED_ELASTIC));
- private static Set<ThreadName> otherThreadNames =
+ private static final Set<ThreadName> otherThreadNames =
new HashSet<>(
Arrays.asList(
TTL_CHECK,
@@ -273,7 +334,61 @@ public enum ThreadName {
INFLUXDB_RPC_SERVICE,
INFLUXDB_RPC_PROCESSOR,
STORAGE_ENGINE_CACHED_POOL,
- MLNODE_RPC_SERVICE));
+ MLNODE_RPC_SERVICE,
+ IOTDB_SHUTDOWN_HOOK,
+ UPGRADE_TASK,
+ REGION_MIGRATE,
+ STORAGE_ENGINE_RECOVER_TRIGGER));
+
+ private static final Set<ThreadName>[] threadNameSetList =
+ new Set[] {
+ queryThreadNames,
+ mppThreadNames,
+ compactionThreadNames,
+ walThreadNames,
+ flushThreadNames,
+ schemaEngineThreadNames,
+ clientServiceThreadNames,
+ iotConsensusThreadNames,
+ ratisThreadNames,
+ computeThreadNames,
+ jvmThreadNames,
+ metricsThreadNames,
+ configNodeRpcThreadNames,
+ configNodeQueryThreadNames,
+ configNodeWriteThreadNames,
+ configNodeHeartbeatThreadNames,
+ configNodeLoadBalanceThreadNames,
+ configNodeRegionManagementThreadNames,
+ configNodeRecoverThreadNames,
+ configNodeProcedureThreadNames,
+ otherThreadNames
+ };
+
+ private static final ThreadModule[] modules =
+ new ThreadModule[] {
+ ThreadModule.QUERY,
+ ThreadModule.MPP,
+ ThreadModule.COMPACTION,
+ ThreadModule.WAL,
+ ThreadModule.FLUSH,
+ ThreadModule.SCHEMA_ENGINE,
+ ThreadModule.CLIENT_SERVICE,
+ ThreadModule.IOT_CONSENSUS,
+ ThreadModule.RATIS_CONSENSUS,
+ ThreadModule.COMPUTE,
+ ThreadModule.JVM,
+ ThreadModule.METRICS,
+ ThreadModule.RPC,
+ ThreadModule.QUERY,
+ ThreadModule.WRITE,
+ ThreadModule.HEARTBEAT,
+ ThreadModule.LOAD_BALANCE,
+ ThreadModule.REGION_MANAGEMENT,
+ ThreadModule.RECOVER,
+ ThreadModule.PROCEDURE,
+ ThreadModule.OTHER
+ };
ThreadName(String name) {
this.name = name;
@@ -283,54 +398,21 @@ public enum ThreadName {
return name;
}
- public static DataNodeThreadModule getModuleTheThreadBelongs(String
givenThreadName) {
- Set<ThreadName>[] threadNameSetList =
- new Set[] {
- queryThreadNames,
- mppThreadNames,
- compactionThreadNames,
- walThreadNames,
- flushThreadNames,
- schemaEngineThreadNames,
- clientServiceThreadNames,
- iotConsensusThrreadNames,
- ratisThreadNames,
- computeThreadNames,
- jvmThreadNames,
- metricsThreadNames,
- otherThreadNames
- };
- DataNodeThreadModule[] modules =
- new DataNodeThreadModule[] {
- DataNodeThreadModule.QUERY,
- DataNodeThreadModule.MPP,
- DataNodeThreadModule.COMPACTION,
- DataNodeThreadModule.WAL,
- DataNodeThreadModule.FLUSH,
- DataNodeThreadModule.SCHEMA_ENGINE,
- DataNodeThreadModule.CLIENT_SERVICE,
- DataNodeThreadModule.IOT_CONSENSUS,
- DataNodeThreadModule.RATIS_CONSENSUS,
- DataNodeThreadModule.COMPUTE,
- DataNodeThreadModule.JVM,
- DataNodeThreadModule.METRICS,
- DataNodeThreadModule.OTHER
- };
-
+ public static ThreadModule getModuleTheThreadBelongs(String givenThreadName)
{
for (int i = 0, length = modules.length; i < length; ++i) {
if (matchModuleWithThreadNames(threadNameSetList[i], modules[i],
givenThreadName) != null) {
return modules[i];
}
}
if (givenThreadName.contains(LOG_BACK.getName())) {
- return DataNodeThreadModule.LOG_BACK;
+ return ThreadModule.LOG_BACK;
}
- return DataNodeThreadModule.UNKNOWN;
+ return ThreadModule.UNKNOWN;
}
- private static DataNodeThreadModule matchModuleWithThreadNames(
- Set<ThreadName> threadNames, DataNodeThreadModule module, String
givenThreadName) {
+ private static ThreadModule matchModuleWithThreadNames(
+ Set<ThreadName> threadNames, ThreadModule module, String
givenThreadName) {
for (ThreadName threadName : threadNames) {
if (threadName.getName().contains("\\d")) {
if
(Pattern.compile(threadName.getName()).matcher(givenThreadName).find()) {
diff --git
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/service/ServiceType.java
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/service/ServiceType.java
index 3cfb617717d..5e43452898b 100644
---
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/service/ServiceType.java
+++
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/service/ServiceType.java
@@ -33,7 +33,6 @@ public enum ServiceType {
JVM_MEM_CONTROL_SERVICE("Memory Controller", "JvmMemControlService"),
AUTHORIZATION_SERVICE("Authorization ServerService", "AuthService"),
FILE_READER_MANAGER_SERVICE("File reader manager ServerService",
"FileReaderManagerService"),
- UPGRADE_SERVICE("UPGRADE DataService", "UpgradeService"),
SETTLE_SERVICE("SETTLE DataService", "SettleService"),
SYNC_RPC_SERVICE("Sync RPC ServerService", ""),
SYNC_SERVICE("Sync Service", "SyncService"),