问题描述
我需要帮助来解决我面临的僵局。感谢您的帮助。
我不明白:
- 为什么事务2在同一事务上需要一个S锁(一个缺口,偶数) 已有X锁(无间隙)的行?
- 为什么它拥有事务2所需的锁?不是吗 只是等待阻止它的记录锁被释放 而没有得到任何锁?
------------------------
LATEST DETECTED DEADLOCK
------------------------
2020-09-14 09:30:07 2b506443a700
*** (1) TRANSACTION:
TRANSACTION 3286459055,ACTIVE 2 sec starting index read
mysql tables in use 1,locked 1
LOCK WAIT 2 lock struct(s),heap size 376,1 row lock(s)
MySQL thread id 2371545,OS thread handle 0x2b54bdad9700,query id 378353035 admin updating
DELETE FROM `category_item` WHERE `category_item`.`category_id` = 67827
*** (1) WAITING FOR THIS LOCK TO BE GRANTED:
RECORD LOCKS space id 1994082 page no 31668 n bits 305 index `PRIMARY` of table `category_item` trx id 3286459055 lock_mode X waiting
Record lock,heap no 305 PHYSICAL RECORD: n_fields 4; compact format; info bits 0
0: len=4; bufptr=0x2b38e1a51f43; hex= 800108f3; asc ;;
1: len=4; bufptr=0x2b38e1a51f47; hex= 80036c8c; asc l ;;
2: len=6; bufptr=0x2b38e1a51f4b; hex= 0000c3e36241; asc bA;;
3: len=7; bufptr=0x2b38e1a51f51; hex= a20339c012011f; asc 9 ;;
*** (2) TRANSACTION:
TRANSACTION 3286458945,ACTIVE 4 sec starting index read
mysql tables in use 3,locked 3
LOCK WAIT 207 lock struct(s),14575 row lock(s),undo log entries 5900
MySQL thread id 2371540,OS thread handle 0x2b553dd73700,query id 378354050 admin Sending data
INSERT IGNORE INTO category_item_included(category_id,item_id)
SELECT DISTINCT category_included.category_id,item_id
FROM category_item JOIN category_included
ON category_included_id = category_item.category_id
where category_included.category_id in (44044,44047,44074,44461,67827)
*** (2) HOLDS THE LOCK(S):
RECORD LOCKS space id 1994082 page no 31668 n bits 305 index `PRIMARY` of table `category_item` trx id 3286458945 lock_mode X locks rec but not gap
Record lock,heap no 305 PHYSICAL RECORD: n_fields 4; compact format; info bits 0
0: len=4; bufptr=0x2b38e1a51f43; hex= 800108f3; asc ;;
1: len=4; bufptr=0x2b38e1a51f47; hex= 80036c8c; asc l ;;
2: len=6; bufptr=0x2b38e1a51f4b; hex= 0000c3e36241; asc bA;;
3: len=7; bufptr=0x2b38e1a51f51; hex= a20339c012011f; asc 9 ;;
*** (2) WAITING FOR THIS LOCK TO BE GRANTED:
RECORD LOCKS space id 1994082 page no 31668 n bits 305 index `PRIMARY` of table `category_item` trx id 3286458945 lock mode S waiting
Record lock,heap no 305 PHYSICAL RECORD: n_fields 4; compact format; info bits 0
0: len=4; bufptr=0x2b38e1a51f43; hex= 800108f3; asc ;;
1: len=4; bufptr=0x2b38e1a51f47; hex= 80036c8c; asc l ;;
2: len=6; bufptr=0x2b38e1a51f4b; hex= 0000c3e36241; asc bA;;
3: len=7; bufptr=0x2b38e1a51f51; hex= a20339c012011f; asc 9 ;;
非常感谢
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)