This topic introduces some background threads of OceanBase Database and their features. In most cases, you do not need to understand how these threads are implemented.
Background threads
Background threads are optimized along with the iteration of OceanBase Database. Some background threads may be eliminated or merged, and other background threads may be created in later versions.
| Thread | Module | Thread quantity | Purpose |
|---|---|---|---|
| TsMgr | Trx | 1 | Refreshes the local GTS cache. |
| WeakReadSvr | Trx | 1 | Calculates the local server-level read timestamp of the standby IDC. |
| HAGtsSource | Trx | 1 | Refreshes ha_gts. The refresh frequency is determined by the gts_refresh_interval parameter. |
| GCPartAdpt | Trx | 1 | Regularly checks the all_tenant_gc_partition_info table to obtain the garbage collection (GC) information of partitions. The thread helps facilitate the GC and two-phase commit of transactions. |
| PartWorker | Trx | 1 | Traverses all partitions on the local OBServer node and performs the following operations:
|
| LockWaitMgr | Trx | 1 | Wakes up the threads in the wait lock queue in hotspot row scenarios, such as statement timeout and session kill. |
| ClogAdapter | Trx | 8 | Asynchronously commits clogs at the transaction layer. |
| ObTransService | Trx | 6 | Performs the following operations:
|
| GCCollector | Storage | 1 | Regularly checks whether GC operation can be performed on all partitions on the local OBServer nodes. If yes, triggers a GC operation. |
| RebuildSche | Storage | 1 | Regularly drives partition tasks that need to be rebuilt. |
| PurgeWorker | Storage | 1 | Deletes MemTable labels in the background. |
| DAG | Storage | 16 | The worker thread of dag, which is used to run tasks such as the minor compactions, major compactions, and migration of partitions. |
| DagScheduler | Storage | 1 | The scheduling thread of dag. |
| STableChecksumUp | Storage | 1 | Batch commits SSTable checksum tasks. |
| PartitionScheduler | Storage | 2 | Schedules minor compaction and major compaction tasks. |
| MemstoreGC | Storage | 1 | Recycles the frozen MemStore after a warm-up for minor compactions. |
| ObStoreFile | Storage | 1 | Checks for bad macroblocks and recycles macroblocks. |
| PartSerCb | Storage | 40 | Schedules 20 threads to handle the switchover of a partition leader. |
| ObPartitionSplit Worker | Storage | 1 | Splits a partition in the background. |
| FreezeTimer | Storage | 1 | Checks the MemStore memory and triggers a freezing task. |
| RebuildTask | Storage | 1 | Schedules the D replica to pull data. |
| IndexSche | Storage | 1 | Schedules the index creation task. |
| FreInfoReload | Storage | 1 | Synchronizes major freeze information in internal tables. |
| TableMgrGC | Storage | 1 | Recycles MemTable to release memory. |
| BackupInfoUpdate | Storage | 1 | Regularly refreshes backup data. |
| LogDiskMon | Storage | 1 | Detects the multiple disks of the system. |
| KVCacheWash | Storage | 1 | Cleans the memory of KVCache. The detection interval is determined by the _cache_wash_interval parameter. Default value: 200ms. Value range: [1ms,1m]. |
| KVCacheRep | Storage | 1 | Manages memory fragments of the cache to recycle memory. The detection interval is determined by the _cache_wash_interval parameter. Default value: 200ms. Value range: [1ms,1m]. |
| RSMonitor | RS | 1 | Monitors the status of the current RootService. |
| CacheCalculator | RS | 1 | Reserves memory for location_cache and schema_cache. |
| ObDailyMergeScheduler | RS | 1 | Schedules major compaction tasks. |
| ObEmptyServerChecker | RS | 1 | Detects whether an OBServer node has replicas. |
| ObFetchPrimaryDDLOperator | RS | 1 | Synchronizes the logic of the standby database to the schema of the sys tenant of the primary database. |
| ObFreezeInfoUpdater | RS | 1 | Speeds up the progress of freeze and manages the snapshot recovery points. |
| ObGlobalIndexBuilder | RS | 1 | Schedules the creation of global indexes. |
| ObGlobalMaxDecidedTransVersionMgr | RS | 1 | Collects the statistics of the versions of global maximum transactions. |
| ObLeaderCoordinator | RS | 1 | Manages the distribution of leader replicas in a cluster. |
| ObLogArchiveScheduler | RS | 1 | Archives the log files. |
| ObMajorFreezeLauncher | RS | 1 | Launches scheduled major compaction tasks daily. |
| ObPartitionSpliter | RS | 1 | Schedules the compaction of partitions. |
| ObRebalanceTaskMgr | RS | 1 | Schedules the execution of load balancing tasks. |
| ObRootBackup | RS | 1 | Schedules backup tasks. |
| ObRootBalancer | RS | 1 | Generates load balancing tasks. |
| ObRsGtsMonitor | RS | 1 | Monitors the distribution of GTS instances and initiates tasks to migrate or generate GTS replicas based on the distribution of GTS replicas. |
| ObRsGtsTaskMgr | RS | 1 | Executes the tasks related to GTS replicas. |
| ObHeartbeatChecker | RS | 1 | Checks the status of heartbeats between OBServer nodes. |
| ObStandbyClusterSchemaProcessor | RS | 1 | Synchronizes the replica of a standby database to the user tenant schema of the primary database. |
| ObRestoreScheduler | RS | 1 | Schedules the restoration process. |
| ObWorkQueue | RS | 4 | Executes asynchronous RootServer tasks. The number of threads is determined by the rootservice_async_task_thread_count parameter. Value range: [1,10]. |
| ObAsyncTaskQueue | RS | 16 | Executes the creation of indexes. |
| ObSwitchTaskQueue | RS | 6 | The task queue for primary/standby switchover in the physical standby database. The number of threads is determined by the switchover_process_thread_count parameter. Value range: [1,1000]. |
| LocalityReload | RS | 1 | Regularly refreshes the locality information. |
| RSqlPool | RS | 1 | Allows the standby database to regularly maintain the RootServer list of the primary database. |
| ServerTracerTimer | RS | 1 | Schedules the tasks to maintain the status of other OBServer nodes. |
| LogEngine | CLOG | 1 | Collects and monitors the disk space occupied by clog files and recycles clog files. |
| CLGWR | CLOG | 1 | Writes clog items to the disk. |
| ClogHisRep | CLOG | 3 | Updates the internal table of the clog history when a partition goes online or offline. |
| BatchSubmitCtx | CLOG | 1 | Splits the transactions optimized in phase 1. |
| LogScanRunnable | CLOG | 4 | Scans all clog files when the OBServer node starts. |
| LogStateDri | CLOG | 1 | Switches the primary and standby replicas of the clog module and checks the status of the replica association. |
| ObElectionGCThread | Election | 1 | Recycles the memory of election objects. |
| Blacklist | CLOG | 1 | Detects network connection with the destination server. |
| BRPC | CLOG | 5 | Sends the batch_rpc aggregation package in the background. |
| CLOGReqMinor | CLOG | 1 | Triggers minor freezing based on the clog disk usage and speeds up the recycling of clog files. |
| LineCache | CLOG | 1 | Optimizes the synchronization of historical data in the liboblog scenario. |
| EXTLogWash | CLOG | 1 | Frequency: 100 ms. |
| CLogFileGC | CLOG | 1 | Regularly recycles clog files. |
| CKPTLogRep | CLOG | 1 | Used for the checkpoint operations of log replicas. |
| RebuildRetry | CLOG | 1 | Retries the partition rebuilding task. |
| ReplayEngine | CLOG | Physical core | Replays the clog files on the follower. |
| PxPoolTh | SQL | 0 | The thread pool for parallel execution. |
| sql_mem_timer | SQL | 1 | Automatically manages memory. |
| OmtNodeBalancer | Common | 1 | Refreshes multi-tenant information in the background. |
| MultiTenant | Common | 1 | Refreshes CPU utilization for multiple tenants to schedule resources. |
| SignalHandle | Common | 1 | Processes signals. |
| LeaseUpdate | Common | 3 | Monitors the lease between the RootServer and each OBServer node. |
| RsDDL | Common | 1 | Executes the DDL operations of the RootService. |
| MysqlIO | Common | 12 | Manages the connection with MySQL. |
| all_meta_table | Common | 8 | Reports the status of partition groups or partitions. |
| all_pg_partition_ meta_table | Common | 8 | Reports the status of partitions in a partition group. |
| TimerMonitor | Common | 1 | Monitors the actions of scheduled internal threads and triggers alerts for exceptions during execution. |
| ConfigMgr | Common | 1 | Refreshes parameters. |
| OB_ALOG | Common | 1 | Writes asynchronous system logs to the disk. |
| ELE_ALOG | Election | 1 | Writes asynchronous election module logs to the disk. |