1source include/have_tokudb.inc; 2# Tokutek 3# test that read locks are not taken with serializable isolation and 4# autocommit on, refs 3532 5 6--disable_warnings 7drop table if exists t; 8--enable_warnings 9 10# low lock wait timeout, to speed up the test a bit 11set global tokudb_lock_timeout = 100; 12set global transaction isolation level serializable; 13 14# main client creates a table and inserts a few rows 15create table t (a int primary key) engine = tokudb; 16insert t values (1),(2),(3); 17# now grab write locks on the entire table 18begin; 19select * from t for update; 20 21# second client should be able to read the table 22connect(conn1, localhost, root); 23select * from t; 24select * from t where a=1; 25select * from t where a=2; 26select * from t where a=3; 27# but not write to it 28--error ER_LOCK_WAIT_TIMEOUT 29replace into t values (1); 30--error ER_LOCK_WAIT_TIMEOUT 31insert ignore t values (3); 32 33# back to the main client, commit the transaction 34connection default; 35commit; 36 37# further, if the main client has an open transaction 38# reading the table, a second client should be able 39# to grab write locks, since we're not supposed to 40# be grabbing read locks. 41connection default; 42begin; 43select * from t; 44 45connection conn1; 46select * from t for update; 47 48# back to the main client, commit the transaction 49connection default; 50commit; 51 52# cleanup 53drop table t; 54set global transaction isolation level repeatable read; 55set global tokudb_lock_timeout = 4000; 56