Overview
Scenarios
Product Architecture
Instance Types
Compatibility Notes
Usage specification recommendations
TDSTORE_PART_CTX is used to display all information about pessimistic lock waiting on the TDStore of all hybrid nodes in the cluster.Field Name | Type | Nullable | Description |
trans_id | bigint unsigned | No | The unique identifier of a transaction. |
state | varchar(16) | No | Status of the participant. RUNNING: The participant is in the read-write phase (that is, has not yet entered the commit process), and is not blocked by pessimistic locks.WAIT LOCK: The participant is in the read-write phase and is being blocked by a pessimistic lock (in this case, requested_lock_id and blocking_lock_id must not be NULL).COMMITTING: The participant is attempting to commit (which does not mean that the transaction will ultimately be committed successfully).ROLLING BACK: The participant is rolling back. |
commit_state | varchar(10) | No | Commit status of the participant. INIT: The participant has not yet entered the commit process, or has entered the commit process and is synchronizing redo/prepare logs.FAILED: The participant failed to prepare.PREPARE: The 2PC prepare of the participant succeeds.COMMIT: The 2PC commit of the participant succeeds.ABORT: The 2PC prepare of the participant succeeds, but aborts in the second phase.CLEAR: After the participant commits or aborts, it is about to release the participant context (this state is very brief).The state transition is as shown in the figure below: ![]() |
snapshot_ts | bigint unsigned | No | Timestamp of snapshot reading for the participant. |
prepare_ts | bigint unsigned | Yes | The prepare timestamp of the transaction. All participants that have prepared in the transaction share the same prepare timestamp. When a participant has not yet prepared, the value is NULL. |
commit_ts | bigint unsigned | Yes | The commit timestamp of the transaction. All participants that have committed in the transaction share the same commit timestamp. When a participant has not yet committed, the value is NULL. |
is_replay | int | No | If the value is 1, it indicates that the participant is advancing 2PC by replaying raft log. This generally occurs on a Follower, but may also occur before the Leader takes office. |
data_space_type | varchar(32) | No | The data space corresponding to the participant. DATA_SPACE_TYPE_USER indicates that the participant accessed user tables; DATA_SPACE_TYPE_SYSTEM indicates that the participant accessed system tables. |
replication_group_id | bigint unsigned | No | Replication group ID of the participant. |
coordinator_replication_group_id | bigint unsigned | Yes | The replication group ID of the coordinator. When the participant has not yet prepared, the value is NULL. |
expired_time | datetime | No | Time for participant release due to timeout. |
requested_lock_id | varchar(128) | Yes | The unique identifier for the pessimistic lock being applied for or the key range being read. The format refers to the ENGINE_LOCK_ID field in the data_locks table. If there is no pending pessimistic lock, the value is NULL. |
blocking_lock_id | varchar(128) | Yes | The unique identifier for the pending pessimistic lock. The format refers to the ENGINE_LOCK_ID field in the data_locks table. If there is no pending pessimistic lock, the value is NULL. |
lock_wait_milliseconds | bigint unsigned | No | Cumulative time spent waiting for pessimistic locks (unit: ms). |
single_keys_locked | bigint unsigned | No | The number of pessimistic locks held on a single key. |
ranges_locked | bigint unsigned | No | The number of key-range pessimistic locks held. |
write_batch_size | bigint unsigned | Yes | write batch size (unit: bytes). A NULL value indicates that the bthread collecting participant information failed to obtain the lock of the participant and thus could not retrieve the relevant information. In this case, it is highly likely that the participant is waiting for the release of a pessimistic lock. |
lock_memory_usage | bigint unsigned | Yes | The memory consumed by pessimistic locks (unit: bytes). A NULL value indicates that the bthread collecting participant information failed to obtain the lock of the participant and thus could not retrieve the relevant information. In this case, it is highly likely that the participant is waiting for the release of a pessimistic lock. |
isolation_level | varchar(16) | No | Isolation level. TDStore supports only two isolation levels: REPEATABLE_READ and READ_COMMITTED. |
submit_pending_log_num | bigint unsigned | Yes | The number of raft logs being synchronized. A NULL value indicates that the bthread collecting participant information failed to obtain the lock of the participant and thus could not retrieve the relevant information; in this case, it is highly likely that the participant is waiting for the release of a pessimistic lock. |
note | varchar(256) | No | Remark information. Empty string: no remarks. fail to acquire participant lock: Failed to obtain the participant lock. In this case, the values of some fields (such as write_batch_size) are NULL. |
node_name | varchar(256) | Yes | The node name of the SQLEngine for enabling this transaction participant. |
thread_id | bigint unsigned | No | The thread ID running this transaction participant. This is an internal thread ID in the Performance Schema, unique within the Performance Schema's lifecycle, and can be used to reliably correlate various event tables in the Performance Schema. |
sql_session_id | bigint unsigned | No | The session ID corresponding to the connection that enabled this transaction participant. |
tdsql [(none)]> SELECT * FROM information_schema.tdstore_part_ctx LIMIT 3\\G*************************** 1. row ***************************trans_id: 28707112062290305state: RUNNINGcommit_state: INITsnapshot_ts: 28707112062290305prepare_ts: NULLcommit_ts: NULLis_replay: 0data_space_type: DATA_SPACE_TYPE_USERreplication_group_id: 257coordinator_replication_group_id: NULLexpired_time: 2024-03-22 11:23:37requested_lock_id: NULLblocking_lock_id: NULLlock_wait_milliseconds: 0single_keys_locked: 4ranges_locked: 0write_batch_size: 3219lock_memory_usage: 1008isolation_level: REPEATABLE_READsubmit_pending_log_num: 0note:node_name: node-1-001thread_id: 65sql_session_id: 1048736*************************** 2. row ***************************trans_id: 28707112062290205state: COMMITTINGcommit_state: PREPAREsnapshot_ts: 28707112062290205prepare_ts: 28707112062290205commit_ts: 28707112062290368is_replay: 0data_space_type: DATA_SPACE_TYPE_USERreplication_group_id: 257coordinator_replication_group_id: 257expired_time: 2024-03-22 11:23:37requested_lock_id: NULLblocking_lock_id: NULLlock_wait_milliseconds: 0single_keys_locked: 7ranges_locked: 0write_batch_size: NULLlock_memory_usage: NULLisolation_level: REPEATABLE_READsubmit_pending_log_num: NULLnote: fail to acquire participant locknode_name: node-1-001thread_id: 65sql_session_id: 1048736*************************** 3. row ***************************trans_id: 28707111676413643state: LOCK WAITcommit_state: INITsnapshot_ts: 28707111676413643prepare_ts: NULLcommit_ts: NULLis_replay: 0data_space_type: DATA_SPACE_TYPE_USERreplication_group_id: 257coordinator_replication_group_id: NULLexpired_time: 2024-03-22 11:23:14requested_lock_id: 28707111676413643_0000279C80018657blocking_lock_id: 28707111676413316_0000279C80018657lock_wait_milliseconds: 0single_keys_locked: 4ranges_locked: 0write_batch_size: NULLlock_memory_usage: NULLisolation_level: REPEATABLE_READsubmit_pending_log_num: NULLnote: fail to acquire participant locknode_name: node-1-002thread_id: 65sql_session_id: 1048704
-- Query the number of participants on the current node.SELECT COUNT(*) FROM information_schema.tdstore_part_ctx \\G-- Query participant information for replication group 257 on the current node.SELECT * FROM information_schema.tdstore_part_ctx WHERE replication_group_id = 257 \\G-- Query participant information during the commit process on the current node.SELECT * FROM information_schema.tdstore_part_ctx WHERE state = 'COMMITTING' \\G-- Query information on transactions with execution time exceeding 5s on the current node (currently, shifting trans_id right by 24 bits yields the unix timestamp of the transaction start time).SELECT * FROM information_schema.tdstore_part_ctx WHERE trans_id >> 24 < UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 5 SECOND)) \\G-- Query information on large transactions with size of the write batch exceeding 128 MB on the current node (the data written by the transaction is stored in the write batch)SELECT * FROM information_schema.tdstore_part_ctx WHERE write_batch_size > 128 * 1024 * 1024 \\G
피드백