Mysql deadlock explanation needed

前端 未结 2 589
我寻月下人不归
我寻月下人不归 2020-12-10 14:20

I received the following deadlock log via \"SHOW INNODB STATUS\". Can someone care to explain why the transaction was aborted? It seems that Transaction 2 is holding the loc

2条回答
  •  遥遥无期
    2020-12-10 14:50

    I'm not 100% sure but I believe they are not "the same lock".

    * (1) WAITING FOR THIS LOCK TO BE GRANTED: RECORD LOCKS space id 0 page no 17549 n bits 128 index PRIMARY of table takeyourorder/jobs trx id 0 479286429 lock_mode X waiting Record lock, heap no 61 PHYSICAL RECORD: n_fields 26; compact format; info bits 0

    * (2) HOLDS THE LOCK(S): RECORD LOCKS space id 0 page no 17549 n bits 128 index PRIMARY of table takeyourorder/jobs trx id 0 479286425 lock_mode X locks rec but not gap Record lock, heap no 61 PHYSICAL RECORD: n_fields 26; compact format; info bits 0

    * (2) WAITING FOR THIS LOCK TO BE GRANTED: RECORD LOCKS space id 0 page no 17548 n bits 144 index PRIMARY of table takeyourorder/jobs trx id 0 479286425 lock_mode X locks rec but not gap waiting Record lock, heap no 73 PHYSICAL RECORD: n_fields 26; compact format; info bits 0

    Tx(2) holds "heap no 61" record lock and is waiting for "heap no 73" record lock. Tx(1) is waiting for "heap no 61". The log doesn't tell who holds "heap no 73" but maybe it's just a limitation of "SHOW ENGINE INNODB STATUS". You can confirm that similar log will be generated by simple deadlock scenario.

提交回复
热议问题