Scenarios
You can use the obdiag rca run command to analyze the lock_conflict scenario based on internal table data of OceanBase Database. When a lock conflict occurs, you can run the command to query the session that holds the lock and the session that waits for the lock.
OceanBase Database V4.0.0.0 and later are supported for this feature. When you use obdiag commands, you must configure cluster information in the ~/.obdiag/config.yml file or by specifying --config options in the commands.
Notice
Internal data is updated in real time. Therefore, obdiag only supports the analysis of current data.
The analysis logic for OceanBase Database V4.2.0.0 and later differs from that for earlier versions.
Supported environment variables
| Variable | Required | Data type | Default value | Description |
|---|---|---|---|---|
| tenant_name | Yes | string | "" | The name of the tenant to analyze. |
Examples
Specify the scenario in the command. obdiag queries the session that holds the lock and the session that waits for the lock based on current internal table data of OceanBase Database.
# xxx is the tenant name.
obdiag rca run --scene=lock_conflict --env tenant_name=xxx
If no transaction is started, the ID of the session that waits for the lock changes constantly. The lock conflict strategy of the obdiag rca command records the ID of the session that holds the lock. This mechanism is the same as that in OceanBase Cloud Platform (OCP). In addition, the strategy returns the query results and records the ID of the session that holds the lock in the query results. The ID of the session that waits for the lock is also recorded, but is not described as a key parameter.