| 1 |
drop table if exists t1; |
| 2 |
set binlog_format=mixed; |
| 3 |
Warnings: |
| 4 |
Warning 1287 '@@binlog_format' is deprecated and will be removed in a future release. |
| 5 |
set session transaction isolation level repeatable read; |
| 6 |
set autocommit=0; |
| 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 |
select * from t1 where a=3 lock in share mode; |
| 10 |
a |
| 11 |
3 |
| 12 |
set binlog_format=mixed; |
| 13 |
Warnings: |
| 14 |
Warning 1287 '@@binlog_format' is deprecated and will be removed in a future release. |
| 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 |
commit; |
| 21 |
set session transaction isolation level read committed; |
| 22 |
update t1 set a=10 where a=5; |
| 23 |
select * from t1 where a=2 for update; |
| 24 |
ERROR HY000: Lock wait timeout exceeded; try restarting transaction |
| 25 |
select * from t1 where a=2 limit 1 for update; |
| 26 |
a |
| 27 |
2 |
| 28 |
update t1 set a=11 where a=6; |
| 29 |
update t1 set a=12 where a=2; |
| 30 |
ERROR HY000: Lock wait timeout exceeded; try restarting transaction |
| 31 |
update t1 set a=13 where a=1; |
| 32 |
ERROR HY000: Lock wait timeout exceeded; try restarting transaction |
| 33 |
commit; |
| 34 |
update t1 set a=14 where a=1; |
| 35 |
commit; |
| 36 |
select * from t1; |
| 37 |
a |
| 38 |
14 |
| 39 |
2 |
| 40 |
3 |
| 41 |
4 |
| 42 |
10 |
| 43 |
11 |
| 44 |
7 |
| 45 |
delete from t1; |
| 46 |
insert into t1 values (1),(2),(3),(4),(5),(6),(7); |
| 47 |
create table t2 as select 1 as col; |
| 48 |
commit; |
| 49 |
select * from t1 where a=3 lock in share mode; |
| 50 |
a |
| 51 |
3 |
| 52 |
update t1 straight_join t2 set a=10 where a=5; |
| 53 |
ERROR HY000: Lock wait timeout exceeded; try restarting transaction |
| 54 |
commit; |
| 55 |
commit; |
| 56 |
flush status; |
| 57 |
set session transaction isolation level read committed; |
| 58 |
update t1 straight_join t2 set a=10 where a=5; |
| 59 |
select * from t1 where a=2 for update; |
| 60 |
ERROR HY000: Lock wait timeout exceeded; try restarting transaction |
| 61 |
select * from t1 where a=2 limit 1 for update; |
| 62 |
a |
| 63 |
2 |
| 64 |
update t1 straight_join t2 set a=11 where a=6; |
| 65 |
update t1 straight_join t2 set a=12 where a=2; |
| 66 |
ERROR HY000: Lock wait timeout exceeded; try restarting transaction |
| 67 |
update t1 straight_join t2 set a=13 where a=1; |
| 68 |
ERROR HY000: Lock wait timeout exceeded; try restarting transaction |
| 69 |
commit; |
| 70 |
update t1 straight_join t2 set a=14 where a=1; |
| 71 |
commit; |
| 72 |
show status like "created_tmp_tables"; |
| 73 |
Variable_name Value |
| 74 |
Created_tmp_tables 0 |
| 75 |
select * from t1; |
| 76 |
a |
| 77 |
14 |
| 78 |
2 |
| 79 |
3 |
| 80 |
4 |
| 81 |
10 |
| 82 |
11 |
| 83 |
7 |
| 84 |
delete from t1; |
| 85 |
insert into t1 values (1),(2),(3),(4),(5),(6),(7); |
| 86 |
commit; |
| 87 |
select * from t1 where a=3 lock in share mode; |
| 88 |
a |
| 89 |
3 |
| 90 |
update t1 straight_join t2 set a=10,t2.col=t2.col+1 where a+1=5+1 and t2.col>0*a; |
| 91 |
ERROR HY000: Lock wait timeout exceeded; try restarting transaction |
| 92 |
commit; |
| 93 |
commit; |
| 94 |
flush status; |
| 95 |
set session transaction isolation level read committed; |
| 96 |
update t1 straight_join t2 set a=10,t2.col=t2.col+1 where a+1=5+1 and t2.col>0*a; |
| 97 |
select * from t1 where a=2 for update; |
| 98 |
ERROR HY000: Lock wait timeout exceeded; try restarting transaction |
| 99 |
select * from t1 where a=2 limit 1 for update; |
| 100 |
a |
| 101 |
2 |
| 102 |
update t1 straight_join t2 set a=11,t2.col=t2.col+1 where a+1=6+1 and t2.col>0*a; |
| 103 |
update t1 straight_join t2 set a=12,t2.col=t2.col+1 where a+1=2+1 and t2.col>0*a; |
| 104 |
ERROR HY000: Lock wait timeout exceeded; try restarting transaction |
| 105 |
update t1 straight_join t2 set a=13,t2.col=t2.col+1 where a+1=1+1 and t2.col>0*a; |
| 106 |
ERROR HY000: Lock wait timeout exceeded; try restarting transaction |
| 107 |
commit; |
| 108 |
update t1 straight_join t2 set a=14,t2.col=t2.col+1 where a+1=1+1 and t2.col>0*a; |
| 109 |
commit; |
| 110 |
show status like "created_tmp_tables"; |
| 111 |
Variable_name Value |
| 112 |
Created_tmp_tables 10 |
| 113 |
select * from t1; |
| 114 |
a |
| 115 |
14 |
| 116 |
2 |
| 117 |
3 |
| 118 |
4 |
| 119 |
10 |
| 120 |
11 |
| 121 |
7 |
| 122 |
drop table t1,t2; |
| 123 |
create table t1 (a int, b int) engine=myisam; |
| 124 |
create table t2 (c int, d int, key (c)) engine=innodb; |
| 125 |
insert into t1 values (1,1); |
| 126 |
insert into t2 values (1,2); |
| 127 |
set session transaction isolation level read committed; |
| 128 |
delete from t1 using t1 join t2 on t1.a = t2.c where t2.d in (1); |
| 129 |
drop table t1, t2; |