1
SET DEFAULT_STORAGE_ENGINE = 'tokudb';
2
# Establish connection conn1 (user = root)
3
DROP TABLE IF EXISTS foo, foo_isam;
4
set session transaction isolation level repeatable read;
5
create table foo (a int, b int, c int, primary key (a), key (b))engine=TokUDB;
8
foo CREATE TABLE `foo` (
9
`a` int(11) NOT NULL DEFAULT '0',
10
`b` int(11) DEFAULT NULL,
11
`c` int(11) DEFAULT NULL,
14
) ENGINE=TokuDB DEFAULT CHARSET=latin1
15
create table foo_isam (a int, b int, c int) engine=MyISAM;
16
insert into foo values (1,10,100),(2,20,200),(3,30,300),(4,40,400),(5,50,500),(6,60,600),(7,70,700),(8,80,800),(9,90,900);
30
explain select * from foo where b=50;
31
id select_type table type possible_keys key key_len ref rows Extra
32
1 SIMPLE foo ref b b 5 const 1
33
# should grab a read lock on the main table on (5,50,500)
34
insert into foo_isam select * from foo where b=50;
35
# should get (5,50,500)
36
select * From foo_isam;
39
set session transaction isolation level repeatable read;
40
# should fail with lock timeout because of read lock grabbed earlier
41
replace into foo values (5, 1,1);
42
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
43
set session transaction isolation level serializable;
44
DROP TABLE foo, foo_isam;