This topic describes the Minor compaction partitions monitoring metric for OceanBase tenants. You can specify a statistical range to query the Minor compaction partitions data of a tenant in a single zone or OBServer node.
need_compact_count
Metric description
The number of minor compaction partitions (sstables) required for an OceanBase tenant.
Metric parameter description
Metric |
Metric name |
Unit |
|---|---|---|
| ob_tenant_need_compact_count | need_compact_count | - |
Calculation expression
sum(ob_tenant_sstable_compact_count{@LABELS}) by (@GBLABELS)
SQL collection
OceanBase V4.2.0.0 and later:
select /*+ MONITOR_AGENT READ_CONSISTENCY(WEAK) QUERY_TIMEOUT(20000000) */ tenant_id,svr_ip,svr_port,count(*) as cnt from GV$OB_SSTABLES where table_type = 'MEMTABLE' and is_active='NO' group by tenant_id,svr_ip,svr_port
compact_timeout_count
Metric description
The number of minor compaction partitions (sstables) in an OceanBase tenant that have not undergone minor compaction for a long time. Partitions with a compaction duration greater than 1,800 seconds are counted.
Metric parameter description
Metric |
Metric name |
Unit |
|---|---|---|
| ob_tenant_compact_timeout_count | compact_timeout_count | - |
Calculation expression
sum(ob_tenant_sstable_compact_timeout_count{@LABELS}) by (@GBLABELS)
SQL collection
OceanBase V4.2.0.0 and later:
select /*+ MONITOR_AGENT NO_REWRITE READ_CONSISTENCY(WEAK) QUERY_TIMEOUT(20000000) */ a.tenant_id,b.svr_ip,b.svr_port,count(*) as cnt from DBA_OB_TENANTS a join ( select * from GV$OB_SSTABLES where table_type = 'MEMTABLE' and is_active='NO' ) as b on a.tenant_id = b.tenant_id and (TIMESTAMP_TO_SCN(now()) - end_log_scn) > 1800 * 1000 * 1000 * 1000 group by b.tenant_id,b.svr_ip,b.svr_port
mini_merge_tablet_count
Metric description
Number of tablets with excessive SSTables for minor compaction in the OceanBase tenant. A tablet is counted when the number of SSTables for minor compaction in each tablet of the tenant is greater than or equal to 30.
Metric parameters
Metric |
Metric name |
Unit |
|---|---|---|
| ob_tenant_mini_merge_tablet_count | mini_merge_tablet_count | - |
Calculation expression
sum(ob_tenant_mini_merge_tablet_count{@LABELS}) by (@GBLABELS)
SQL collection
OceanBase Database V4.2.0.0 and later:
select /*+ MONITOR_AGENT READ_CONSISTENCY(WEAK) QUERY_TIMEOUT(20000000) */x.tenant_id,x.svr_ip,x.svr_port,count(*) as cnt from (select tenant_id,svr_ip,svr_port,tablet_id,count(*) as cnt from GV$OB_SSTABLES where table_type = 'MINOR' or table_type = 'MINI' group by tenant_id,svr_ip,svr_port,tablet_id having cnt >=30) as x where x.cnt >0 group by x.tenant_id,x.svr_ip,x.svr_port
