All Products
Search
Document Center

Database Autonomy Service:GetKillInstanceSessionTaskResult

Last Updated:Dec 23, 2024

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.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
hdm:GetKillInstanceSessionTaskResultget
*All Resources
*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
InstanceIdstringYes

The instance ID.

rm-2ze1jdv45i7l6****
NodeIdstringNo

The node ID.

Note You must specify this parameter if your database instance is a PolarDB for MySQL cluster.
pi-8vbkfj5a756um****
TaskIdstringYes

The task ID. You can obtain the task ID from the response parameters of the CreateKillInstanceSessionTask operation.

f77d535b45405bd462b21caa3ee8****

Response parameters

ParameterTypeDescriptionExample
object
Codelong

The HTTP status code returned.

200
Messagestring

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
Dataobject

The data returned.

TaskIdstring

The task ID.

f77d535b45405bd462b21caa3ee8****
UserIdstring

The ID of the Alibaba Cloud account.

164882191396****
InstanceIdstring

The instance ID.

rm-2ze1jdv45i7l6****
NodeIdstring

The node ID.

Note This parameter is returned only if the instance is a PolarDB for MySQL cluster.
pi-bp1h12rv501cv****
TaskStatestring

The state of the task that terminates sessions.

  • RUNNING: The task is in progress.
  • SUCCESS: The task is successful.
  • FAILURE: The task failed.
  • ERROR: Other errors occur.
SUCCESS
Sessionsarray

The session IDs.

Note If all sessions are terminated, the IDs of all sessions on the instance or node are returned.
sessionslong

The session ID.

[ 152, 112, 106, 146, 8357323, 5697053, 8357518, 8357519, 14964383 ]
KillSuccessCountlong

The number of sessions that were terminated.

100
KillFailCountlong

The number of sessions that failed to be terminated.

0
IgnoredUserSessionCountlong

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
Resultarray<object>

The details of the task that terminated sessions.

resultobject
Idlong

The session ID.

8357518
Userstring

The account of the database.

testUser
Hoststring

The IP address and port number of the host that initiated the session.

100.104.XX.XX:23428
Dbstring

The name of the database.

dbTest
Commandstring

The type of the command executed in the session.

Sleep
Timelong

The execution duration. Unit: seconds.

1
Statestring

The status of the session.

Sending data
Infostring

The SQL statement executed in the session.

SELECT sleep(60)
Activeboolean

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
TaskIdstring

The ID of the subtask that terminates the session.

task_d9e94107-6116-4ac3-b874-81466aff****
Reasonstring

The description of the session when the session was terminated.

  • SESSION_KILLED: The session is terminated.
  • SESSION_EXPIRED: The session has expired.
  • SESSION_NO_PERMISSION: The account used to terminate the session has insufficient permissions.
  • SESSION_ACCOUNT_ERROR: The account or password used to terminate the session is invalid.
  • SESSION_IGNORED_USER: The session of the account does not need to be terminated.
  • SESSION_INTERNAL_USER_OR_COMMAND: The session is a session initiated by or a command run by an Alibaba Cloud O&M account.
  • SESSION_KILL_TASK_TIMEOUT: Timeout occurs when the session is terminated.
  • SESSION_OTHER_ERROR: Other errors occurred.
SESSION_KILLED
RequestIdstring

The request ID.

B6D17591-B48B-4D31-9CD6-9B9796B2****
Successboolean

Indicates whether the request was successful. Valid values:

  • true
  • false
true

Examples

Sample success responses

JSONformat

{
  "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 codeError codeError message
400InvalidParamsThe request parameters are invalid.
403NoPermissionYou are not authorized to do this action.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
No change history