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 config.yml file stored in the ~/.obdiag directory or by specifying --config options in the commands.
Notice
Internal table 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.
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.
obdiag rca run --scene=lock_conflict
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.