Querying Metadata Lock Snapshot Information
Function
This API is used to query metadata lock snapshot information.
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:listMetadataLock
list
Instance
-
-
-
URI
GET /v3/{project_id}/connections/{connection_id}/instance/query-meta-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 | Yes | Integer | Definition Metadata lock snapshot ID Constraints N/A Range N/A Default Value N/A |
| thread_id | No | String | Definition Thread ID Constraints N/A Range The value can contain only digits and can contain a maximum of 128 characters. Default Value N/A |
| db_name | No | String | Definition Database name Constraints N/A Range The value can contain a maximum of 128 characters. Default Value N/A |
| table_name | No | String | Definition Table name Constraints N/A Range The value can contain a maximum of 128 characters. Default Value N/A |
| lock_status | No | String | Definition Lock status Constraints N/A Range
Default Value N/A |
| lock_type | No | String | Definition Lock type Constraints N/A Range
Default Value N/A |
Request Parameters
None
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| infos | Array of Table 4 objects | Definition MDL lock wait information |
| count | Integer | Definition Total number of MDL locks Range N/A |
| wait_lock_count | Integer | Definition Number of sessions waiting for locks Range N/A |
| hold_lock_count | Integer | Definition Number of sessions holding locks Range N/A |
| time_greater_than_count | Integer | Definition Number of sessions whose lock wait time is greater than the threshold Range N/A |
| lock_wait_threshold_second | Long | Definition MDL lock wait time threshold Range N/A |
| Parameter | Type | Description |
|---|---|---|
| lock_id | String | Definition MDL lock ID Range N/A |
| thread_id | String | Definition Thread ID Range N/A |
| lock_status | String | Definition MDL lock status Range N/A |
| lock_mode | String | Definition MDL lock wait mode Range N/A |
| lock_type | String | Definition MDL lock wait information Range
|
| lock_duration | String | Definition MDL lock wait duration Range N/A |
| table_schema | String | Definition Database table schema information Range N/A |
| table_name | String | Definition Table name Range N/A |
| user | String | Definition Username Range N/A |
| time | String | Definition MDL lock wait time Range N/A |
| block_number | Integer | Definition Number of blocked sessions due to MDL lock waits Range N/A |
| wait_number | Integer | Definition Number of MDL lock waits Range N/A |
| host | String | Definition Host Range N/A |
| db_name | String | Definition Database name Range N/A |
| command | String | Definition SQL statement for MDL lock waits Range N/A |
| state | String | Definition MDL lock wait status Range N/A |
| info | String | Definition Additional information about MDL lock waits Range N/A |
| sql_limit_rule | String | Definition Associated SQL throttling rule Range N/A |
| trx_exec_time | String | Definition Transaction execution time Range N/A |
| block_process_info | Array of Table 5 Objects | Definition List of blocked transactions |
| wait_process_info | Array of Table 5 Objects | Definition List of waiting transactions |
| Parameter | Type | Description |
|---|---|---|
| id | String | Definition Session ID Range N/A |
| user | String | Definition User Range N/A |
| host | String | Definition IP address and port number for connecting to a database Range N/A |
| db | String | Definition Database Range N/A |
| command | String | Definition Command that is being executed Range N/A |
| time | String | Definition Session running time Range N/A |
| state | String | Definition Execution status Range N/A |
| info | String | Definition Executed SQL statement Range N/A |
| trx_duration | String | Definition Transaction duration Range N/A |
Example Requests
GET https://das.cn-north-1.myhuaweicloud.com/v3/054e292c9880d4992f02c0196d3ea468/connections/179e525e-0e9c-4dcc-9dd7-ee2f36121e23/instance/query-meta-lock-snapshot?lock_status=&db_name=&table_name=&lock_type=&thread_id=&id=1164
Example Responses
Status code: 200
Success.
{
"infos": [
{
"lock_id": "140623964997000",
"thread_id": "32",
"lock_status": "GRANTED",
"lock_mode": "X",
"lock_type": "Table metadata lock",
"lock_duration": "12",
"table_schema": "order_db",
"table_name": "t_order",
"user": "root",
"time": "15",
"block_number": 2,
"wait_number": 1,
"host": "192.168.1.100:3306",
"db_name": "order_db",
"command": "UPDATE",
"state": "Updating",
"info": "UPDATE t_order SET status=1 WHERE id=1024",
"sql_limit_rule": "",
"trx_exec_time": "20",
"block_process_info": [
{
"id": "28",
"user": "app_user",
"host": "192.168.1.101:52300",
"db": "order_db",
"command": "Query",
"time": "8",
"state": "Waiting for table metadata lock",
"info": "SELECT * FROM t_order WHERE id=1024",
"trx_duration": "10"
}
],
"wait_process_info": [
{
"id": "30",
"user": "app_user2",
"host": "192.168.1.102:49152",
"db": "order_db",
"command": "Query",
"time": "5",
"state": "Waiting for table metadata lock",
"info": "ALTER TABLE t_order ADD COLUMN remark VARCHAR(255)",
"trx_duration": "6"
}
]
}
],
"count": 1,
"wait_lock_count": 1,
"hold_lock_count": 1,
"time_greater_than_count": 0,
"lock_wait_threshold_second": 60
} 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