2011-06-13 18:58:05 +00:00
|
|
|
# test that select for update is executed with serializable isolation
|
|
|
|
|
2012-10-04 14:31:31 +00:00
|
|
|
SET DEFAULT_STORAGE_ENGINE='tokudb';
|
2011-06-13 18:58:05 +00:00
|
|
|
|
|
|
|
--disable_warnings
|
|
|
|
drop table if exists t;
|
|
|
|
--enable_warnings
|
|
|
|
create table t (a int primary key, b int);
|
|
|
|
insert into t values (1,0);
|
|
|
|
set session transaction isolation level serializable;
|
|
|
|
begin;
|
|
|
|
# t1 select for update
|
|
|
|
select * from t where a=1 for update;
|
|
|
|
# t2 update
|
|
|
|
update t set b=b+1 where a=1;
|
2011-06-14 13:12:44 +00:00
|
|
|
connect(conn1,localhost,root);
|
2011-06-13 18:58:05 +00:00
|
|
|
set session transaction isolation level serializable;
|
|
|
|
begin;
|
|
|
|
# t2 select for update, should hang until t1 commits
|
|
|
|
send select * from t where a=1 for update;
|
|
|
|
connection default;
|
|
|
|
# t1 commit
|
|
|
|
commit;
|
|
|
|
connection conn1;
|
|
|
|
# t2 select for update returns
|
|
|
|
reap;
|
|
|
|
# t2 update
|
|
|
|
update t set b=b+1 where a=1;
|
|
|
|
select * from t;
|
|
|
|
commit;
|
|
|
|
connection default;
|
|
|
|
disconnect conn1;
|
|
|
|
drop table t;
|
|
|
|
|