Deadlock after upgrading to 5.7 from 5.6
General
Escalation
General
Escalation
Description
Environment
None
Attachments
1
Smart Checklist
Activity
Show:

Lalit Choudhary June 20, 2019 at 8:59 AM
Hello Pooja,
Please post this question to our forum,
https://www.percona.com/forums/questions-discussions/mysql-and-percona-server/percona-server-5-7
Also, you can refer,
https://dev.mysql.com/doc/refman/5.7/en/innodb-deadlocks-handling.html
Hi,
We are started facing deadlock issue very frequently after upgrading to 5.7
There are no changes in application and application was running fine before upgrade.
Version: | 5.7.25-28-log |
Latest Deadlock from innodb status:
------------------------
LATEST DETECTED DEADLOCK
------------------------
2019-06-20 10:49:01 0x7fd7d7919700
(1) TRANSACTION:
TRANSACTION 76157437744, ACTIVE 0 sec inserting
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 5999151, OS thread handle 140565033457408, query id 1157758472 10.72.30.174 morpheus_write update
INSERT INTO `targets` (`campaignid`, `targetkey`, `priority`, `destination`, `status`, `nextattempt`) VALUES ('166369', 'RT-API-1560991741.5838-5d0ad7fd8e968', 1, '0452162373', 'READY', NULL) ON DUPLICATE KEY UPDATE `targetid` = LAST_INSERT_ID(`targetid`), `destination` = VALUES(`destination`)
(1) WAITING FOR THIS LOCK TO BE GRANTED:
RECORD LOCKS space id 210 page no 7923783 n bits 144 index campaignid of table `morpheus`.`targets` trx id 76157437744 lock_mode X locks gap before rec insert intention waiting
(2) TRANSACTION:
TRANSACTION 76157437737, ACTIVE 0 sec inserting
mysql tables in use 1, locked 1
4 lock struct(s), heap size 1136, 3 row lock(s), undo log entries 1
MySQL thread id 5999154, OS thread handle 140565011339008, query id 1157758444 10.72.30.174 morpheus_write update
INSERT INTO `targets` (`campaignid`, `targetkey`, `priority`, `destination`, `status`, `nextattempt`) VALUES ('166369', 'RT-API-1560991741.5748-5d0ad7fd8c59b', 1, '0447272344', 'READY', NULL) ON DUPLICATE KEY UPDATE `targetid` = LAST_INSERT_ID(`targetid`), `destination` = VALUES(`destination`)
(2) HOLDS THE LOCK(S):
RECORD LOCKS space id 210 page no 7923783 n bits 144 index campaignid of table `morpheus`.`targets` trx id 76157437737 lock_mode X locks gap before rec
(2) WAITING FOR THIS LOCK TO BE GRANTED:
RECORD LOCKS space id 210 page no 7923783 n bits 144 index campaignid of table `morpheus`.`targets` trx id 76157437737 lock_mode X locks gap before rec insert intention waiting
WE ROLL BACK TRANSACTION (1)
------------
I have also enabled innodb_print_all_deadlocks, Attached error log.
mysql> show variables like '%deadlock%';
-----------------------------------+
Variable_name
Value
-----------------------------------+
innodb_deadlock_detect
ON
innodb_print_all_deadlocks
ON
-----------------------------------+
2 rows in set (0.00 sec)
mysql>