This topic describes the monitoring metrics related to clog synchronization delay of an OceanBase Database tenant. The metrics include full_clog_sync_delay for clog synchronization delay of full-featured replicas, readonly_clog_sync_delay for clog synchronization delay of read-only replicas, and logly_clog_sync_delay for clog synchronization delay of log replicas. You can specify a statistical range to query statistics about the clog synchronization delay in a single zone or on a single OBServer of an OceanBase Database tenant.
OceanBase Database supports the following types of replicas:
Full-featured replica: A standard replica type that contains all the data categories and all the features, including MemTables, SSTables, and transaction logs. A full-featured replica can switch to the leader role in an efficient manner to provide services.
Log replica: A replica that contains only logs. It does not have a MemTable or an SSTable. It provides log services for external applications and participates in log voting. It can facilitate the recovery of other replicas, but it cannot become the leader to provide database services.
Read-only replica: A replica that contains full logs, MemTables, and SSTables. Its logging feature is special. It does not participate in elections as a Paxos group member. Instead, it tracks in real time the logs of Paxos group members and locally plays back the logs. If an application does not require high consistency in data reading, these replicas can provide read-only services. They are not part of the Paxos group. Therefore, they do not increase the latency of transaction commit because the voting membership is not expanded.
A clog synchronization delay is a delay in the synchronization of the clogs of these replicas.
full_clog_sync_delay
Definition
The maximum clog synchronization delay of the full-featured replicas in the specified statistical range.
Description
| Metric | Metric name | Unit |
|---|---|---|
| full_clog_sync_delay | max_full_clog_sync_delay_seconds | s |
Calculation expression
max(ob_clog_max_sync_delay_seconds{replica_type="0",@LABELS}) by (@GBLABELS)
SQL statements for metric collection
If you use OceanBase Database of a version earlier than V4.0, execute the following statement:
select /*+ MONITOR_AGENT READ_CONSISTENCY(WEAK) */ stat.table_id >> 40 tenant_id, stat.replica_type, max(stat.next_replay_ts_delta) / 1000000 as max_clog_sync_delay_seconds from __all_virtual_clog_stat stat left join (select meta.table_id, meta.partition_id from __all_virtual_meta_table meta where meta.status = 'REPLICA_STATUS_NORMAL'and meta.svr_ip = ? and meta.svr_port = ? and meta.table_id not in (select table_id from __all_virtual_partition_migration_status mig where mig.action <> 'END') ) meta on stat.table_id = meta.table_id and stat.partition_idx = meta.partition_id where stat.svr_ip = ? and stat.svr_port = ? group by tenant_id, replica_type having max_clog_sync_delay_seconds < 3153600000If you use OceanBase Database V4.0 or later, execute the following statement:
select /* MONITOR_AGENT */ leader.tenant_id, '0' as replica_type, abs(max(CAST(leader_ts as SIGNED)-CAST(follower_ts as SIGNED)))/1000000000 max_clog_sync_delay_seconds from (select max(end_scn) leader_ts, tenant_id, role from GV$OB_LOG_STAT where role='LEADER' group by tenant_id ) leader inner join (select min(end_scn) follower_ts, tenant_id, role from GV$OB_LOG_STAT where role='FOLLOWER' group by tenant_id ) follower on leader.tenant_id=follower.tenant_id group by leader.tenant_id
readonly_clog_sync_delay
Definition
The maximum clog synchronization delay of the read-only replicas in the specified statistical range.
Description
| Metric | Metric name | Unit |
|---|---|---|
| readonly_clog_sync_delay | max_readonly_clog_sync_delay_seconds | s |
Calculation expression
max(ob_clog_max_sync_delay_seconds{replica_type="5",@LABELS}) by (@GBLABELS)
SQL statements for metric collection
If you use OceanBase Database of a version earlier than V4.0, execute the following statement:
select /*+ MONITOR_AGENT READ_CONSISTENCY(WEAK) */ stat.table_id >> 40 tenant_id, stat.replica_type, max(stat.next_replay_ts_delta) / 1000000 as max_clog_sync_delay_seconds from __all_virtual_clog_stat stat left join (select meta.table_id, meta.partition_id from __all_virtual_meta_table meta where meta.status = 'REPLICA_STATUS_NORMAL'and meta.svr_ip = ? and meta.svr_port = ? and meta.table_id not in (select table_id from __all_virtual_partition_migration_status mig where mig.action <> 'END') ) meta on stat.table_id = meta.table_id and stat.partition_idx = meta.partition_id where stat.svr_ip = ? and stat.svr_port = ? group by tenant_id, replica_type having max_clog_sync_delay_seconds < 3153600000If you use OceanBase Database V4.0 or later, execute the following statement:
select /* MONITOR_AGENT */ leader.tenant_id, '0' as replica_type, abs(max(CAST(leader_ts as SIGNED)-CAST(follower_ts as SIGNED)))/1000000000 max_clog_sync_delay_seconds from (select max(end_scn) leader_ts, tenant_id, role from GV$OB_LOG_STAT where role='LEADER' group by tenant_id ) leader inner join (select min(end_scn) follower_ts, tenant_id, role from GV$OB_LOG_STAT where role='FOLLOWER' group by tenant_id ) follower on leader.tenant_id=follower.tenant_id group by leader.tenant_id
logonly_clog_sync_delay
Definition
The maximum clog synchronization delay of the log replicas in the specified statistical range.
Description
| Metric | Metric name | Unit |
|---|---|---|
| logonly_clog_sync_delay | max_logonly_clog_sync_delay_seconds | s |
Calculation expression
max(ob_clog_max_sync_delay_seconds{replica_type="16",@LABELS}) by (@GBLABELS)
SQL statements for metric collection
If you use OceanBase Database of a version earlier than V4.0, execute the following statement:
select /*+ MONITOR_AGENT READ_CONSISTENCY(WEAK) */ stat.table_id >> 40 tenant_id, stat.replica_type, max(stat.next_replay_ts_delta) / 1000000 as max_clog_sync_delay_seconds from __all_virtual_clog_stat stat left join (select meta.table_id, meta.partition_id from __all_virtual_meta_table meta where meta.status = 'REPLICA_STATUS_NORMAL'and meta.svr_ip = ? and meta.svr_port = ? and meta.table_id not in (select table_id from __all_virtual_partition_migration_status mig where mig.action <> 'END') ) meta on stat.table_id = meta.table_id and stat.partition_idx = meta.partition_id where stat.svr_ip = ? and stat.svr_port = ? group by tenant_id, replica_type having max_clog_sync_delay_seconds < 3153600000If you use OceanBase Database V4.0 or later, execute the following statement:
select /* MONITOR_AGENT */ leader.tenant_id, '0' as replica_type, abs(max(CAST(leader_ts as SIGNED)-CAST(follower_ts as SIGNED)))/1000000000 max_clog_sync_delay_seconds from (select max(end_scn) leader_ts, tenant_id, role from GV$OB_LOG_STAT where role='LEADER' group by tenant_id ) leader inner join (select min(end_scn) follower_ts, tenant_id, role from GV$OB_LOG_STAT where role='FOLLOWER' group by tenant_id ) follower on leader.tenant_id=follower.tenant_id group by leader.tenant_id