Skip to content

Commit e95aebb

Browse files
authored
Update and rename table_lock_wait.md to innodb_locking.md
1 parent 9a1547d commit e95aebb

File tree

1 file changed

+36
-3
lines changed

1 file changed

+36
-3
lines changed

concurrency_control/table_lock_wait.md renamed to concurrency_control/innodb_locking.md

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,45 @@
11
# How to Measure Transaction Lock Waits in MySQL/InnoDB
22

33
## Overview
4+
- Drilldown the transaction wait event
45

5-
### How query thread is executed
6+
## Related MySQL Source Code
7+
8+
### Query Graphs
9+
```bash
10+
A query graph consists of nodes linked to each other in various ways. The
11+
execution starts at que_run_threads() which takes a que_thr_t parameter.
12+
que_thr_t contains two fields that control query graph execution: run_node
13+
and prev_node. run_node is the next node to execute and prev_node is the
14+
last node executed.
15+
16+
Each node has a pointer to a 'next' statement, i.e., its brother, and a
17+
pointer to its parent node. The next pointer is NULL in the last statement
18+
of a block.
19+
20+
Loop nodes contain a link to the first statement of the enclosed statement
21+
list. While the loop runs, que_thr_step() checks if execution to the loop
22+
node came from its parent or from one of the statement nodes in the loop. If
23+
it came from the parent of the loop node it starts executing the first
24+
statement node in the loop. If it came from one of the statement nodes in
25+
the loop, then it checks if the statement node has another statement node
26+
following it, and runs it if so.
27+
28+
To signify loop ending, the loop statements (see e.g. while_step()) set
29+
que_thr_t->run_node to the loop node's parent node. This is noticed on the
30+
next call of que_thr_step() and execution proceeds to the node pointed to by
31+
the loop node's 'next' pointer.
32+
```
633
- que_node_t* node : Gets information of an SQL query graph node.
34+
- que_thr_move_to_run_state(): moves a thread state to QUE_THR_RUNNING state.
735
- que0que.cc : que_thr_end_lock_wait()
8-
- thd_report_row_lock_wait()
36+
37+
### Lock
938
- lock_grant()
1039
- lock_trx_has_rec_x_lock()
11-
-
40+
- thd_report_row_lock_wait()
41+
42+
### Transaction
1243
- trx0trx.h: Transaction lock wait
1344
- QUE_THR_LOCK_WAIT
1445
-
@@ -117,6 +148,8 @@ struct trx_lock_t {
117148
118149
119150
## Reference
151+
- https://dev.mysql.com/blog-archive/innodb-data-locking-part-1-introduction/
152+
- https://dev.mysql.com/blog-archive/innodb-data-locking-part-2-locks/
120153
- https://dev.mysql.com/doc/mysql-perfschema-excerpt/8.0/en/performance-schema-transaction-summary-tables.html
121154
- https://dev.mysql.com/doc/mysql-perfschema-excerpt/5.7/en/performance-schema-table-handles-table.html
122155
- https://dev.mysql.com/doc/mysql-perfschema-excerpt/5.7/en/performance-schema-table-lock-waits-summary-by-table-table.html

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy