The patch is provided by Eric Bergen under BSD license (see InnoDB Deadlock Count Patch).
It adds a new global status variable (Innodb_deadlocks) showing the number of deadlocks*.
You can use it with SHOW GLOBAL STATUS:
mysql> SHOW GLOBAL_STATUS LIKE 'Innodb_deadlocks'; +------------------+-------+ | Variable_name | Value | +------------------+-------+ | Innodb_deadlocks | 323 | +------------------+-------+
or with INFORMATION_SCHEMA:
mysql> SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_deadlocks'; +----------------+ | VARIABLE_VALUE | +----------------+ | 323 | +----------------+
*A deadlock will occur when at least two transactions are mutually waiting for the other to finish, thus creating a circular dependency that lasts until something breaks it. InnoDB is quite good at detecting deadlocks and generally returns an error instantly. Most transactional systems have no way to prevent deadlocks from occurring and must be designed to handle them, for instance by retrying the transaction that failed.
| Percona-Server Version | Comments |
|---|---|
| 5.1.47-11.0 | Full functionality available. |
Original post by Eric Bergen
Please report bugs to https://bugs.launchpad.net/percona-project/+filebug and ask general questions in maillist Percona-discussions
Discussion