| 1 |
# test for BUG#41029: |
| 2 |
# "MRR: SELECT FOR UPDATE fails to lock gaps (InnoDB table)" |
| 3 |
|
| 4 |
--source include/have_debug.inc |
| 5 |
--source include/have_innodb.inc |
| 6 |
|
| 7 |
select @default_binlog_format:=@@global.binlog_format; |
| 8 |
set global binlog_format=row; |
| 9 |
|
| 10 |
connect (con1,localhost,root,,); |
| 11 |
connect (con2,localhost,root,,); |
| 12 |
|
| 13 |
connection con1; |
| 14 |
|
| 15 |
# bug requires this |
| 16 |
set session debug_dbug="+d,optimizer_innodb_ds_mrr"; |
| 17 |
|
| 18 |
set autocommit=0; |
| 19 |
use test; |
| 20 |
drop table if exists t1; |
| 21 |
create table t1 (dummy int primary key, a int unique, b int) engine=innodb; |
| 22 |
insert into t1 values(1,1,1),(3,3,3),(5,5,5); |
| 23 |
commit; |
| 24 |
set session transaction isolation level repeatable read; |
| 25 |
select @@transaction_isolation; |
| 26 |
start transaction; |
| 27 |
select * from t1 where a > 2 for update; |
| 28 |
|
| 29 |
connection con2; |
| 30 |
|
| 31 |
use test; |
| 32 |
set autocommit=0; |
| 33 |
start transaction; |
| 34 |
select 1; |
| 35 |
--error ER_LOCK_WAIT_TIMEOUT |
| 36 |
insert into t1 values(2,2,2); |
| 37 |
rollback; |
| 38 |
|
| 39 |
connection con1; |
| 40 |
rollback; |
| 41 |
|
| 42 |
drop table t1; |
| 43 |
connection default; |
| 44 |
set global binlog_format=@default_binlog_format; |