innodb_print_all_deadlocks

当mysql 数据库发生死锁时, innodb status 里面会记录最后一次死锁的相关信息,但mysql 错误日志里面

不会记录死锁相关信息,要想记录,启动 innodb_print_all_deadlocks  参数 。

当系统并发很高时,很多的线程等待同一个行锁,死锁检测可能会拖慢系统,这个时候关闭死锁检测可能更好

innodb_deadlock_detect 5.7.15 版本才有)。让线程自动超时。


mysql> show variables like 'innodb_print_all_deadlocks';
+----------------------------+-------+
| Variable_name              | Value |
+----------------------------+-------+
| innodb_print_all_deadlocks | ON    |
+----------------------------+-------+


2018-07-13T12:57:35.621054+08:00 21018 [Note] InnoDB: 
*** (1) TRANSACTION:

TRANSACTION 1344, ACTIVE 9 sec starting index read
mysql tables in use 1, locked 1
LOCK WAIT 3 lock struct(s), heap size 1136, 2 row lock(s), undo log entries 1
MySQL thread id 21019, OS thread handle 139626295346944, query id 42108 localhost root updating
delete from t1 where id=1
2018-07-13T12:57:35.621146+08:00 21018 [Note] InnoDB: *** (1) WAITING FOR THIS LOCK TO BE GRANTED:

RECORD LOCKS space id 27 page no 3 n bits 72 index PRIMARY of table `test`.`t1` trx id 1344 lock_mode X locks rec but not gap waiting
Record lock, heap no 2 PHYSICAL RECORD: n_fields 3; compact format; info bits 32
 0: len 4; hex 80000001; asc     ;;
 1: len 6; hex 00000000053b; asc      ;;;
 2: len 7; hex 28000000360110; asc (   6  ;;

2018-07-13T12:57:35.621428+08:00 21018 [Note] InnoDB: *** (2) TRANSACTION:

TRANSACTION 1339, ACTIVE 35 sec starting index read, thread declared inside InnoDB 5000
mysql tables in use 1, locked 1
3 lock struct(s), heap size 1136, 2 row lock(s), undo log entries 1
MySQL thread id 21018, OS thread handle 139626295879424, query id 42109 localhost root updating
delete from t1 where id=2
2018-07-13T12:57:35.621532+08:00 21018 [Note] InnoDB: *** (2) HOLDS THE LOCK(S):

RECORD LOCKS space id 27 page no 3 n bits 72 index PRIMARY of table `test`.`t1` trx id 1339 lock_mode X locks rec but not gap
Record lock, heap no 2 PHYSICAL RECORD: n_fields 3; compact format; info bits 32
 0: len 4; hex 80000001; asc     ;;
 1: len 6; hex 00000000053b; asc      ;;;
 2: len 7; hex 28000000360110; asc (   6  ;;

2018-07-13T12:57:35.621739+08:00 21018 [Note] InnoDB: *** (2) WAITING FOR THIS LOCK TO BE GRANTED:

RECORD LOCKS space id 27 page no 3 n bits 72 index PRIMARY of table `test`.`t1` trx id 1339 lock_mode X locks rec but not gap waiting
Record lock, heap no 3 PHYSICAL RECORD: n_fields 3; compact format; info bits 32
 0: len 4; hex 80000002; asc     ;;
 1: len 6; hex 000000000540; asc      @;;
 2: len 7; hex 2b000000300409; asc +   0  ;;

2018-07-13T12:57:35.621965+08:00 21018 [Note] InnoDB: *** WE ROLL BACK TRANSACTION (2)

2018-07-13T12:57:54.527054+08:00 21023 [Note] Access denied for user 'repl'@'10.10.19.202' (using password: YES)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

huangliang0703

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值