Retrieves the detailed information for a single deadlock event.
Operation description
This API fetches the full details of a specific deadlock, including the transactions involved, the SQL statements, and the locks held and waited for. The deadlock can be from either a recent analysis or a full historical analysis. For more information, see Deadlock analysis.
Before you call this operation, ensure the following:
-
Supported engines:
-
For recent deadlock analysis: ApsaraDB RDS for MySQL, self-managed MySQL, PolarDB for MySQL, PolarDB-X 2.0.
-
For full deadlock analysis: ApsaraDB RDS for MySQL or PolarDB for MySQL with DAS Economy Edition or DAS Professional Edition enabled.
-
-
SDK version: Use the latest version of the Alibaba Cloud SDK.
-
Region: If you call the API via the SDK, set the region ID to
cn-shanghai.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
hdm:GetDeadLockDetail |
none |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| InstanceId |
string |
Yes |
The ID of the database instance. |
pc-bp1u5mas9exx7**** |
| NodeId |
string |
No |
The node ID. Note
Required for PolarDB for MySQL cluster instances. |
pi-bp16v3824rt73**** |
| TextId |
string |
Yes |
The ID of the deadlock text. This value is returned from the GetDeadLockHistory operation. |
a0e390cd5aca9ae964448f040153**** |
| Source |
string |
No |
The source of the analysis task:
|
AUTO |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| RequestId |
string |
The unique request ID. |
9CB97BC4-6479-55D0-B9D0-EA925AFE**** |
| Message |
string |
The response message. Note
|
Successful |
| Synchro |
string |
The reserved parameter. |
None |
| Data |
string |
The returned data in JSON format:
|
{ "accountId": "108************", "textId": "35303d12d52d29ba73bb************", "gmtModified": 1732712680000, "originText": "LATEST DETECTED DEADLOCK****", "deadlock": "{\"id\":0,\"occurTime\":1732687047000,\"originTextId\":\"35303d12d52d29ba73bb************\",\"rollbackTrxId\":\"2\",\"transactions\":[{\"deadlockIdInDB\":0,\"ip\":\"100.***.***.***\",\"lockWait\":\"index PRIMARY of table `das`.`students` trx id 15989454 lock_mode X locks rec but not gap waiting\",\"queryId\":\"386737457\",\"queryType\":\"updating\",\"relatedTables\":[\"`das`.`students`\"],\"sqlText\":\"update students set name=UUID() where id = 2 \",\"tableNamesString\":\"`das`.`students`\",\"threadId\":\"9194526\",\"transactionId\":\"15989454\",\"trxIdInLock\":1,\"userName\":\"das\",\"waitLockIndexName\":\"PRIMARY \",\"waitLockMode\":\"X locks rec but not gap waiting\"},{\"deadlockIdInDB\":0,\"holdLockIndexName\":\"PRIMARY \",\"holdLockMode\":\"X locks rec but not gap\",\"ip\":\"100.***.***.***\",\"lockHold\":\"index PRIMARY of table `das`.`students` trx id 15989451 lock_mode X locks rec but not gap\",\"lockWait\":\"index PRIMARY of table `das`.`students` trx id 15989451 lock_mode X locks rec but not gap waiting\",\"queryId\":\"386737566\",\"queryType\":\"updating\",\"relatedTables\":[\"`das`.`students`\"],\"sqlText\":\"update students set name=UUID() where id = 3 \",\"tableNamesString\":\"`das`.`students`\",\"threadId\":\"9194501\",\"transactionId\":\"15989451\",\"trxIdInLock\":2,\"userName\":\"das\",\"waitLockIndexName\":\"PRIMARY \",\"waitLockMode\":\"X locks rec but not gap waiting\"}],\"trxNum\":2}", "gmtCreate": 1732712680000, "nodeId": "pi-8****************", "uuid": "pc-8v***************" } |
| Code |
string |
The returned status code. |
200 |
| Success |
string |
Indicates whether the request was successful. Valid values:
|
true |
Examples
Success response
JSON format
{
"RequestId": "9CB97BC4-6479-55D0-B9D0-EA925AFE****",
"Message": "Successful",
"Synchro": "None",
"Data": "{\n \"accountId\": \"108************\",\n \"textId\": \"35303d12d52d29ba73bb************\",\n \"gmtModified\": 1732712680000,\n \"originText\": \"LATEST DETECTED DEADLOCK****\",\n \"deadlock\": \"{\\\"id\\\":0,\\\"occurTime\\\":1732687047000,\\\"originTextId\\\":\\\"35303d12d52d29ba73bb************\\\",\\\"rollbackTrxId\\\":\\\"2\\\",\\\"transactions\\\":[{\\\"deadlockIdInDB\\\":0,\\\"ip\\\":\\\"100.***.***.***\\\",\\\"lockWait\\\":\\\"index PRIMARY of table `das`.`students` trx id 15989454 lock_mode X locks rec but not gap waiting\\\",\\\"queryId\\\":\\\"386737457\\\",\\\"queryType\\\":\\\"updating\\\",\\\"relatedTables\\\":[\\\"`das`.`students`\\\"],\\\"sqlText\\\":\\\"update students set name=UUID() where id = 2 \\\",\\\"tableNamesString\\\":\\\"`das`.`students`\\\",\\\"threadId\\\":\\\"9194526\\\",\\\"transactionId\\\":\\\"15989454\\\",\\\"trxIdInLock\\\":1,\\\"userName\\\":\\\"das\\\",\\\"waitLockIndexName\\\":\\\"PRIMARY \\\",\\\"waitLockMode\\\":\\\"X locks rec but not gap waiting\\\"},{\\\"deadlockIdInDB\\\":0,\\\"holdLockIndexName\\\":\\\"PRIMARY \\\",\\\"holdLockMode\\\":\\\"X locks rec but not gap\\\",\\\"ip\\\":\\\"100.***.***.***\\\",\\\"lockHold\\\":\\\"index PRIMARY of table `das`.`students` trx id 15989451 lock_mode X locks rec but not gap\\\",\\\"lockWait\\\":\\\"index PRIMARY of table `das`.`students` trx id 15989451 lock_mode X locks rec but not gap waiting\\\",\\\"queryId\\\":\\\"386737566\\\",\\\"queryType\\\":\\\"updating\\\",\\\"relatedTables\\\":[\\\"`das`.`students`\\\"],\\\"sqlText\\\":\\\"update students set name=UUID() where id = 3 \\\",\\\"tableNamesString\\\":\\\"`das`.`students`\\\",\\\"threadId\\\":\\\"9194501\\\",\\\"transactionId\\\":\\\"15989451\\\",\\\"trxIdInLock\\\":2,\\\"userName\\\":\\\"das\\\",\\\"waitLockIndexName\\\":\\\"PRIMARY \\\",\\\"waitLockMode\\\":\\\"X locks rec but not gap waiting\\\"}],\\\"trxNum\\\":2}\",\n \"gmtCreate\": 1732712680000,\n \"nodeId\": \"pi-8****************\",\n \"uuid\": \"pc-8v***************\"\n}",
"Code": "200",
"Success": "true"
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | InvalidParams | The request parameters are invalid. | |
| 403 | NoPermission | You are not authorized to do this action. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.