This section describes the monitoring metric Partition of OceanBase Database tenants. The metric is divided into two sub-metrics: tenant_partition_leader_absent_count (number of leaderless partitions of the tenant) and tenant_partition_replica_absent_count (number of partitions without replicas of the tenant). You can specify the statistics range to query the Partition data of the tenant in a single zone or OBServer node.
tenant_partition_leader_absent_count
Description
The number of leaderless partitions of the tenant in the statistics range.
Parameter description
| Metrics | Metric Name | Unit |
|---|---|---|
| tenant_partition_leader_absent_count | tenant_partition_leader_absent_count | - |
Expression
max(partition_leader_absent_count{@LABELS}) by (@GBLABELS)
SQL statement for data collection
OceanBase Database V4.0 and later:
SELECT /*+ MONITOR_AGENT QUERY_TIMEOUT(20000000) */ tenant.tenant_id, tenant.tenant_name, IFNULL(stat.cnt, 0) cnt FROM __all_tenant tenant LEFT JOIN (SELECT /*+QUERY_TIMEOUT(20000000)*/ tenant.tenant_id, count(distinct a.table_id,a.partition_id) cnt FROM v$ob_cluster cluster, __all_tenant tenant JOIN __all_virtual_meta_table a ON a.tenant_id=tenant.tenant_id LEFT JOIN __all_virtual_meta_table b ON a.table_id=b.table_id AND a.partition_id=b.partition_id WHERE (cluster.cluster_role='PRIMARY' and b.role=1 or cluster.cluster_role='STANDBY' and b.role=3) and b.tenant_id IS NULL GROUP BY tenant.tenant_id) stat ON stat.tenant_id=tenant.tenant_id
tenant_partition_replica_absent_count
Description
The number of partitions without replicas of the tenant in the statistics range.
Parameter description
| Metrics | Metric Name | Unit |
|---|---|---|
| tenant_partition_replica_absent_count | tenant_partition_replica_absent_count | - |
Expression
max(partition_replica_absent_count{@LABELS}) by (@GBLABELS)
SQL statement for data collection
OceanBase Database V4.0 and later:
SELECT /*+ MONITOR_AGENT READ_CONSISTENCY(WEAK) QUERY_TIMEOUT(20000000) */ tenant.tenant_id, tenant.tenant_name, IFNULL(stat.cnt, 0) cnt FROM __all_tenant tenant LEFT JOIN (SELECT table_id>>40 AS tenant_id, COUNT(1) cnt FROM __all_virtual_election_info WHERE member_list NOT LIKE CONCAT(replica_num,'{%') AND SUBSTR(member_list, 1, 1) != '0' GROUP BY tenant_id) stat ON tenant.tenant_id=stat.tenant_id where stat.tenant_id not in (select tenant_id from __all_rootservice_job where job_type='ALTER_TENANT_LOCALITY' and job_status='INPROGRESS')