Querying Metadata Locks
Function
Query metadata locks. Currently, only MySQL instances are supported.
URI
GET /v3/{project_id}/instances/{instance_id}/metadata-locks
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Explanation: Project ID of a tenant in a region To obtain this value, see Obtaining a Project ID. Constraints: N/A Values: The value can contain 32 characters. Only letters and digits are allowed. Default value: N/A |
instance_id |
Yes |
String |
Explanation: Unique ID of an instance Constraints: Only MySQL instances are supported. Values: The value can contain 32 characters. Only letters and digits are allowed. Default value: N/A |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
db_user_id |
Yes |
String |
Explanation: Database user ID, that is, ID of a connection established between the database account and the database. A database user ID is created by calling the API in Registering a Database User. Constraints: N/A Values: The value is a UUID containing 36 characters. Only letters, digits, and hyphens (-) are allowed. Default value: N/A |
thread_id |
No |
String |
Explanation: Session ID Constraints: N/A Values: [0, 2^31-1]. The actual value depends on the query result. Default value: N/A |
database |
No |
String |
Explanation: Database name Constraints: Only MySQL instances are supported. Values: N/A Default value: N/A |
table |
No |
String |
Explanation: Table name Constraints: Only MySQL instance tables are supported. Values: N/A Default value: N/A |
Request Parameters
None
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
metadata_locks |
Array of MetadataLock objects |
Explanation: List of metadata locks. Values: N/A |
count |
Integer |
Explanation: Number of metadata locks. Values: [0, 2^31-1]. The actual value depends on the query result. |
Parameter |
Type |
Description |
---|---|---|
thread_id |
String |
Explanation: Session ID Values: [0, 2^31-1]. The actual value depends on the query result. |
lock_status |
String |
Explanation: Lock status Values:
|
lock_mode |
String |
Explanation: Lock mode Values:
|
lock_type |
String |
Explanation: Lock type Values:
|
lock_duration |
String |
Explanation: Lock granularity Values:
|
table_schema |
String |
Explanation: Database where a lock is located. This field is left blank for some global read metadata locks. Values: N/A |
table_name |
String |
Explanation: Table name Values: N/A |
user |
String |
Explanation: User Values: N/A |
time |
String |
Explanation: Time Values: N/A |
host |
String |
Explanation: Host Values: N/A |
database |
String |
Explanation: Database where a session is located Values: N/A |
command |
String |
Explanation: Command Values: N/A |
state |
String |
Explanation: Status Values: N/A |
sql |
String |
Explanation: SQL statement Values: N/A |
trx_exec_time |
String |
Explanation: Transaction execution time Values: N/A |
block_process |
Array of Process objects |
Explanation: List of blocked sessions Values: N/A |
wait_process |
Array of Process objects |
Explanation: List of waiting sessions Values: N/A |
Parameter |
Type |
Description |
---|---|---|
id |
String |
Explanation: Session ID Values: [0, 2^31-1]. The actual value depends on the query result. |
user |
String |
Explanation: User Values: N/A |
host |
String |
Explanation: Host Values: N/A |
database |
String |
Explanation: Database Values: N/A |
command |
String |
Explanation: Command Values: N/A |
time |
String |
Explanation: Session duration Values: N/A |
state |
String |
Explanation: Status Values: N/A |
sql |
String |
Explanation: SQL statement Values: N/A |
trx_executed_time |
String |
Explanation: Transaction duration Values: N/A |
Example Request
Querying metadata locks
GET https://das.cn-north-1.myhuaweicloud.com/v3/054e292c9880d4992f02c0196d3ea468/instances/da304cd5bbb944de828759bc7be3d3fein01/metadata-locks?db_user_id=2c250598-1e3c-4d31-bc19-be1d866247e6&thread_id=12121&database=example&table=example
Example Response
Status code: 200
{ "metadata_locks" : [ { "thread_id" : "4096619", "lock_status" : "GRANTED", "lock_mode" : "MDL_SHARED_READ", "lock_type" : "Table metadata lock", "lock_duration" : "MDL_TRANSACTION", "table_schema" : "test_zyr", "table_name" : "test2", "user" : "root", "time" : "40", "host" : "das server", "database" : "test_zyr", "command" : "Sleep", "state" : "", "sql" : null, "trx_exec_time" : "341", "block_process" : [ ], "wait_process" : [ ] } ], "count" : 1 }
Status Codes
Status Code |
Description |
---|---|
200 |
Successful request |
400 |
Bad request |
500 |
Internal server error |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank 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