Querying the Latest Deadlock Snapshot
Function
This API is used to query the latest deadlock snapshot.
Authorization Information
Each account has permissions to call all APIs, but IAM users must have the required permissions specifically assigned.
- If you are using role/policy-based authorization, see the required permissions in Permissions Policies and Supported Actions.
- If you are using identity policy-based authorization, the following identity policy-based permissions are required.
Action
Access Level
Resource Type (*: required)
Condition Key
Alias
Dependencies
das:clouddba:listInnodbLock
list
Instance
-
-
-
URI
GET /v3/{project_id}/connections/{connection_id}/instance/query-latest-dead-lock-snapshot
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition Project ID of a tenant in a region. To obtain this value, see Obtaining a Project ID. Constraints N/A Range The value can contain 32 characters. Only letters and digits are supported. Default Value N/A |
| connection_id | Yes | String | Definition Connection ID established between a database account and the database. The database user ID is created using the API in Creating an Instance Connection. Constraints N/A Range The value is a UUID containing 36 characters. Only letters, digits, and hyphens (-) are allowed. Default Value N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| id | No | Integer | Definition Lock snapshot ID Constraints N/A Range N/A Default Value N/A |
Request Parameters
None
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| find_lock | Boolean | Definition Whether a lock is found Range
|
| happen_time | Long | Definition Occurrence time (ms) Range N/A |
| mysql_dead_lock | Table 4 object | Definition Deadlock content Range N/A |
| Parameter | Type | Description |
|---|---|---|
| raw | String | Definition Original deadlock content Range N/A |
| happen_time | Long | Definition Occurrence time (ms) Range N/A |
| rollback_trx_id | String | Definition Rollback transaction ID Range N/A |
| mysql_transactions | Array of Table 5 objects | Definition Transaction list Range N/A |
| time | String | Definition Occurrence time Range N/A |
| Parameter | Type | Description |
|---|---|---|
| session_id | String | Definition Session ID Range N/A |
| thread_id | String | Definition Thread ID Range N/A |
| request_type | String | Definition Request type Range N/A |
| transaction_id | String | Definition Transaction ID Range N/A |
| table | String | Definition Involved table Range N/A |
| waiting_lock | String | Definition Waiting lock Range N/A |
| waiting_lock_index | String | Definition Name of a waiting lock index Range N/A |
| waiting_lock_type | String | Definition Type of a waiting lock index Range N/A |
| holding_lock | String | Definition Held lock Range N/A |
| holding_lock_index | String | Definition Held lock index Range N/A |
| holding_lock_type | String | Definition Type of a held lock index Range N/A |
| sql | String | Definition SQL Range N/A |
Example Requests
GET https://das.cn-north-1.myhuaweicloud.com/v3/054e292c9880d4992f02c0196d3ea468/connections/179e525e-0e9c-4dcc-9dd7-ee2f36121e23/instance/query-latest-dead-lock-snapshot?id=1163
Example Responses
Status code: 200
Success.
{
"mysql_dead_lock": {
"raw": "2025-11-26 11:23:35 0x7ff39ff7b700\n*** TRANSACTION:\nTRANSACTION 87070095, ACTIVE 10 sec inserting\nmysql tables in use 1, locked 1\n3 lock struct(s), heap size 1136, 2 row lock(s), undo log entries 2\nMySQL thread id 28922284, OS thread handle 140684337592064, query id 160548617 100.79.0.247 root update\ninsert into shopping(b,c) values(1,6)\n*** HOLDS THE LOCK:\nRECORD LOCKS space id 44290 page no 4 n bits 72 index u_k of table `cds`.`shopping` trx id 87070095 lock_mode X locks rec but not gap\nRecord lock, heap no 5 PHYSICAL RECORD: n_fields 3; compact format; info bits 0\n 0: len 4; hex 80000001; asc ;;\n 1: len 4; hex 80000008; asc ;;\n 2: len 4; hex 80000004; asc ;;\n\n*** WAITING FOR THIS LOCK TO BE GRANTED, WHICH CONFLICTS WITH THE LOCK HELD BY TRANSACTION 87070096:\nRECORD LOCKS space id 44290 page no 4 n bits 72 index u_k of table `cds`.`shopping` trx id 87070095 lock_mode X locks gap before rec insert intention waiting\nRecord lock, heap no 5 PHYSICAL RECORD: n_fields 3; compact format; info bits 0\n 0: len 4; hex 80000001; asc ;;\n 1: len 4; hex 80000008; asc ;;\n 2: len 4; hex 80000004; asc ;;\n\n\n*** TRANSACTION:\nTRANSACTION 87070096, ACTIVE 5 sec inserting\nmysql tables in use 1, locked 1\nLOCK WAIT 2 lock struct(s), heap size 1136, 1 row lock(s), undo log entries 1\nMySQL thread id 28922355, OS thread handle 140682021132032, query id 160548542 100.79.0.247 root update\ninsert into shopping(b,c) values(1,8)\n*** HOLDS THE LOCK:\nRECORD LOCKS space id 44290 page no 4 n bits 72 index u_k of table `cds`.`shopping` trx id 87070096 lock mode S waiting\nRecord lock, heap no 5 PHYSICAL RECORD: n_fields 3; compact format; info bits 0\n 0: len 4; hex 80000001; asc ;;\n 1: len 4; hex 80000008; asc ;;\n 2: len 4; hex 80000004; asc ;;\n\n*** WAITING FOR THIS LOCK TO BE GRANTED, WHICH CONFLICTS WITH THE LOCK HELD BY TRANSACTION 87070095:\nRECORD LOCKS space id 44290 page no 4 n bits 72 index u_k of table `cds`.`shopping` trx id 87070096 lock mode S waiting\nRecord lock, heap no 5 PHYSICAL RECORD: n_fields 3; compact format; info bits 0\n 0: len 4; hex 80000001; asc ;;\n 1: len 4; hex 80000008; asc ;;\n 2: len 4; hex 80000004; asc ;;\n\n*** WE ROLL BACK TRANSACTION 87070096",
"happen_time": 1764127415000,
"time": "2025-11-26 11:23:35",
"rollback_trx_id": "87070096",
"mysql_transactions": [
{
"session_id": "160548617",
"thread_id": "28922284",
"request_type": "update",
"transaction_id": "87070095",
"table": "`cds`.`shopping`",
"waiting_lock": "index u_k of table `cds`.`shopping` trx id 87070095 lock_mode X locks gap before rec insert intention waiting",
"waiting_lock_index": "u_k",
"waiting_lock_type": "X locks gap before rec insert intention waiting",
"holding_lock": "index u_k of table `cds`.`shopping` trx id 87070095 lock_mode X locks rec but not gap",
"holding_lock_index": "u_k",
"holding_lock_type": "X locks rec but not gap",
"sql": "insert into shopping(b,c) values(1,6)"
},
{
"session_id": "160548542",
"thread_id": "28922355",
"request_type": "update",
"transaction_id": "87070096",
"table": "`cds`.`shopping`",
"waiting_lock": "index u_k of table `cds`.`shopping` trx id 87070096 lock mode S waiting",
"waiting_lock_index": "u_k",
"waiting_lock_type": "S waiting",
"holding_lock": "index u_k of table `cds`.`shopping` trx id 87070096 lock mode S waiting",
"holding_lock_index": "u_k",
"holding_lock_type": "S waiting",
"sql": "insert into shopping(b,c) values(1,8)"
}
]
},
"find_lock": true,
"happen_time": 1764127415000
} Status Codes
| Status Code | Description |
|---|---|
| 200 | Success. |
| 400 | Client error. |
| 500 | Server error. |
Error Codes
See Error Codes.
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot