Patch: innodb_deadlock_count.patch

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.

Version-Specific Information

Percona-Server Version Comments
5.1.47-11.0 Full functionality available.

Related Reading

Original post by Eric Bergen

Please note that this is NOT a place to ask questions or report bugs. This comment system is only intended for users to share tips and documentation additions concerning particular document.
Please report bugs to https://bugs.launchpad.net/percona-project/+filebug and ask general questions in maillist Percona-discussions

Discussion

Enter your comment (wiki syntax is allowed):
MLTWC
 
patches/innodb_deadlock_count.txt · Last modified: 2010/07/20 08:45 by stephane.combaudon
 
Except where otherwise noted, content on this wiki is licensed under the following license:GNU Free Documentation License 1.2
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki