LockはRDBMSには不可欠ですが、Dead Lockは出来るだけ回避したいLock。
SHOW ENGINE INNODB STATUS以外でもMySQL5.6からログに記録出来るようになってます。

mysql> show variables like 'innodb_print_all_deadlocks';

+----------------------------+-------+
| Variable_name              | Value |
+----------------------------+-------+
| innodb_print_all_deadlocks | OFF   |
+----------------------------+-------+
1 row in set (0.00 sec)


mysql> set innodb_print_all_deadlocks=ON;

ERROR 1229 (HY000): Variable 'innodb_print_all_deadlocks' is a GLOBAL variable and should be set with SET GLOBAL

mysql> set global innodb_print_all_deadlocks=ON;

Query OK, 0 rows affected (0.00 sec)

mysql> show variables like 'innodb_print_all_deadlocks';

+----------------------------+-------+
| Variable_name              | Value |
+----------------------------+-------+
| innodb_print_all_deadlocks | ON    |
+----------------------------+-------+

1 row in set (0.00 sec)

 
mysql>

参考: http://thinkit.co.jp/story/2013/11/19/4670/page/0/1

Comments are closed.

Post Navigation