1SET DEFAULT_STORAGE_ENGINE = 'tokudb';
2# Establish connection conn1 (user = root)
3connect  conn1,localhost,root,,;
4DROP TABLE IF EXISTS foo, foo_isam;
5connection default;
6set session transaction isolation level repeatable read;
7create table foo ( a int, b int, c 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  `c` int(11) DEFAULT NULL,
14  PRIMARY KEY (`a`),
15  KEY `b` (`b`)
16) ENGINE=TokuDB DEFAULT CHARSET=latin1
17insert into foo values (1,10,100),(2,20,200),(3,30,300),(4,40,400),(5,50,500);
18create table foo_isam (a int, b int, c int);
19# should use key b
20explain select * from foo where b=30;
21id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
221	SIMPLE	foo	ref	b	b	5	const	1
23begin;
24insert into foo_isam select * from foo where b=30;
25connection conn1;
26set session transaction isolation level repeatable read;
27# should get a lock error
28replace into foo values (3,3,3);
29ERROR HY000: Lock wait timeout exceeded; try restarting transaction
30connection default;
31commit;
32disconnect conn1;
33connection default;
34set session transaction isolation level serializable;
35DROP TABLE foo, foo_isam;
36