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

apache / iotdb / #9867

18 Aug 2023 06:05AM UTC coverage: 48.003% (-0.08%) from 48.081%
#9867

push

travis_ci

web-flow
[To rel/1.2] [IOTDB-6115] Fix Limit & Offset push down doesn't take effect while there exist null value

103 of 103 new or added lines in 23 files covered. (100.0%)

79802 of 166243 relevant lines covered (48.0%)

0.48 hits per line

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

87.63
/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
  CONFIG_NODE_LOAD_PUBLISHER("Cluster-LoadStatistics-Publisher"),
1✔
90
  // -------------------------- ConfigNode-RegionManagement --------------------------
91
  CONFIG_NODE_REGION_MAINTAINER("IoTDB-Region-Maintainer"),
1✔
92
  // -------------------------- ConfigNode-Recover --------------------------
93
  CONFIG_NODE_RECOVER("ConfigNode-Manager-Recovery"),
1✔
94
  // -------------------------- ConfigNode-Procedure ------------------------
95
  // TODO: Use Thread Pool to manage the procedure thread @Potato
96
  CONFIG_NODE_PROCEDURE_WORKER("ProcedureWorkerGroup"),
1✔
97
  CONFIG_NODE_TIMEOUT_EXECUTOR("ProcedureTimeoutExecutor"),
1✔
98
  CONFIG_NODE_WORKER_THREAD_MONITOR("ProcedureWorkerThreadMonitor"),
1✔
99
  CONFIG_NODE_RETRY_FAILED_TASK("Cluster-RetryFailedTasks-Service"),
1✔
100

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

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

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

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

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

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

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

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

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

305
  private static final Set<ThreadName> configNodeWriteThreadNames =
1✔
306
      new HashSet<>(Arrays.asList(CONFIG_NODE_SIMPLE_CONSENSUS_WAL_FLUSH));
1✔
307

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

315
  private static final Set<ThreadName> configNodeLoadBalanceThreadNames =
1✔
316
      new HashSet<>(Arrays.asList(CONFIG_NODE_LOAD_STATISTIC, CONFIG_NODE_LOAD_PUBLISHER));
1✔
317

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

321
  private static final Set<ThreadName> configNodeRecoverThreadNames =
1✔
322
      new HashSet<>(Arrays.asList(CONFIG_NODE_RECOVER));
1✔
323

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

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

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

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

405
  ThreadName(String name) {
1✔
406
    this.name = name;
1✔
407
  }
1✔
408

409
  public String getName() {
410
    return name;
1✔
411
  }
412

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

423
    return ThreadModule.UNKNOWN;
×
424
  }
425

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

440
  public static ThreadName getThreadPoolTheThreadBelongs(String givenThreadName) {
441
    ThreadName[] threadNames = ThreadName.values();
×
442
    for (ThreadName threadName : threadNames) {
×
443
      String name = threadName.getName();
×
444
      if (name.contains("\\d")) {
×
445
        // regex pattern
446
        if (Pattern.compile(name).matcher(givenThreadName).find()) {
×
447
          return threadName;
×
448
        }
449
      } else {
450
        if (givenThreadName.contains(name)) {
×
451
          return threadName;
×
452
        }
453
      }
454
    }
455
    log.debug("Unknown thread name: {}", givenThreadName);
×
456
    return ThreadName.UNKOWN;
×
457
  }
458
}
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

© 2025 Coveralls, Inc