我有一个InnoDB表“ test”,并且有两个事务查询该表。
会议1:
start transaction;
select * from test where testid = 200 lock in share mode;
会议2:
start transaction;
select * from test where testid = 200 lock in share mode;
会议1:
select * from test where testid = 200 for update;
-- Trying to get X lock and waits as session 2 already has a shared lock for this entry
会议2:
select * from test where testid = 200 for update;
--Deadlock occurs because of Shared lock of session 1
有没有摆脱这种情况的方法?