Overview
Scenarios
Product Architecture
Instance Types
Compatibility Notes
METADATA_LOCKS records the current usage of metadata locks of SQLEngine, including: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. |
#session1BEGINUPDATE test1 SET k = 0 WHERE id = 999;#session2ALTER 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: TABLEOBJECT_SCHEMA: etestOBJECT_NAME: test1COLUMN_NAME: NULLOBJECT_INSTANCE_BEGIN: 140400821752448LOCK_TYPE: EXCLUSIVELOCK_DURATION: TRANSACTIONLOCK_STATUS: PENDINGSOURCE: mdl.cc:3924OWNER_THREAD_ID: 5670OWNER_EVENT_ID: 11 row in set (0.00 sec)
Apakah halaman ini membantu?
Anda juga dapat Menghubungi Penjualan atau Mengirimkan Tiket untuk meminta bantuan.
masukan