tencent cloud

TDSQL Boundless

Release Notes
Product Introduction
Overview
Scenarios
Product Architecture
Instance Types
Compatibility Notes
Kernel Features
Kernel Overview
Kernel Version Release Notes
Functionality Features
Performance Features
Billing
Billing Overview
Purchase Method
Pricing Details
Renewal
Overdue Payments
Refund
Getting Started
Creating an Instance
Connect to Instances
User Guide
Data Migration
Data Subscription
Instance Management
Configuration Change
Parameter Configuration
Account Management
Security Group
Backup and Restoration
Database Auditing
Tag Management
Use Cases
Technical Evolution and Usage Practices of Online DDL
Lock Mechanism Analysis and Troubleshooting Practices
Data Intelligent Scheduling and Related Practices for Performance Optimization
TDSQL Boundless Selection Guide and Practical Tutorial
Developer Guide
Developer Guide (MySQL Compatibility Mode)
Developer Guide (HBase Compatibility Mode)
Performance Tuning
Performance Tuning Overview
SQL Tuning
DDL Tuning
Performance White Paper
Performance Overview
TPC-C Test
Sysbench Test
API Documentation
History
Introduction
API Category
Making API Requests
Instance APIs
Security Group APIs
Task APIs
Backup APIs
Rollback APIs
Parameter APIs
Database APIs
Data Types
Error Codes
General Reference
System Architecture
SQL Reference
Database Parameter Description
TPC-H benchmark data model reference
Error Code Information
Security and Compliance
FAQs
Agreements
Service Level Agreement
Terms of Service
Privacy Policy
Data Processing And Security Agreement
Contact Us
Glossary

METADATA_LOCKS

PDF
포커스 모드
폰트 크기
마지막 업데이트 시간: 2026-02-10 11:06:28

Feature

METADATA_LOCKS records the current usage of metadata locks of SQLEngine, including:
Granted locks: Display which sessions currently possess which metadata locks.
Locks requested but not yet granted: Display which sessions are waiting for which metadata locks.
Lock requests terminated by the deadlock detector.
Lock requests that have timed out and are waiting for the request session to release the lock.
The feature is to help users quickly locate issues related to metadata locks (MDL) and improve system stability and performance.

Field Description

Field Name
Type
Description
OBJECT_TYPE
varchar(64)
Indicates the types of locked objects, such as TABLE, SCHEMA, FUNCTION, and MC.
Among them, MC is a lock for global objects newly introduced by TDSQL Boundless, which locks database objects at the cluster level.
OBJECT_SCHEMA
varchar(64)
Indicates the name of the database where the locked object is located.
OBJECT_NAME
varchar(64)
Indicates the name of the locked object.
COLUMN_NAME
varchar(64)
Indicates the name of the specific column of the locked object.
OBJECT_INSTANCE_BEGIN
bigint unsigned
Indicates the address of the locked object in memory.
LOCK_TYPE
varchar(32)
Indicates the types of locks.
INTENTION_EXCLUSIVE: Intention exclusive lock. This type of lock is usually used to indicate that a transaction intends to obtain an exclusive lock but has not yet actually obtained it.
SHARED: Shared lock. This type of lock allows multiple transactions to hold it but prevents any transaction from obtaining an exclusive lock.
SHARED_HIGH_PRIO: High-priority shared lock. This is a special type of shared lock used for high-priority transactions.
SHARED_READ: Shared read lock. It allows transactions to read data but prevents them from writing data or obtaining an exclusive lock.
SHARED_UPGRADABLE: Upgradeable shared lock. This type of lock allows a transaction to attempt to obtain an exclusive lock while holding a shared lock without being blocked.
SHARED_NO_WRITE: Shared lock that does not allow writing. This type of lock may prevent transactions from writing data but allows reading.
SHARED_NO_READ_WRITE: Shared lock that does not allow reading or writing. This type of lock prevents transactions from reading and writing data.
EXCLUSIVE: Exclusive lock. This type of lock allows only one transaction to hold it and prevents other transactions from obtaining any type of lock.
LOCK_DURATION
varchar(32)
Indicates the lock duration, such as TRANSACTION and LONG.
LOCK_STATUS
varchar(32)
Indicates the status of each lock:
PENDING: When a metadata lock is requested but not immediately obtained, insert a record with a status of PENDING.
GRANTED: When a metadata lock is requested and immediately obtained, insert a record with a status of GRANTED.
VICTIM: When the deadlock detector cancels a suspended lock request to break a deadlock (ER_LOCK_DEADLOCK), its row status is updated from PENDING to VICTIM. This indicates that the lock row is about to be deleted.
TIMEOUT: When a suspended lock request times out (ER_LOCK_WAIT_TIMEOUT), its row status is updated from PENDING to TIMEOUT. This indicates that the lock row is about to be deleted.
KILLED: When a granted lock or a lock request that is suspended is terminated, its row status is updated from GRANTED or PENDING to KILLED. This indicates that the lock row is about to be deleted.
SOURCE
varchar(64)
Indicates the name of the source file containing the detected code that generated the event and the line number in the file where the detection occurred.
OWNER_THREAD_ID
bigint unsigned
Indicates the ID of the thread holding the lock.
OWNER_EVENT_ID
bigint unsigned
Indicates the event ID of the metadata lock request.

Examples

#session1
BEGIN
UPDATE test1 SET k = 0 WHERE id = 999;

#session2
ALTER TABLE test1 ADD COLUMN new_column VARCHAR(255);

#By viewing metadata_locks, you can see that the DDL's attempt to obtain the metadata lock is suspended.
tdsql [performance_schema]> select * from metadata_locks where OBJECT_NAME='test1' \\G
*************************** 1. row ***************************
OBJECT_TYPE: TABLE
OBJECT_SCHEMA: etest
OBJECT_NAME: test1
COLUMN_NAME: NULL
OBJECT_INSTANCE_BEGIN: 140400821752448
LOCK_TYPE: EXCLUSIVE
LOCK_DURATION: TRANSACTION
LOCK_STATUS: PENDING
SOURCE: mdl.cc:3924
OWNER_THREAD_ID: 5670
OWNER_EVENT_ID: 1
1 row in set (0.00 sec)

도움말 및 지원

문제 해결에 도움이 되었나요?

피드백