This topic describes monitoring metrics related to lock waits within an OceanBase Database tenant. These metrics collect statistics on the number of successful and failed write lock waits within a tenant. A successful write lock wait means that a write lock can be added after a write lock wait elapses. If a write lock fails to be added, a write lock wait fails. You can specify a statistical period to query statistics about the lock waits in a single zone or on a single OBServer of an OceanBase Database tenant.
success
Definition
The number of successful write lock waits in the specified statistical period.
Description
| Metric | Metric field name | Unit |
|---|---|---|
| success | memstore_write_lock_succ_count | times/s |
Calculation expression
sum(rate(ob_sysstat{stat_id="60021",@LABELS}[@INTERVAL])) 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) */ con_id tenant_id, stat_id, value from v$sysstat where stat_id IN (60021) and (con_id > 1000 or con_id = 1) and class < 1000If you use OceanBase Database V4.0 or later, execute the following statement:
select /* MONITOR_AGENT */ con_id tenant_id, stat_id, value from v$sysstat where stat_id IN (60021) and (con_id > 1000 or con_id = 1) and class < 1000
fail
Definition
The number of failed write lock waits in the specified statistical period.
Description
| Metric | Metric field name | Unit |
|---|---|---|
| fail | memstore_write_lock_fail_count | times/s |
Calculation expression
sum(rate(ob_sysstat{stat_id="60022",@LABELS}[@INTERVAL])) 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) */ con_id tenant_id, stat_id, value from v$sysstat where stat_id IN (60022) and (con_id > 1000 or con_id = 1) and class < 1000If you use OceanBase Database V4.0 or later, execute the following statement:
select /* MONITOR_AGENT */ con_id tenant_id, stat_id, value from v$sysstat where stat_id IN (60022) and (con_id > 1000 or con_id = 1) and class < 1000