Skip to content

Commit 0063fb2

Browse files
authored
Update docs related to locking (#19248)
1 parent 049365d commit 0063fb2

File tree

3 files changed

+24
-8
lines changed

3 files changed

+24
-8
lines changed

information-schema/information-schema-data-lock-waits.md

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,12 @@ summary: Learn the `DATA_LOCK_WAITS` information_schema table.
77

88
The `DATA_LOCK_WAITS` table shows the ongoing lock-wait information on all TiKV nodes in a cluster, including the lock-wait information of pessimistic transactions and the information of optimistic transactions being blocked.
99

10-
{{< copyable "sql" >}}
11-
1210
```sql
1311
USE information_schema;
1412
DESC data_lock_waits;
1513
```
1614

17-
```sql
15+
```
1816
+------------------------+---------------------+------+------+---------+-------+
1917
| Field | Type | Null | Key | Default | Extra |
2018
+------------------------+---------------------+------+------+---------+-------+
@@ -71,13 +69,11 @@ In the above fields, if the information of a field is not applicable or currentl
7169
7270
## Example
7371

74-
{{< copyable "sql" >}}
75-
7672
```sql
7773
select * from information_schema.data_lock_waits\G
7874
```
7975

80-
```sql
76+
```
8177
*************************** 1. row ***************************
8278
KEY: 7480000000000000355F728000000000000001
8379
KEY_INFO: {"db_id":1,"db_name":"test","table_id":53,"table_name":"t","handle_type":"int","handle_value":"1"}
@@ -89,3 +85,17 @@ CURRENT_HOLDING_TRX_ID: 426790590082449409
8985
```
9086

9187
The above query result shows that the transaction of the ID `426790594290122753` is trying to obtain the pessimistic lock on the key `"7480000000000000355F728000000000000001"` when executing a statement that has digest `"38b03afa5debbdf0326a014dbe5012a62c51957f1982b3093e748460f8b00821"` and is in the form of ``update `t` set `v` = `v` + ? where `id` = ?``, but the lock on this key was held by the transaction of the ID `426790590082449409`.
88+
89+
## See also
90+
91+
<CustomContent platform="tidb">
92+
93+
- [Troubleshoot Lock Conflicts](/troubleshoot-lock-conflicts.md)
94+
95+
</CustomContent>
96+
97+
<CustomContent platform="tidb-cloud">
98+
99+
- [Handle Transaction Errors](/develop/dev-guide-transaction-troubleshoot.md)
100+
101+
</CustomContent>

mysql-schema/mysql-schema.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ Currently, the `help_topic` is NULL.
8484

8585
## System tables related to metadata locks
8686

87-
* `tidb_mdl_view`: a view of metadata locks. You can use it to view information about the currently blocked DDL statements
88-
* `tidb_mdl_info`: used internally by TiDB to synchronize metadata locks across nodes
87+
* `tidb_mdl_view`: a view of metadata locks. You can use it to view information about the currently blocked DDL statements. See also [Metadata Lock](/metadata-lock.md).
88+
* `tidb_mdl_info`: used internally by TiDB to synchronize metadata locks across nodes.
8989

9090
## System tables related to DDL statements
9191

troubleshoot-lock-conflicts.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,12 @@ In the above query, the [`TIDB_DECODE_SQL_DIGESTS`](/functions-and-operators/tid
159159

160160
If the `start_ts` of the current transaction is unknown, you can try to find it out from the information in the `TIDB_TRX` / `CLUSTER_TIDB_TRX` table or in the [`PROCESSLIST` / `CLUSTER_PROCESSLIST`](/information-schema/information-schema-processlist.md) table.
161161

162+
### Metadata locks
163+
164+
If a session is waiting on a schema change, this can be because of a metadata lock.
165+
166+
See [Metadata Lock](/metadata-lock.md) for more information.
167+
162168
## Troubleshoot optimistic lock conflicts
163169

164170
This section provides the solutions of common lock conflict issues in the optimistic transaction mode.

0 commit comments

Comments
 (0)