Buenas, he estado revisando las estadísticas de innodb de alguno de nuestros servidores y me he encontrado con deadlocks en uno de ellos...
ATEST DETECTED DEADLOCK ------------------------ 2015-11-06 16:00:00 7f61c5aa5700 *** (1) TRANSACTION: TRANSACTION 1422060913, ACTIVE 0 sec inserting mysql tables in use 1, locked 1 LOCK WAIT 9 lock struct(s), heap size 1184, 5 row lock(s), undo log entries 3 MySQL thread id 6495594, OS thread handle 0x7f61c526a700, query id 110695361 10.100.107.6 stats update INSERT INTO `test`.`test` (`test`,`test`,`test`,`test`,`test`,`test`) VALUES (2015,11,6,16,'iOS',1) *** (1) WAITING FOR THIS LOCK TO BE GRANTED: RECORD LOCKS space id 17528 page no 219 n bits 368 index `PRIMARY` of table `test`.`test` trx id 1422060913 lock_mode X insert intention waiting *** (2) TRANSACTION: TRANSACTION 1422060914, ACTIVE 0 sec inserting mysql tables in use 1, locked 1 9 lock struct(s), heap size 1184, 5 row lock(s), undo log entries 3 MySQL thread id 6495593, OS thread handle 0x7f61c5aa5700, query id 110695362 10.100.107.6 stats update INSERT INTO `test`.`test` (``,`test`,`test`,`test`,`test`,`test`) VALUES (2015,11,6,16,'Android',1) *** (2) HOLDS THE LOCK(S): RECORD LOCKS space id 17528 page no 219 n bits 368 index `PRIMARY` of table `test`.`test` trx id 1422060914 lock_mode X *** (2) WAITING FOR THIS LOCK TO BE GRANTED: RECORD LOCKS space id 17528 page no 219 n bits 368 index `PRIMARY` of table `test`.`test` trx id 1422060914 lock_mode X insert intention waiting *** WE ROLL BACK TRANSACTION (2) test son los datos de mi bbdd. Mi pregunta es, de la parte de sistemas hay alguna forma de poder evitarlo? Creo que la solución pasa por arreglarlo prográmaticamente, si detecta el error del deadlock, reintentarlo otra vez. Deadlock se produce cuando una transaccion espera por los recursos utilizados por otra transacción que a su vez espera por los recursos de otra. Consejos?

