Commit 6a148af4 authored by John Esmet's avatar John Esmet

[t:3453] cleanup


git-svn-id: file:///svn/mysql/tests/mysql-test@35019 c7de825b-a66e-492c-adef-691d508d4ae1
parent 2a6019b2
# 9/22/2011
# Test that blocking row locks work correctly.
set storage_engine='tokudb';
set global tokudb_lock_timeout=1000000;
--disable_warnings
drop table if exists t;
--enable_warnings
create table t (a int primary key, b int);
insert into t values (1, 1);
insert into t values (2, 4);
insert into t values (3, 9);
insert into t values (4, 16);
set autocommit=off;
# READ/WRITE CONFLICTS WITH SERIALIZABLE TRANSACTIONS
connect(conn1, localhost, root);
set session transaction isolation level serializable;
# point lock, select for update
begin;
select * from t where a=1 for update;
connect(conn2, localhost, root);
set session transaction isolation level serializable;
--error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1;
select * from t where a=2;
select * from t where a=3;
select * from t where a=4;
connection conn1;
commit;
connection conn2;
select * from t;
# range lock, select for update
connection conn1;
begin;
select * from t where a<=2 for update;
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1;
--error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1 for update;
--error ER_LOCK_WAIT_TIMEOUT
select * from t where a>1;
--error ER_LOCK_WAIT_TIMEOUT
select * from t;
select * from t where a=4;
connection conn1;
commit;
connection conn2;
select * from t;
# point lock, replace into
connection conn1;
begin;
replace into t values(1, 10),(3,30);
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1;
--error ER_LOCK_WAIT_TIMEOUT
select * from t where a=3;
select * from t where a=2;
select * from t where a=4;
connection conn1;
commit;
connection conn2;
select * from t;
# range lock, replace into
connection conn1;
begin;
insert on duplicate ke
# Make sure we drop table and reset the default lock timeout.
connection conn1;
drop table t;
set global tokudb_lock_timeout=30000000;
select @@tokudb_lock_timeout;
# Tokutek
# Blocking row lock tests;
# Generated by blocking-row-locks-testgen.py on 2011-09-24;
# prepare with some common parameters
set storage_engine=tokudb;
connect(conn2, localhost, root);
connection default;
# drop old table, generate new one. 4 rows
--disable_warnings
drop table if exists t;
--enable_warnings
create table t (a int primary key, b int);
insert ignore t values(1, 1);
insert ignore t values(2, 4);
insert ignore t values(3, 9);
insert ignore t values(4, 16);
insert ignore t values(5, 25);
insert ignore t values(6, 36);
# testing with timeout 0
set global tokudb_lock_timeout=0;
# testing each point query vs each point query
# testing conflict "select for update" vs. "select for update"
connection default;
begin;
select * from t where a=1 for update;
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1 for update;
select * from t where a=2 for update;
select * from t where a=3 for update;
select * from t where a=4 for update;
connection default;
commit;
connection conn2;
select * from t where a=1 for update;
select * from t;
connection default;
# testing conflict "select for update" vs. "update"
connection default;
begin;
select * from t where a=1 for update;
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
update t set b=b where a=1;
update t set b=b where a=2;
update t set b=b where a=3;
update t set b=b where a=4;
connection default;
commit;
connection conn2;
update t set b=b where a=1;
select * from t;
connection default;
# testing conflict "select for update" vs. "insert"
connection default;
begin;
select * from t where a=1 for update;
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
insert ignore t values(1, 100);
insert ignore t values(2, 100);
insert ignore t values(3, 100);
insert ignore t values(4, 100);
connection default;
commit;
connection conn2;
insert ignore t values(1, 100);
select * from t;
connection default;
# testing conflict "select for update" vs. "replace"
connection default;
begin;
select * from t where a=1 for update;
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
replace t values(1, 100);
replace t values(2, 100);
replace t values(3, 100);
replace t values(4, 100);
connection default;
commit;
connection conn2;
replace t values(1, 100);
select * from t;
connection default;
# testing range query "select for update" vs "select for update"
connection default;
begin;
select * from t where a=1 for update;
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
select * from t where a<=2 for update;
--error ER_LOCK_WAIT_TIMEOUT
select * from t where a>=0 for update;
select * from t where a>2 for update;
connection default;
commit;
connection conn2;
select * from t where a<=2 for update;
select * from t where a>=0 for update;
select * from t;
connection default;
# testing range query "update" vs "select for update"
connection default;
begin;
select * from t where a=1 for update;
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
update t set b=b where a<=2;
--error ER_LOCK_WAIT_TIMEOUT
update t set b=b where a>=0;
update t set b=b where a>2;
connection default;
commit;
connection conn2;
update t set b=b where a<=2;
update t set b=b where a>=0;
select * from t;
connection default;
# testing conflict "update" vs. "select for update"
connection default;
begin;
update t set b=b where a=1;
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1 for update;
select * from t where a=2 for update;
select * from t where a=3 for update;
select * from t where a=4 for update;
connection default;
commit;
connection conn2;
select * from t where a=1 for update;
select * from t;
connection default;
# testing conflict "update" vs. "update"
connection default;
begin;
update t set b=b where a=1;
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
update t set b=b where a=1;
update t set b=b where a=2;
update t set b=b where a=3;
update t set b=b where a=4;
connection default;
commit;
connection conn2;
update t set b=b where a=1;
select * from t;
connection default;
# testing conflict "update" vs. "insert"
connection default;
begin;
update t set b=b where a=1;
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
insert ignore t values(1, 100);
insert ignore t values(2, 100);
insert ignore t values(3, 100);
insert ignore t values(4, 100);
connection default;
commit;
connection conn2;
insert ignore t values(1, 100);
select * from t;
connection default;
# testing conflict "update" vs. "replace"
connection default;
begin;
update t set b=b where a=1;
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
replace t values(1, 100);
replace t values(2, 100);
replace t values(3, 100);
replace t values(4, 100);
connection default;
commit;
connection conn2;
replace t values(1, 100);
select * from t;
connection default;
# testing range query "select for update" vs "update"
connection default;
begin;
update t set b=b where a=1;
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
select * from t where a<=2 for update;
--error ER_LOCK_WAIT_TIMEOUT
select * from t where a>=0 for update;
select * from t where a>2 for update;
connection default;
commit;
connection conn2;
select * from t where a<=2 for update;
select * from t where a>=0 for update;
select * from t;
connection default;
# testing range query "update" vs "update"
connection default;
begin;
update t set b=b where a=1;
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
update t set b=b where a<=2;
--error ER_LOCK_WAIT_TIMEOUT
update t set b=b where a>=0;
update t set b=b where a>2;
connection default;
commit;
connection conn2;
update t set b=b where a<=2;
update t set b=b where a>=0;
select * from t;
connection default;
# testing conflict "insert" vs. "select for update"
connection default;
begin;
insert ignore t values(1, 100);
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1 for update;
select * from t where a=2 for update;
select * from t where a=3 for update;
select * from t where a=4 for update;
connection default;
commit;
connection conn2;
select * from t where a=1 for update;
select * from t;
connection default;
# testing conflict "insert" vs. "update"
connection default;
begin;
insert ignore t values(1, 100);
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
update t set b=b where a=1;
update t set b=b where a=2;
update t set b=b where a=3;
update t set b=b where a=4;
connection default;
commit;
connection conn2;
update t set b=b where a=1;
select * from t;
connection default;
# testing conflict "insert" vs. "insert"
connection default;
begin;
insert ignore t values(1, 100);
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
insert ignore t values(1, 100);
insert ignore t values(2, 100);
insert ignore t values(3, 100);
insert ignore t values(4, 100);
connection default;
commit;
connection conn2;
insert ignore t values(1, 100);
select * from t;
connection default;
# testing conflict "insert" vs. "replace"
connection default;
begin;
insert ignore t values(1, 100);
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
replace t values(1, 100);
replace t values(2, 100);
replace t values(3, 100);
replace t values(4, 100);
connection default;
commit;
connection conn2;
replace t values(1, 100);
select * from t;
connection default;
# testing range query "select for update" vs "insert"
connection default;
begin;
insert ignore t values(1, 100);
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
select * from t where a<=2 for update;
--error ER_LOCK_WAIT_TIMEOUT
select * from t where a>=0 for update;
select * from t where a>2 for update;
connection default;
commit;
connection conn2;
select * from t where a<=2 for update;
select * from t where a>=0 for update;
select * from t;
connection default;
# testing range query "update" vs "insert"
connection default;
begin;
insert ignore t values(1, 100);
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
update t set b=b where a<=2;
--error ER_LOCK_WAIT_TIMEOUT
update t set b=b where a>=0;
update t set b=b where a>2;
connection default;
commit;
connection conn2;
update t set b=b where a<=2;
update t set b=b where a>=0;
select * from t;
connection default;
# testing conflict "replace" vs. "select for update"
connection default;
begin;
replace t values(1, 100);
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1 for update;
select * from t where a=2 for update;
select * from t where a=3 for update;
select * from t where a=4 for update;
connection default;
commit;
connection conn2;
select * from t where a=1 for update;
select * from t;
connection default;
# testing conflict "replace" vs. "update"
connection default;
begin;
replace t values(1, 100);
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
update t set b=b where a=1;
update t set b=b where a=2;
update t set b=b where a=3;
update t set b=b where a=4;
connection default;
commit;
connection conn2;
update t set b=b where a=1;
select * from t;
connection default;
# testing conflict "replace" vs. "insert"
connection default;
begin;
replace t values(1, 100);
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
insert ignore t values(1, 100);
insert ignore t values(2, 100);
insert ignore t values(3, 100);
insert ignore t values(4, 100);
connection default;
commit;
connection conn2;
insert ignore t values(1, 100);
select * from t;
connection default;
# testing conflict "replace" vs. "replace"
connection default;
begin;
replace t values(1, 100);
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
replace t values(1, 100);
replace t values(2, 100);
replace t values(3, 100);
replace t values(4, 100);
connection default;
commit;
connection conn2;
replace t values(1, 100);
select * from t;
connection default;
# testing range query "select for update" vs "replace"
connection default;
begin;
replace t values(1, 100);
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
select * from t where a<=2 for update;
--error ER_LOCK_WAIT_TIMEOUT
select * from t where a>=0 for update;
select * from t where a>2 for update;
connection default;
commit;
connection conn2;
select * from t where a<=2 for update;
select * from t where a>=0 for update;
select * from t;
connection default;
# testing range query "update" vs "replace"
connection default;
begin;
replace t values(1, 100);
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
update t set b=b where a<=2;
--error ER_LOCK_WAIT_TIMEOUT
update t set b=b where a>=0;
update t set b=b where a>2;
connection default;
commit;
connection conn2;
update t set b=b where a<=2;
update t set b=b where a>=0;
select * from t;
connection default;
# testing range query "select for update" vs range query "select for update"
connection default;
begin;
select * from t where a>=2 and a<=4 for update;
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
select * from t where a>=0 and a<=3 for update;
--error ER_LOCK_WAIT_TIMEOUT
select * from t where a>=3 and a<=6 for update;
--error ER_LOCK_WAIT_TIMEOUT
select * from t where a<=2 for update;
select * from t where a>=5 for update;
connection default;
commit;
connection conn2;
select * from t where a>=0 and a<=3 for update;
select * from t where a>=3 and a<=6 for update;
select * from t where a<=2 for update;
select * from t;
connection default;
# testing range query "select for update" vs range query "update"
connection default;
begin;
select * from t where a>=2 and a<=4 for update;
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
update t set b=b where a>=0 and a<=3;
--error ER_LOCK_WAIT_TIMEOUT
update t set b=b where a>=3 and a<=6;
--error ER_LOCK_WAIT_TIMEOUT
update t set b=b where a<=2;
update t set b=b where a>=5;
connection default;
commit;
connection conn2;
update t set b=b where a>=0 and a<=3;
update t set b=b where a>=3 and a<=6;
update t set b=b where a<=2;
select * from t;
connection default;
# testing range query "update" vs range query "select for update"
connection default;
begin;
update t set b=b where a>=2 and a<=4;
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
select * from t where a>=0 and a<=3 for update;
--error ER_LOCK_WAIT_TIMEOUT
select * from t where a>=3 and a<=6 for update;
--error ER_LOCK_WAIT_TIMEOUT
select * from t where a<=2 for update;
select * from t where a>=5 for update;
connection default;
commit;
connection conn2;
select * from t where a>=0 and a<=3 for update;
select * from t where a>=3 and a<=6 for update;
select * from t where a<=2 for update;
select * from t;
connection default;
# testing range query "update" vs range query "update"
connection default;
begin;
update t set b=b where a>=2 and a<=4;
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
update t set b=b where a>=0 and a<=3;
--error ER_LOCK_WAIT_TIMEOUT
update t set b=b where a>=3 and a<=6;
--error ER_LOCK_WAIT_TIMEOUT
update t set b=b where a<=2;
update t set b=b where a>=5;
connection default;
commit;
connection conn2;
update t set b=b where a>=0 and a<=3;
update t set b=b where a>=3 and a<=6;
update t set b=b where a<=2;
select * from t;
connection default;
# testing with timeout 1000000
set global tokudb_lock_timeout=1000000;
# testing each point query vs each point query
# testing conflict "select for update" vs. "select for update"
connection default;
begin;
select * from t where a=1 for update;
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1 for update;
select * from t where a=2 for update;
select * from t where a=3 for update;
select * from t where a=4 for update;
connection default;
commit;
connection conn2;
select * from t where a=1 for update;
select * from t;
connection default;
# testing conflict "select for update" vs. "update"
connection default;
begin;
select * from t where a=1 for update;
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
update t set b=b where a=1;
update t set b=b where a=2;
update t set b=b where a=3;
update t set b=b where a=4;
connection default;
commit;
connection conn2;
update t set b=b where a=1;
select * from t;
connection default;
# testing conflict "select for update" vs. "insert"
connection default;
begin;
select * from t where a=1 for update;
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
insert ignore t values(1, 100);
insert ignore t values(2, 100);
insert ignore t values(3, 100);
insert ignore t values(4, 100);
connection default;
commit;
connection conn2;
insert ignore t values(1, 100);
select * from t;
connection default;
# testing conflict "select for update" vs. "replace"
connection default;
begin;
select * from t where a=1 for update;
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
replace t values(1, 100);
replace t values(2, 100);
replace t values(3, 100);
replace t values(4, 100);
connection default;
commit;
connection conn2;
replace t values(1, 100);
select * from t;
connection default;
# testing range query "select for update" vs "select for update"
connection default;
begin;
select * from t where a=1 for update;
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
select * from t where a<=2 for update;
--error ER_LOCK_WAIT_TIMEOUT
select * from t where a>=0 for update;
select * from t where a>2 for update;
connection default;
commit;
connection conn2;
select * from t where a<=2 for update;
select * from t where a>=0 for update;
select * from t;
connection default;
# testing range query "update" vs "select for update"
connection default;
begin;
select * from t where a=1 for update;
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
update t set b=b where a<=2;
--error ER_LOCK_WAIT_TIMEOUT
update t set b=b where a>=0;
update t set b=b where a>2;
connection default;
commit;
connection conn2;
update t set b=b where a<=2;
update t set b=b where a>=0;
select * from t;
connection default;
# testing conflict "update" vs. "select for update"
connection default;
begin;
update t set b=b where a=1;
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1 for update;
select * from t where a=2 for update;
select * from t where a=3 for update;
select * from t where a=4 for update;
connection default;
commit;
connection conn2;
select * from t where a=1 for update;
select * from t;
connection default;
# testing conflict "update" vs. "update"
connection default;
begin;
update t set b=b where a=1;
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
update t set b=b where a=1;
update t set b=b where a=2;
update t set b=b where a=3;
update t set b=b where a=4;
connection default;
commit;
connection conn2;
update t set b=b where a=1;
select * from t;
connection default;
# testing conflict "update" vs. "insert"
connection default;
begin;
update t set b=b where a=1;
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
insert ignore t values(1, 100);
insert ignore t values(2, 100);
insert ignore t values(3, 100);
insert ignore t values(4, 100);
connection default;
commit;
connection conn2;
insert ignore t values(1, 100);
select * from t;
connection default;
# testing conflict "update" vs. "replace"
connection default;
begin;
update t set b=b where a=1;
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
replace t values(1, 100);
replace t values(2, 100);
replace t values(3, 100);
replace t values(4, 100);
connection default;
commit;
connection conn2;
replace t values(1, 100);
select * from t;
connection default;
# testing range query "select for update" vs "update"
connection default;
begin;
update t set b=b where a=1;
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
select * from t where a<=2 for update;
--error ER_LOCK_WAIT_TIMEOUT
select * from t where a>=0 for update;
select * from t where a>2 for update;
connection default;
commit;
connection conn2;
select * from t where a<=2 for update;
select * from t where a>=0 for update;
select * from t;
connection default;
# testing range query "update" vs "update"
connection default;
begin;
update t set b=b where a=1;
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
update t set b=b where a<=2;
--error ER_LOCK_WAIT_TIMEOUT
update t set b=b where a>=0;
update t set b=b where a>2;
connection default;
commit;
connection conn2;
update t set b=b where a<=2;
update t set b=b where a>=0;
select * from t;
connection default;
# testing conflict "insert" vs. "select for update"
connection default;
begin;
insert ignore t values(1, 100);
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1 for update;
select * from t where a=2 for update;
select * from t where a=3 for update;
select * from t where a=4 for update;
connection default;
commit;
connection conn2;
select * from t where a=1 for update;
select * from t;
connection default;
# testing conflict "insert" vs. "update"
connection default;
begin;
insert ignore t values(1, 100);
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
update t set b=b where a=1;
update t set b=b where a=2;
update t set b=b where a=3;
update t set b=b where a=4;
connection default;
commit;
connection conn2;
update t set b=b where a=1;
select * from t;
connection default;
# testing conflict "insert" vs. "insert"
connection default;
begin;
insert ignore t values(1, 100);
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
insert ignore t values(1, 100);
insert ignore t values(2, 100);
insert ignore t values(3, 100);
insert ignore t values(4, 100);
connection default;
commit;
connection conn2;
insert ignore t values(1, 100);
select * from t;
connection default;
# testing conflict "insert" vs. "replace"
connection default;
begin;
insert ignore t values(1, 100);
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
replace t values(1, 100);
replace t values(2, 100);
replace t values(3, 100);
replace t values(4, 100);
connection default;
commit;
connection conn2;
replace t values(1, 100);
select * from t;
connection default;
# testing range query "select for update" vs "insert"
connection default;
begin;
insert ignore t values(1, 100);
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
select * from t where a<=2 for update;
--error ER_LOCK_WAIT_TIMEOUT
select * from t where a>=0 for update;
select * from t where a>2 for update;
connection default;
commit;
connection conn2;
select * from t where a<=2 for update;
select * from t where a>=0 for update;
select * from t;
connection default;
# testing range query "update" vs "insert"
connection default;
begin;
insert ignore t values(1, 100);
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
update t set b=b where a<=2;
--error ER_LOCK_WAIT_TIMEOUT
update t set b=b where a>=0;
update t set b=b where a>2;
connection default;
commit;
connection conn2;
update t set b=b where a<=2;
update t set b=b where a>=0;
select * from t;
connection default;
# testing conflict "replace" vs. "select for update"
connection default;
begin;
replace t values(1, 100);
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
select * from t where a=1 for update;
select * from t where a=2 for update;
select * from t where a=3 for update;
select * from t where a=4 for update;
connection default;
commit;
connection conn2;
select * from t where a=1 for update;
select * from t;
connection default;
# testing conflict "replace" vs. "update"
connection default;
begin;
replace t values(1, 100);
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
update t set b=b where a=1;
update t set b=b where a=2;
update t set b=b where a=3;
update t set b=b where a=4;
connection default;
commit;
connection conn2;
update t set b=b where a=1;
select * from t;
connection default;
# testing conflict "replace" vs. "insert"
connection default;
begin;
replace t values(1, 100);
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
insert ignore t values(1, 100);
insert ignore t values(2, 100);
insert ignore t values(3, 100);
insert ignore t values(4, 100);
connection default;
commit;
connection conn2;
insert ignore t values(1, 100);
select * from t;
connection default;
# testing conflict "replace" vs. "replace"
connection default;
begin;
replace t values(1, 100);
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
replace t values(1, 100);
replace t values(2, 100);
replace t values(3, 100);
replace t values(4, 100);
connection default;
commit;
connection conn2;
replace t values(1, 100);
select * from t;
connection default;
# testing range query "select for update" vs "replace"
connection default;
begin;
replace t values(1, 100);
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
select * from t where a<=2 for update;
--error ER_LOCK_WAIT_TIMEOUT
select * from t where a>=0 for update;
select * from t where a>2 for update;
connection default;
commit;
connection conn2;
select * from t where a<=2 for update;
select * from t where a>=0 for update;
select * from t;
connection default;
# testing range query "update" vs "replace"
connection default;
begin;
replace t values(1, 100);
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
update t set b=b where a<=2;
--error ER_LOCK_WAIT_TIMEOUT
update t set b=b where a>=0;
update t set b=b where a>2;
connection default;
commit;
connection conn2;
update t set b=b where a<=2;
update t set b=b where a>=0;
select * from t;
connection default;
# testing range query "select for update" vs range query "select for update"
connection default;
begin;
select * from t where a>=2 and a<=4 for update;
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
select * from t where a>=0 and a<=3 for update;
--error ER_LOCK_WAIT_TIMEOUT
select * from t where a>=3 and a<=6 for update;
--error ER_LOCK_WAIT_TIMEOUT
select * from t where a<=2 for update;
select * from t where a>=5 for update;
connection default;
commit;
connection conn2;
select * from t where a>=0 and a<=3 for update;
select * from t where a>=3 and a<=6 for update;
select * from t where a<=2 for update;
select * from t;
connection default;
# testing range query "select for update" vs range query "update"
connection default;
begin;
select * from t where a>=2 and a<=4 for update;
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
update t set b=b where a>=0 and a<=3;
--error ER_LOCK_WAIT_TIMEOUT
update t set b=b where a>=3 and a<=6;
--error ER_LOCK_WAIT_TIMEOUT
update t set b=b where a<=2;
update t set b=b where a>=5;
connection default;
commit;
connection conn2;
update t set b=b where a>=0 and a<=3;
update t set b=b where a>=3 and a<=6;
update t set b=b where a<=2;
select * from t;
connection default;
# testing range query "update" vs range query "select for update"
connection default;
begin;
update t set b=b where a>=2 and a<=4;
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
select * from t where a>=0 and a<=3 for update;
--error ER_LOCK_WAIT_TIMEOUT
select * from t where a>=3 and a<=6 for update;
--error ER_LOCK_WAIT_TIMEOUT
select * from t where a<=2 for update;
select * from t where a>=5 for update;
connection default;
commit;
connection conn2;
select * from t where a>=0 and a<=3 for update;
select * from t where a>=3 and a<=6 for update;
select * from t where a<=2 for update;
select * from t;
connection default;
# testing range query "update" vs range query "update"
connection default;
begin;
update t set b=b where a>=2 and a<=4;
connection conn2;
--error ER_LOCK_WAIT_TIMEOUT
update t set b=b where a>=0 and a<=3;
--error ER_LOCK_WAIT_TIMEOUT
update t set b=b where a>=3 and a<=6;
--error ER_LOCK_WAIT_TIMEOUT
update t set b=b where a<=2;
update t set b=b where a>=5;
connection default;
commit;
connection conn2;
update t set b=b where a>=0 and a<=3;
update t set b=b where a>=3 and a<=6;
update t set b=b where a<=2;
select * from t;
connection default;
# clean it all up
drop table t;
set global tokudb_lock_timeout=30000000;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment