1
drop table if exists t1;
2
set session transaction isolation level read committed;
3
create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
4
insert into t1 values (1),(2),(3),(4),(5),(6),(7);
6
select * from t1 where a=3 lock in share mode;
9
set session transaction isolation level read committed;
11
update t1 set a=10 where a=5;
12
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
14
update t1 set a=10 where a=5;
15
select * from t1 where a=2 for update;
16
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
17
select * from t1 where a=2 limit 1 for update;
20
update t1 set a=11 where a=6;
21
update t1 set a=12 where a=2;
22
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
23
update t1 set a=13 where a=1;
24
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
26
update t1 set a=14 where a=1;