• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

apache / iotdb / #9770

pending completion
#9770

push

travis_ci

web-flow
[IOTDB-6101] Pipe: Support tsfile cascade transport  (#10795) (#10796)

Support tsfile cascade transport. For example, there are 3 iotdb clusters A, B and C. Now we can use pipe to transport tsfile from A to C (via B, A -> B -> C).

(cherry picked from commit b3a4bdf81)

5 of 5 new or added lines in 4 files covered. (100.0%)

79456 of 165675 relevant lines covered (47.96%)

0.48 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

87.5
/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/concurrent/ThreadName.java
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one
3
 * or more contributor license agreements.  See the NOTICE file
4
 * distributed with this work for additional information
5
 * regarding copyright ownership.  The ASF licenses this file
6
 * to you under the Apache License, Version 2.0 (the
7
 * "License"); you may not use this file except in compliance
8
 * with the License.  You may obtain a copy of the License at
9
 *
10
 *     http://www.apache.org/licenses/LICENSE-2.0
11
 *
12
 * Unless required by applicable law or agreed to in writing,
13
 * software distributed under the License is distributed on an
14
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
 * KIND, either express or implied.  See the License for the
16
 * specific language governing permissions and limitations
17
 * under the License.
18
 */
19
package org.apache.iotdb.commons.concurrent;
20

21
import org.slf4j.Logger;
22
import org.slf4j.LoggerFactory;
23

24
import java.util.Arrays;
25
import java.util.HashSet;
26
import java.util.Set;
27
import java.util.regex.Pattern;
28

29
public enum ThreadName {
1✔
30
  // -------------------------- QueryThread --------------------------
31
  QUERY_WORKER("Query-Worker-Thread"),
1✔
32
  QUERY_SENTINEL("Query-Sentinel-Thread"),
1✔
33
  TIMED_QUERY_SQL_COUNT("Timed-Query-SQL-Count"),
1✔
34
  FRAGMENT_INSTANCE_MANAGEMENT("Fragment-Instance-Management"),
1✔
35
  FRAGMENT_INSTANCE_NOTIFICATION("Fragment-Instance-Notification"),
1✔
36
  DRIVER_TASK_SCHEDULER_NOTIFICATION("Driver-Task-Scheduler-Notification"),
1✔
37
  // -------------------------- MPP --------------------------
38
  MPP_COORDINATOR_SCHEDULED_EXECUTOR("MPP-Coordinator-Scheduled-Executor"),
1✔
39
  MPP_DATA_EXCHANGE_TASK_EXECUTOR("MPP-Data-Exchange-Task-Executors"),
1✔
40
  ASYNC_DATANODE_CLIENT_POOL("AsyncDataNodeInternalServiceClientPool"),
1✔
41
  MPP_DATA_EXCHANGE_RPC_SERVICE("MPPDataExchangeRPC-Service"),
1✔
42
  MPP_DATA_EXCHANGE_RPC_PROCESSOR("MPPDataExchangeRPC-Processor"),
1✔
43
  MPP_COORDINATOR_EXECUTOR_POOL("MPP-Coordinator-Executor"),
1✔
44
  DATANODE_INTERNAL_RPC_SERVICE("DataNodeInternalRPC-Service"),
1✔
45
  DATANODE_INTERNAL_RPC_PROCESSOR("DataNodeInternalRPC-Processor"),
1✔
46
  MPP_COORDINATOR_WRITE_EXECUTOR("MPP-Coordinator-Write-Executor"),
1✔
47
  ASYNC_DATANODE_MPP_DATA_EXCHANGE_CLIENT_POOL("AsyncDataNodeMPPDataExchangeServiceClientPool"),
1✔
48

49
  // -------------------------- Compaction --------------------------
50
  COMPACTION_WORKER("Compaction-Worker"),
1✔
51
  COMPACTION_SUB_TASK("Compaction-Sub-Task"),
1✔
52
  COMPACTION_SCHEDULE("Compaction-Schedule"),
1✔
53
  // -------------------------- Wal --------------------------
54
  WAL_SERIALIZE("WAL-Serialize"),
1✔
55
  WAL_SYNC("WAL-Sync"),
1✔
56
  WAL_DELETE("WAL-Delete"),
1✔
57
  WAL_RECOVER("WAL-Recover"),
1✔
58
  TSFILE_RECOVER("TsFile-Recover"),
1✔
59
  // -------------------------- Flush --------------------------
60
  FLUSH("Flush"),
1✔
61
  FLUSH_SUB_TASK("Flush-SubTask"),
1✔
62
  FLUSH_TASK_SUBMIT("FlushTask-Submit-Pool"),
1✔
63
  TIMED_FLUSH_SEQ_MEMTABLE("Timed-Flush-Seq-Memtable"),
1✔
64
  TIMED_FLUSH_UNSEQ_MEMTABLE("Timed-Flush-Unseq-Memtable"),
1✔
65
  // -------------------------- SchemaEngine --------------------------
66
  SCHEMA_REGION_RELEASE_PROCESSOR("SchemaRegion-Release-Task-Processor"),
1✔
67
  SCHEMA_REGION_RECOVER_TASK("SchemaRegion-recover-task"),
1✔
68
  SCHEMA_RELEASE_MONITOR("Schema-Release-Task-Monitor"),
1✔
69
  SCHEMA_REGION_FLUSH_PROCESSOR("SchemaRegion-Flush-Task-Processor"),
1✔
70
  SCHEMA_FLUSH_MONITOR("Schema-Flush-Task-Monitor"),
1✔
71
  SCHEMA_FORCE_MLOG("SchemaEngine-TimedForceMLog-Thread"),
1✔
72
  // -------------------------- ClientService --------------------------
73
  CLIENT_RPC_SERVICE("ClientRPC-Service"),
1✔
74
  CLIENT_RPC_PROCESSOR("ClientRPC-Processor"),
1✔
75
  // -------------------------- ConfigNode-RPC --------------------------
76
  CONFIGNODE_RPC_SERVICE("ConfigNodeRPC-Service"),
1✔
77
  CONFIGNODE_RPC_PROCESSOR("ConfigNodeRPC-Processor"),
1✔
78
  ASYNC_CONFIGNODE_CLIENT_POOL("AsyncConfigNodeIServiceClientPool"),
1✔
79
  // -------------------------- ConfigNode-Query --------------------------
80
  CQ_SCHEDULER("CQ-Scheduler"),
1✔
81
  // -------------------------- ConfigNode-Write --------------------------
82
  CONFIG_NODE_SIMPLE_CONSENSUS_WAL_FLUSH("ConfigNode-Simple-Consensus-WAL-Flush-Thread"),
1✔
83
  // -------------------------- ConfigNode-Heartbeat --------------------------
84
  CONFIG_NODE_HEART_BEAT_SERVICE("Cluster-Heartbeat-Service"),
1✔
85
  ASYNC_CONFIGNODE_HEARTBEAT_CLIENT_POOL("AsyncConfigNodeHeartbeatServiceClientPool"),
1✔
86
  ASYNC_DATANODE_HEARTBEAT_CLIENT_POOL("AsyncDataNodeHeartbeatServiceClientPool"),
1✔
87
  // -------------------------- ConfigNode-LoadBalance --------------------------
88
  CONFIG_NODE_LOAD_STATISTIC("Cluster-LoadStatistics-Service"),
1✔
89
  // -------------------------- ConfigNode-RegionManagement --------------------------
90
  CONFIG_NODE_REGION_MAINTAINER("IoTDB-Region-Maintainer"),
1✔
91
  // -------------------------- ConfigNode-Recover --------------------------
92
  CONFIG_NODE_RECOVER("ConfigNode-Manager-Recovery"),
1✔
93
  // -------------------------- ConfigNode-Procedure ------------------------
94
  // TODO: Use Thread Pool to manage the procedure thread @Potato
95
  CONFIG_NODE_PROCEDURE_WORKER("ProcedureWorkerGroup"),
1✔
96
  CONFIG_NODE_TIMEOUT_EXECUTOR("ProcedureTimeoutExecutor"),
1✔
97
  CONFIG_NODE_WORKER_THREAD_MONITOR("ProcedureWorkerThreadMonitor"),
1✔
98
  CONFIG_NODE_RETRY_FAILED_TASK("Cluster-RetryFailedTasks-Service"),
1✔
99

100
  // -------------------------- IoTConsensus --------------------------
101
  IOT_CONSENSUS_RPC_SERVICE("IoTConsensusRPC-Service"),
1✔
102
  IOT_CONSENSUS_RPC_PROCESSOR("IoTConsensusRPC-Processor"),
1✔
103
  ASYNC_DATANODE_IOT_CONSENSUS_CLIENT_POOL("AsyncDataNodeIoTConsensusServiceClientPool"),
1✔
104
  LOG_DISPATCHER("LogDispatcher"),
1✔
105
  // -------------------------- Ratis --------------------------
106
  // NOTICE: The thread name of ratis cannot be edited here!
107
  // We list the thread name here just for distinguishing what module the thread belongs to.
108
  RAFT_SERVER_PROXY_EXECUTOR("\\d+-impl-thread"),
1✔
109
  RAFT_SERVER_EXECUTOR("\\d+-server-thread"),
1✔
110
  RAFT_SERVER_CLIENT_EXECUTOR("\\d+-client-thread"),
1✔
111
  RATIS_ADD("Ratis-Add"),
1✔
112
  SEGMENT_RAFT_WORKER("SegmentedRaftLogWorker"),
1✔
113
  STATE_MACHINE_UPDATER("StateMachineUpdater"),
1✔
114
  FOLLOWER_STATE("FollowerState"),
1✔
115
  LEADER_STATE_IMPL_PROCESSOR("LeaderStateImpl"),
1✔
116
  LEADER_ELECTION("LeaderElection"),
1✔
117
  LOG_APPENDER("GrpcLogAppender"),
1✔
118
  EVENT_PROCESSOR("EventProcessor"),
1✔
119
  RATIS_BG_DISK_GUARDIAN("RatisBgDiskGuardian"),
1✔
120
  GRPC_DEFAULT_BOSS_ELG("grpc-default-boss-ELG"),
1✔
121
  GRPC_DEFAULT_EXECUTOR("grpc-default-executor"),
1✔
122
  GPRC_DEFAULT_WORKER_ELG("grpc-default-worker-ELG"),
1✔
123
  GROUP_MANAGEMENT("groupManagement"),
1✔
124
  // -------------------------- Compute --------------------------
125
  PIPE_EXTRACTOR_DISRUPTOR("Pipe-Extractor-Disruptor"),
1✔
126
  PIPE_ASSIGNER_EXECUTOR_POOL("Pipe-Assigner-Executor-Pool"),
1✔
127
  PIPE_PROCESSOR_EXECUTOR_POOL("Pipe-Processor-Executor-Pool"),
1✔
128
  PIPE_CONNECTOR_EXECUTOR_POOL("Pipe-Connector-Executor-Pool"),
1✔
129
  PIPE_SUBTASK_CALLBACK_EXECUTOR_POOL("Pipe-SubTask-Callback-Executor-Pool"),
1✔
130
  PIPE_RUNTIME_META_SYNCER("Pipe-Runtime-Meta-Syncer"),
1✔
131
  PIPE_RUNTIME_HEARTBEAT("Pipe-Runtime-Heartbeat"),
1✔
132
  PIPE_RUNTIME_PROCEDURE_SUBMITTER("Pipe-Runtime-Procedure-Submitter"),
1✔
133
  PIPE_ASYNC_CONNECTOR_CLIENT_POOL("Pipe-Async-Connector-Client-Pool"),
1✔
134
  PIPE_ASYNC_CONNECTOR_RETRY_TRIGGER("Pipe-Async-Connector-Retry-Trigger"),
1✔
135
  PIPE_WAL_RESOURCE_TTL_CHECKER("Pipe-WAL-Resource-TTL-Checker"),
1✔
136
  WINDOW_EVALUATION_SERVICE("WindowEvaluationTaskPoolManager"),
1✔
137
  STATEFUL_TRIGGER_INFORMATION_UPDATER("Stateful-Trigger-Information-Updater"),
1✔
138
  // -------------------------- JVM --------------------------
139
  // NOTICE: The thread name of jvm cannot be edited here!
140
  // We list the thread name here just for distinguishing what module the thread belongs to.
141
  JVM_PAUSE_MONITOR("JvmPauseMonitor"),
1✔
142
  JVM_GC_STATISTICS_MONITOR("JVM-GC-Statistics-Monitor"),
1✔
143
  PARALLEL_GC("GC task thread"),
1✔
144
  G1_GC("GC Thread"),
1✔
145
  G1_MAIN_MARKER("G1 Main Marker"),
1✔
146
  G1_CONC("G1 Conc"),
1✔
147
  G1_REFINE("G1 Refine"),
1✔
148
  G1_YOUNG_REMSET_SAMPLING("G1 Young RemSet Sampling"),
1✔
149
  COMPILE("CompilerThread"),
1✔
150
  VM_PERIODIC_TASK("VM Periodic Task Thread"),
1✔
151
  VM_THREAD("VM Thread"),
1✔
152
  REFERENCE_HANDLER("Reference Handler"),
1✔
153
  FINALIZER("Finalizer"),
1✔
154
  SIGNAL_DISPATCHER("Signal Dispatcher"),
1✔
155
  DESTROY_JVM("DestroyJavaVM"),
1✔
156
  COMMON_CLEANER("Common-Cleaner"),
1✔
157
  // -------------------------- LogThread --------------------------
158
  LOG_BACK("logback"),
1✔
159
  // -------------------------- Metrics --------------------------
160
  SYSTEM_SCHEDULE_METRICS("SystemScheduleMetrics"),
1✔
161
  RESOURCE_CONTROL_DISK_STATISTIC("ResourceControl-DataRegionDiskStatistics"),
1✔
162
  PROMETHEUS_REACTOR_HTTP_EPOLL("reactor-http-epoll"),
1✔
163
  PROMETHEUS_REACTOR_HTTP_NIO("reactor-http-nio"),
1✔
164
  PROMETHEUS_BOUNDED_ELASTIC("boundedElastic-evictor"),
1✔
165
  // -------------------------- Other --------------------------
166
  TTL_CHECK("TTL-CHECK"),
1✔
167
  SETTLE("Settle"),
1✔
168
  INFLUXDB_RPC_SERVICE("InfluxdbRPC-Service"),
1✔
169
  INFLUXDB_RPC_PROCESSOR("InfluxdbRPC-Processor"),
1✔
170
  STORAGE_ENGINE_CACHED_POOL("StorageEngine"),
1✔
171
  MLNODE_RPC_SERVICE("MLNodeRpc-Service"),
1✔
172
  IOTDB_SHUTDOWN_HOOK("IoTDB-Shutdown-Hook"),
1✔
173
  UPGRADE_TASK("UpgradeThread"),
1✔
174
  REGION_MIGRATE("Region-Migrate-Pool"),
1✔
175
  STORAGE_ENGINE_RECOVER_TRIGGER("StorageEngine-RecoverTrigger"),
1✔
176
  // the unknown thread name is used for metrics
177
  UNKOWN("UNKNOWN");
1✔
178

179
  private final String name;
180
  private static final Logger log = LoggerFactory.getLogger(ThreadName.class);
1✔
181
  private static final Set<ThreadName> queryThreadNames =
1✔
182
      new HashSet<>(
183
          Arrays.asList(
1✔
184
              QUERY_WORKER,
185
              QUERY_SENTINEL,
186
              TIMED_QUERY_SQL_COUNT,
187
              FRAGMENT_INSTANCE_MANAGEMENT,
188
              FRAGMENT_INSTANCE_NOTIFICATION,
189
              DRIVER_TASK_SCHEDULER_NOTIFICATION));
190
  private static final Set<ThreadName> mppThreadNames =
1✔
191
      new HashSet<>(
192
          Arrays.asList(
1✔
193
              MPP_COORDINATOR_SCHEDULED_EXECUTOR,
194
              MPP_DATA_EXCHANGE_TASK_EXECUTOR,
195
              ASYNC_DATANODE_CLIENT_POOL,
196
              MPP_DATA_EXCHANGE_RPC_SERVICE,
197
              MPP_DATA_EXCHANGE_RPC_PROCESSOR,
198
              MPP_COORDINATOR_EXECUTOR_POOL,
199
              DATANODE_INTERNAL_RPC_SERVICE,
200
              DATANODE_INTERNAL_RPC_PROCESSOR,
201
              MPP_COORDINATOR_WRITE_EXECUTOR,
202
              ASYNC_DATANODE_MPP_DATA_EXCHANGE_CLIENT_POOL));
203
  private static final Set<ThreadName> compactionThreadNames =
1✔
204
      new HashSet<>(Arrays.asList(COMPACTION_WORKER, COMPACTION_SUB_TASK, COMPACTION_SCHEDULE));
1✔
205

206
  private static final Set<ThreadName> walThreadNames =
1✔
207
      new HashSet<>(
208
          Arrays.asList(WAL_SERIALIZE, WAL_SYNC, WAL_DELETE, WAL_RECOVER, TSFILE_RECOVER));
1✔
209

210
  private static final Set<ThreadName> flushThreadNames =
1✔
211
      new HashSet<>(
212
          Arrays.asList(
1✔
213
              FLUSH,
214
              FLUSH_SUB_TASK,
215
              FLUSH_TASK_SUBMIT,
216
              TIMED_FLUSH_SEQ_MEMTABLE,
217
              TIMED_FLUSH_UNSEQ_MEMTABLE));
218
  private static final Set<ThreadName> schemaEngineThreadNames =
1✔
219
      new HashSet<>(
220
          Arrays.asList(
1✔
221
              SCHEMA_REGION_RELEASE_PROCESSOR,
222
              SCHEMA_REGION_RECOVER_TASK,
223
              SCHEMA_RELEASE_MONITOR,
224
              SCHEMA_REGION_FLUSH_PROCESSOR,
225
              SCHEMA_FLUSH_MONITOR,
226
              SCHEMA_FORCE_MLOG));
227

228
  private static final Set<ThreadName> clientServiceThreadNames =
1✔
229
      new HashSet<>(Arrays.asList(CLIENT_RPC_SERVICE, CLIENT_RPC_PROCESSOR));
1✔
230

231
  private static final Set<ThreadName> iotConsensusThreadNames =
1✔
232
      new HashSet<>(
233
          Arrays.asList(
1✔
234
              IOT_CONSENSUS_RPC_SERVICE,
235
              IOT_CONSENSUS_RPC_PROCESSOR,
236
              ASYNC_DATANODE_IOT_CONSENSUS_CLIENT_POOL,
237
              LOG_DISPATCHER));
238

239
  private static final Set<ThreadName> ratisThreadNames =
1✔
240
      new HashSet<>(
241
          Arrays.asList(
1✔
242
              RAFT_SERVER_PROXY_EXECUTOR,
243
              RAFT_SERVER_EXECUTOR,
244
              RAFT_SERVER_CLIENT_EXECUTOR,
245
              RATIS_ADD,
246
              SEGMENT_RAFT_WORKER,
247
              STATE_MACHINE_UPDATER,
248
              FOLLOWER_STATE,
249
              LEADER_STATE_IMPL_PROCESSOR,
250
              LEADER_ELECTION,
251
              LOG_APPENDER,
252
              EVENT_PROCESSOR,
253
              RATIS_BG_DISK_GUARDIAN,
254
              GRPC_DEFAULT_BOSS_ELG,
255
              GPRC_DEFAULT_WORKER_ELG,
256
              GRPC_DEFAULT_EXECUTOR,
257
              GROUP_MANAGEMENT));
258
  private static final Set<ThreadName> computeThreadNames =
1✔
259
      new HashSet<>(
260
          Arrays.asList(
1✔
261
              PIPE_EXTRACTOR_DISRUPTOR,
262
              PIPE_ASSIGNER_EXECUTOR_POOL,
263
              PIPE_PROCESSOR_EXECUTOR_POOL,
264
              PIPE_CONNECTOR_EXECUTOR_POOL,
265
              PIPE_SUBTASK_CALLBACK_EXECUTOR_POOL,
266
              PIPE_RUNTIME_META_SYNCER,
267
              PIPE_RUNTIME_HEARTBEAT,
268
              PIPE_RUNTIME_PROCEDURE_SUBMITTER,
269
              PIPE_ASYNC_CONNECTOR_CLIENT_POOL,
270
              PIPE_ASYNC_CONNECTOR_RETRY_TRIGGER,
271
              PIPE_WAL_RESOURCE_TTL_CHECKER,
272
              WINDOW_EVALUATION_SERVICE,
273
              STATEFUL_TRIGGER_INFORMATION_UPDATER));
274

275
  private static final Set<ThreadName> jvmThreadNames =
1✔
276
      new HashSet<>(
277
          Arrays.asList(
1✔
278
              JVM_PAUSE_MONITOR,
279
              JVM_GC_STATISTICS_MONITOR,
280
              PARALLEL_GC,
281
              G1_GC,
282
              G1_MAIN_MARKER,
283
              G1_REFINE,
284
              G1_CONC,
285
              G1_YOUNG_REMSET_SAMPLING,
286
              COMPILE,
287
              VM_PERIODIC_TASK,
288
              VM_THREAD,
289
              REFERENCE_HANDLER,
290
              FINALIZER,
291
              SIGNAL_DISPATCHER,
292
              DESTROY_JVM,
293
              COMMON_CLEANER));
294
  private static final Set<ThreadName> configNodeRpcThreadNames =
1✔
295
      new HashSet<>(
296
          Arrays.asList(
1✔
297
              CONFIGNODE_RPC_SERVICE, CONFIGNODE_RPC_PROCESSOR, ASYNC_CONFIGNODE_CLIENT_POOL));
298

299
  private static final Set<ThreadName> configNodeQueryThreadNames =
1✔
300
      new HashSet<>(Arrays.asList(CQ_SCHEDULER));
1✔
301

302
  private static final Set<ThreadName> configNodeWriteThreadNames =
1✔
303
      new HashSet<>(Arrays.asList(CONFIG_NODE_SIMPLE_CONSENSUS_WAL_FLUSH));
1✔
304

305
  private static final Set<ThreadName> configNodeHeartbeatThreadNames =
1✔
306
      new HashSet<>(
307
          Arrays.asList(
1✔
308
              CONFIG_NODE_HEART_BEAT_SERVICE,
309
              ASYNC_CONFIGNODE_HEARTBEAT_CLIENT_POOL,
310
              ASYNC_DATANODE_HEARTBEAT_CLIENT_POOL));
311

312
  private static final Set<ThreadName> configNodeLoadBalanceThreadNames =
1✔
313
      new HashSet<>(Arrays.asList(CONFIG_NODE_LOAD_STATISTIC));
1✔
314

315
  private static final Set<ThreadName> configNodeRegionManagementThreadNames =
1✔
316
      new HashSet<>(Arrays.asList(CONFIG_NODE_REGION_MAINTAINER));
1✔
317

318
  private static final Set<ThreadName> configNodeRecoverThreadNames =
1✔
319
      new HashSet<>(Arrays.asList(CONFIG_NODE_RECOVER));
1✔
320

321
  private static final Set<ThreadName> configNodeProcedureThreadNames =
1✔
322
      new HashSet<>(
323
          Arrays.asList(
1✔
324
              CONFIG_NODE_PROCEDURE_WORKER,
325
              CONFIG_NODE_WORKER_THREAD_MONITOR,
326
              CONFIG_NODE_TIMEOUT_EXECUTOR,
327
              CONFIG_NODE_RETRY_FAILED_TASK));
328

329
  private static final Set<ThreadName> metricsThreadNames =
1✔
330
      new HashSet<>(
331
          Arrays.asList(
1✔
332
              SYSTEM_SCHEDULE_METRICS,
333
              RESOURCE_CONTROL_DISK_STATISTIC,
334
              PROMETHEUS_REACTOR_HTTP_EPOLL,
335
              PROMETHEUS_REACTOR_HTTP_NIO,
336
              PROMETHEUS_REACTOR_HTTP_EPOLL,
337
              PROMETHEUS_BOUNDED_ELASTIC));
338
  private static final Set<ThreadName> otherThreadNames =
1✔
339
      new HashSet<>(
340
          Arrays.asList(
1✔
341
              TTL_CHECK,
342
              SETTLE,
343
              INFLUXDB_RPC_SERVICE,
344
              INFLUXDB_RPC_PROCESSOR,
345
              STORAGE_ENGINE_CACHED_POOL,
346
              MLNODE_RPC_SERVICE,
347
              IOTDB_SHUTDOWN_HOOK,
348
              UPGRADE_TASK,
349
              REGION_MIGRATE,
350
              STORAGE_ENGINE_RECOVER_TRIGGER));
351

352
  private static final Set<ThreadName>[] threadNameSetList =
1✔
353
      new Set[] {
354
        queryThreadNames,
355
        mppThreadNames,
356
        compactionThreadNames,
357
        walThreadNames,
358
        flushThreadNames,
359
        schemaEngineThreadNames,
360
        clientServiceThreadNames,
361
        iotConsensusThreadNames,
362
        ratisThreadNames,
363
        computeThreadNames,
364
        jvmThreadNames,
365
        metricsThreadNames,
366
        configNodeRpcThreadNames,
367
        configNodeQueryThreadNames,
368
        configNodeWriteThreadNames,
369
        configNodeHeartbeatThreadNames,
370
        configNodeLoadBalanceThreadNames,
371
        configNodeRegionManagementThreadNames,
372
        configNodeRecoverThreadNames,
373
        configNodeProcedureThreadNames,
374
        otherThreadNames
375
      };
376

377
  private static final ThreadModule[] modules =
1✔
378
      new ThreadModule[] {
379
        ThreadModule.QUERY,
380
        ThreadModule.MPP,
381
        ThreadModule.COMPACTION,
382
        ThreadModule.WAL,
383
        ThreadModule.FLUSH,
384
        ThreadModule.SCHEMA_ENGINE,
385
        ThreadModule.CLIENT_SERVICE,
386
        ThreadModule.IOT_CONSENSUS,
387
        ThreadModule.RATIS_CONSENSUS,
388
        ThreadModule.COMPUTE,
389
        ThreadModule.JVM,
390
        ThreadModule.METRICS,
391
        ThreadModule.RPC,
392
        ThreadModule.QUERY,
393
        ThreadModule.WRITE,
394
        ThreadModule.HEARTBEAT,
395
        ThreadModule.LOAD_BALANCE,
396
        ThreadModule.REGION_MANAGEMENT,
397
        ThreadModule.RECOVER,
398
        ThreadModule.PROCEDURE,
399
        ThreadModule.OTHER
400
      };
401

402
  ThreadName(String name) {
1✔
403
    this.name = name;
1✔
404
  }
1✔
405

406
  public String getName() {
407
    return name;
1✔
408
  }
409

410
  public static ThreadModule getModuleTheThreadBelongs(String givenThreadName) {
411
    for (int i = 0, length = modules.length; i < length; ++i) {
×
412
      if (matchModuleWithThreadNames(threadNameSetList[i], modules[i], givenThreadName) != null) {
×
413
        return modules[i];
×
414
      }
415
    }
416
    if (givenThreadName.contains(LOG_BACK.getName())) {
×
417
      return ThreadModule.LOG_BACK;
×
418
    }
419

420
    return ThreadModule.UNKNOWN;
×
421
  }
422

423
  private static ThreadModule matchModuleWithThreadNames(
424
      Set<ThreadName> threadNames, ThreadModule module, String givenThreadName) {
425
    for (ThreadName threadName : threadNames) {
×
426
      if (threadName.getName().contains("\\d")) {
×
427
        if (Pattern.compile(threadName.getName()).matcher(givenThreadName).find()) {
×
428
          return module;
×
429
        }
430
      } else if (givenThreadName.contains(threadName.getName())) {
×
431
        return module;
×
432
      }
433
    }
×
434
    return null;
×
435
  }
436

437
  public static ThreadName getThreadPoolTheThreadBelongs(String givenThreadName) {
438
    ThreadName[] threadNames = ThreadName.values();
×
439
    for (ThreadName threadName : threadNames) {
×
440
      String name = threadName.getName();
×
441
      if (name.contains("\\d")) {
×
442
        // regex pattern
443
        if (Pattern.compile(name).matcher(givenThreadName).find()) {
×
444
          return threadName;
×
445
        }
446
      } else {
447
        if (givenThreadName.contains(name)) {
×
448
          return threadName;
×
449
        }
450
      }
451
    }
452
    log.debug("Unknown thread name: {}", givenThreadName);
×
453
    return ThreadName.UNKOWN;
×
454
  }
455
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc