------------------------ LATEST DETECTED DEADLOCK ------------------------ # 死锁发生的时间 2022-10-08 13:08:11 0x7f4e942bf700 # 与死锁相关的第一个事务信息 *** (1) TRANSACTION: # 事物ID,以及事务的活跃时间38秒,操作为 starting index read TRANSACTION 2853, ACTIVE 38 sec starting index read # 此事务使用了一个表,为一个表上了一个锁 mysql tables in use 1, locked 1 # 此事物 处于 lock wait 状态, 三个 锁结构 2个行级锁,1个表级意向锁,申请了heap size的大小 LOCK WAIT 3 lock struct(s), heap size 1136, 2 row lock(s) MySQL thread id 11, OS thread handle 139975469815552, query id 1882 localhost root statistics # 发生阻塞的 sql 语句 select * from user whereid = 3 for update *** (1) WAITING FOR THIS LOCK TO BE GRANTED: RECORD LOCKS space id 28 page no 3 n bits 72 index PRIMARY of table `test`.`user` trx id 2853 lock_mode X locks rec but not gap waiting Record lock, heap no 4 PHYSICAL RECORD: n_fields 5; compact format; info bits 0 主键值 0: len 8; hex 0000000000000003; asc ;; 1: len 6; hex 000000000b24; asc $;; 2: len 7; hex ba0000012f0110; asc / ;; 3: len 6; hex e78e8be4ba94; asc ;; 4: len 4; hex 80000019; asc ;; # 第二个事务信息 *** (2) TRANSACTION: TRANSACTION 2854, ACTIVE 27 sec starting index read mysql tables in use 1, locked 1 3 lock struct(s), heap size 1136, 2 row lock(s) MySQL thread id 10, OS thread handle 139975470085888, query id 1883 localhost root statistics select * from user whereid = 1 for update *** (2) HOLDS THE LOCK(S): RECORD LOCKS space id 28 page no 3 n bits 72 index PRIMARY of table `test`.`user` trx id 2854 lock_mode X locks rec but not gap Record lock, heap no 4 PHYSICAL RECORD: n_fields 5; compact format; info bits 0 0: len 8; hex 0000000000000003; asc ;; 1: len 6; hex 000000000b24; asc $;; 2: len 7; hex ba0000012f0110; asc / ;; 3: len 6; hex e78e8be4ba94; asc ;; 4: len 4; hex 80000019; asc ;;
*** (2) WAITING FOR THIS LOCK TO BE GRANTED: RECORD LOCKS space id 28 page no 3 n bits 72 index PRIMARY of table `test`.`user` trx id 2854 lock_mode X locks rec but not gap waiting Record lock, heap no 2 PHYSICAL RECORD: n_fields 5; compact format; info bits 0 0: len 8; hex 0000000000000001; asc ;; 1: len 6; hex 000000000b1e; asc ;; 2: len 7; hex b60000012a0110; asc * ;; 3: len 6; hex e5bca0e4b889; asc ;; 4: len 4; hex 80000017; asc ;;