1SET DEFAULT_STORAGE_ENGINE = 'tokudb';
2# Establish connection conn1 (user = root)
3connect  conn1,localhost,root,,;
4DROP TABLE IF EXISTS foo;
5connection default;
6set session transaction isolation level repeatable read;
7create table foo (a int, b int, primary key (a), key (b))engine=TokuDB;
8show create table foo;
9Table	Create Table
10foo	CREATE TABLE `foo` (
11  `a` int(11) NOT NULL,
12  `b` int(11) DEFAULT NULL,
13  PRIMARY KEY (`a`),
14  KEY `b` (`b`)
15) ENGINE=TokuDB DEFAULT CHARSET=latin1
16insert into foo values (100,100);
17begin;
18insert into foo values (1,100);
19connection conn1;
20set session transaction isolation level repeatable read;
21begin;
22# should NOT see (1,100)
23select * from foo;
24a	b
25100	100
26# should be empty
27select * from foo where a=1;
28a	b
29# should fail with a lock wait timeout
30insert into foo values (1,1000);
31ERROR HY000: Lock wait timeout exceeded; try restarting transaction
32connection default;
33commit;
34# should return two values
35select * from foo;
36a	b
371	100
38100	100
39connection conn1;
40# should be empty
41select * from foo where a=1;
42a	b
43# should fail with a dup entry
44insert into foo values (1,1000);
45ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
46commit;
47connection default;
48disconnect conn1;
49connection default;
50set session transaction isolation level serializable;
51DROP TABLE foo;
52