Slide 52
Slide 52 text
DBのエラーログの読み方(5)
------------------------
LATEST DETECTED DEADLOCK
------------------------
2020-06-18 15:32:07 7f76dd7c1700
*** (1) TRANSACTION:
TRANSACTION 2464, ACTIVE 15 sec starting index read
mysql tables in use 1, locked 1
LOCK WAIT 4 lock struct(s), heap size 1184, 6 row lock(s), undo log entries 1
MySQL thread id 6, OS thread handle 0x7f76dd77f700, query id 150 localhost root updating
update lockt2 set name = 'hogehoge' where pk = 2
*** (1) WAITING FOR THIS LOCK TO BE GRANTED:
RECORD LOCKS space id 22 page no 3 n bits 72 index `GEN_CLUST_INDEX` of table `test`.`lockt2`
trx id 2464 lock_mode X waiting
Record lock, heap no 2 PHYSICAL RECORD: n_fields 7; compact format; info bits 0
0: len 6; hex 000000000204; asc ;;
1: len 6; hex 000000000992; asc ;;
2: len 7; hex e8000001bd0110; asc ;;
3: len 8; hex 0000000000000001; asc ;;
4: len 4; hex 5461726f; asc Taro;;
5: len 5; hex 4170706c65; asc Apple;;
6: len 5; hex 546f6b796f; asc Tokyo;;
*** (2) TRANSACTION:
TRANSACTION 2465, ACTIVE 5 sec starting index read
mysql tables in use 1, locked 1
4 lock struct(s), heap size 1184, 6 row lock(s), undo log entries 1
MySQL thread id 4, OS thread handle 0x7f76dd7c1700, query id 151 localhost root updating
update lockt1 set name = 'hogehoge' where pk = 2
*** (2) HOLDS THE LOCK(S):
RECORD LOCKS space id 22 page no 3 n bits 72 index `GEN_CLUST_INDEX` of table
`test`.`lockt2` trx id 2465 lock_mode X
Record lock, heap no 1 PHYSICAL RECORD: n_fields 1; compact format; info bits 0
0: len 8; hex 73757072656d756d; asc supremum;;
*** (2) WAITING FOR THIS LOCK TO BE GRANTED:
RECORD LOCKS space id 23 page no 3 n bits 72 index `GEN_CLUST_INDEX` of table `test`.`lockt1`
trx id 2465 lock_mode X waiting
Record lock, heap no 2 PHYSICAL RECORD: n_fields 7; compact format; info bits 0
0: len 6; hex 000000000208; asc ;;
1: len 6; hex 00000000099b; asc ;;
2: len 7; hex ef000001c20110; asc ;;
3: len 8; hex 0000000000000001; asc ;;
4: len 4; hex 5461726f; asc Taro;;
5: len 5; hex 4170706c65; asc Apple;;
6: len 5; hex 546f6b796f; asc Tokyo;;
・HOLDS THE LOCK(S) はTRANSACTION2側しか表示してくれ
ない
TRANSACTION 1 TRANSACTION 2
BEGIN
クエリ?
UPDATE lockt2
lockt1 pk=2
lockt2 pk=2
クエリ?
UPDATE lockt1
ERR
BEGIN
COMMIT
?
待ち 待ち
ロック