21.6.15.33 The ndbinfo server_locks Table (original) (raw)
21.6.15.33 The ndbinfo server_locks Table
The server_locks
table is similar in structure to the cluster_locks
table, and provides a subset of the information found in the latter table, but which is specific to the SQL node (MySQL server) where it resides. (The cluster_locks
table provides information about all locks in the cluster.) More precisely,server_locks
contains information about locks requested by threads belonging to the currentmysqld instance, and serves as a companion table to server_operations. This may be useful for correlating locking patterns with specific MySQL user sessions, queries, or use cases.
The server_locks
table contains the following columns:
mysql_connection_id
MySQL connection IDnode_id
ID of reporting nodeblock_instance
ID of reporting LDM instancetableid
ID of table containing this rowfragmentid
ID of fragment containing locked rowrowid
ID of locked rowtransid
Transaction IDmode
Lock request modestate
Lock statedetail
Whether this is first holding lock in row lock queueop
Operation typeduration_millis
Milliseconds spent waiting or holding locklock_num
ID of lock objectwaiting_for
Waiting for lock with this ID
Notes
The mysql_connection_id
column shows the MySQL connection or thread ID as shown bySHOW PROCESSLIST.
block_instance
refers to an instance of a kernel block. Together with the block name, this number can be used to look up a given instance in thethreadblocks table.
The tableid
is assigned to the table byNDB
; the same ID is used for this table in other ndbinfo
tables, as well as in the output of ndb_show_tables.
The transaction ID shown in the transid
column is the identifier generated by the NDB API for the transaction requesting or holding the current lock.
The mode
column shows the lock mode, which is always one of S
(shared lock) orX
(exclusive lock). If a transaction has an exclusive lock on a given row, all other locks on that row have the same transaction ID.
The state
column shows the lock state. Its value is always one of H
(holding) orW
(waiting). A waiting lock request waits for a lock held by a different transaction.
The detail
column indicates whether this lock is the first holding lock in the affected row's lock queue, in which case it contains a *
(asterisk character); otherwise, this column is empty. This information can be used to help identify the unique entries in a list of lock requests.
The op
column shows the type of operation requesting the lock. This is always one of the valuesREAD
, INSERT
,UPDATE
, DELETE
,SCAN
, or REFRESH
.
The duration_millis
column shows the number of milliseconds for which this lock request has been waiting or holding the lock. This is reset to 0 when a lock is granted for a waiting request.
The lock ID (lockid
column) is unique to this node and block instance.
If the lock_state
column's value isW
, this lock is waiting to be granted, and the waiting_for
column shows the lock ID of the lock object this request is waiting for. Otherwise,waiting_for
is empty.waiting_for
can refer only to locks on the same row (as identified by node_id
,block_instance
, tableid
,fragmentid
, and rowid
).
The server_locks
table was added in NDB 7.5.3.