Queries the results of a task that terminates sessions.
Operation description
This operation is applicable only to ApsaraDB RDS for MySQL instances and PolarDB for MySQL clusters.
If you use an Alibaba Cloud SDK or a Database Autonomy Service (DAS) SDK to call this operation, we recommend that you use the latest version of the SDK.
If you use an SDK to call operations of DAS, you must set the region ID to cn-shanghai.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
hdm:GetKillInstanceSessionTaskResult |
get |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| InstanceId |
string |
Yes |
The instance ID. |
rm-2ze1jdv45i7l6**** |
| NodeId |
string |
No |
The node ID. Note
You must specify this parameter if your database instance is a PolarDB for MySQL cluster. |
pi-8vbkfj5a756um**** |
| TaskId |
string |
Yes |
The task ID. You can obtain the task ID from the response parameters of the CreateKillInstanceSessionTask operation. |
f77d535b45405bd462b21caa3ee8**** |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| Code |
integer |
The HTTP status code returned. |
200 |
| Message |
string |
The returned message. Note
If the request was successful, Successful is returned. If the request failed, an error message such as an error code is returned. |
Successful |
| Data |
object |
The data returned. |
|
| TaskId |
string |
The task ID. |
f77d535b45405bd462b21caa3ee8**** |
| UserId |
string |
The ID of the Alibaba Cloud account. |
164882191396**** |
| InstanceId |
string |
The instance ID. |
rm-2ze1jdv45i7l6**** |
| NodeId |
string |
The node ID. Note
This parameter is returned only if the instance is a PolarDB for MySQL cluster. |
pi-bp1h12rv501cv**** |
| TaskState |
string |
The state of the task that terminates sessions.
|
SUCCESS |
| Sessions |
array |
The session IDs. Note
If all sessions are terminated, the IDs of all sessions on the instance or node are returned. |
|
|
integer |
The session ID. |
[ 152, 112, 106, 146, 8357323, 5697053, 8357518, 8357519, 14964383 ] |
|
| KillSuccessCount |
integer |
The number of sessions that were terminated. |
100 |
| KillFailCount |
integer |
The number of sessions that failed to be terminated. |
0 |
| IgnoredUserSessionCount |
integer |
The number of ignored sessions, including sessions of the accounts that are specified by IgnoredUsers, sessions of internal O&M accounts of Alibaba Cloud, and Binlog Dump sessions. |
9 |
| Result |
array<object> |
The details of the task that terminated sessions. |
|
|
object |
|||
| Id |
integer |
The session ID. |
8357518 |
| User |
string |
The account of the database. |
testUser |
| Host |
string |
The IP address and port number of the host that initiated the session. |
100.104.XX.XX:23428 |
| Db |
string |
The name of the database. |
dbTest |
| Command |
string |
The type of the command executed in the session. |
Sleep |
| Time |
integer |
The execution duration. Unit: seconds. |
1 |
| State |
string |
The status of the session. |
Sending data |
| Info |
string |
The SQL statement executed in the session. |
SELECT sleep(60) |
| Active |
boolean |
Indicates whether the session is active. Note
If the type of the command is Query or Execute and the session in the transaction is not terminated, the session is active. |
true |
| TaskId |
string |
The ID of the subtask that terminates the session. |
task_d9e94107-6116-4ac3-b874-81466aff**** |
| Reason |
string |
The description of the session when the session was terminated.
|
SESSION_KILLED |
| RequestId |
string |
The request ID. |
B6D17591-B48B-4D31-9CD6-9B9796B2**** |
| Success |
boolean |
Indicates whether the request was successful. Valid values:
|
true |
Examples
Success response
JSON format
{
"Code": 200,
"Message": "Successful",
"Data": {
"TaskId": "f77d535b45405bd462b21caa3ee8****",
"UserId": "164882191396****",
"InstanceId": "rm-2ze1jdv45i7l6****",
"NodeId": "pi-bp1h12rv501cv****",
"TaskState": "SUCCESS",
"Sessions": [
0
],
"KillSuccessCount": 100,
"KillFailCount": 0,
"IgnoredUserSessionCount": 9,
"Result": [
{
"Id": 8357518,
"User": "testUser",
"Host": "100.104.XX.XX:23428",
"Db": "dbTest",
"Command": "Sleep",
"Time": 1,
"State": "Sending data",
"Info": "SELECT sleep(60)",
"Active": true,
"TaskId": "task_d9e94107-6116-4ac3-b874-81466aff****",
"Reason": "SESSION_KILLED"
}
]
},
"RequestId": "B6D17591-B48B-4D31-9CD6-9B9796B2****",
"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.