Details
-
Task
-
Status: Open (View Workflow)
-
Minor
-
Resolution: Unresolved
-
None
-
None
-
None
Description
Right now deadlock information is only available globally for the most recent deadlock in SHOW ENGINE INNODB STATUS, so a client can never be sure that the information in there is indeed for the deadlock that happened in this connection, or whether it has already been overwritten by another deadlock incident in another session.
The information returned by SHOW WARNINGS does not include any detail information yet:
> update t1 set x=42 where id=1;
|
ERROR 1213 (40001): Deadlock found when trying to get lock; try restarting transaction
|
MariaDB (10.3.5-MariaDB) [test]
|
 |
> show warnings;
|
+-------+------+--------------------------------------------------------------------+
|
| Level | Code | Message |
|
+-------+------+--------------------------------------------------------------------+
|
| Error | 1213 | Deadlock found when trying to get lock; try restarting transaction |
|
| Error | 1213 | Deadlock found when trying to get lock; try restarting transaction |
|
+-------+------+--------------------------------------------------------------------+
|
Alternative: have a SHOW ENGINE INNODB STATUS command that shows details on the most recent deadlock on a per-session basis instead of having it global only
(there's innodb_print_all_deadlocks=1 which at least makes sure that information for every deadlock is logged in the error log, but this is not easily accessible to clients)