| 1 |
drop table if exists t1,t2; |
| 2 |
connect a,localhost,root,,; |
| 3 |
connect b,localhost,root,,; |
| 4 |
connection a; |
| 5 |
set binlog_format=mixed; |
| 6 |
set session transaction isolation level repeatable read; |
| 7 |
create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1; |
| 8 |
insert into t1 values (1),(2),(3),(4),(5),(6),(7); |
| 9 |
set autocommit=0; |
| 10 |
select * from t1 where a=3 lock in share mode; |
| 11 |
a |
| 12 |
3 |
| 13 |
connection b; |
| 14 |
set binlog_format=mixed; |
| 15 |
set session transaction isolation level repeatable read; |
| 16 |
set autocommit=0; |
| 17 |
update t1 set a=10 where a=5; |
| 18 |
ERROR HY000: Lock wait timeout exceeded; try restarting transaction |
| 19 |
commit; |
| 20 |
connection a; |
| 21 |
commit; |
| 22 |
connection b; |
| 23 |
set innodb_snapshot_isolation=off; |
| 24 |
set session transaction isolation level read committed; |
| 25 |
update t1 set a=10 where a=5; |
| 26 |
connection a; |
| 27 |
select * from t1 where a=2 for update; |
| 28 |
ERROR HY000: Lock wait timeout exceeded; try restarting transaction |
| 29 |
select * from t1 where a=2 limit 1 for update; |
| 30 |
a |
| 31 |
2 |
| 32 |
connection b; |
| 33 |
update t1 set a=11 where a=6; |
| 34 |
update t1 set a=12 where a=2; |
| 35 |
ERROR HY000: Lock wait timeout exceeded; try restarting transaction |
| 36 |
update t1 set a=13 where a=1; |
| 37 |
ERROR HY000: Lock wait timeout exceeded; try restarting transaction |
| 38 |
connection a; |
| 39 |
commit; |
| 40 |
connection b; |
| 41 |
update t1 set a=14 where a=1; |
| 42 |
commit; |
| 43 |
connection a; |
| 44 |
select * from t1; |
| 45 |
a |
| 46 |
14 |
| 47 |
2 |
| 48 |
3 |
| 49 |
4 |
| 50 |
10 |
| 51 |
11 |
| 52 |
7 |
| 53 |
drop table t1; |
| 54 |
connection default; |
| 55 |
disconnect a; |
| 56 |
disconnect b; |
| 57 |
create table t1 (a int, b int) engine=myisam; |
| 58 |
create table t2 (c int, d int, key (c)) engine=innodb; |
| 59 |
insert into t1 values (1,1); |
| 60 |
insert into t2 values (1,2); |
| 61 |
connect a,localhost,root,,; |
| 62 |
connection a; |
| 63 |
set session transaction isolation level read committed; |
| 64 |
delete from t1 using t1 join t2 on t1.a = t2.c where t2.d in (1); |
| 65 |
connection default; |
| 66 |
disconnect a; |
| 67 |
drop table t1, t2; |