summaryrefslogtreecommitdiff
path: root/storage/tokudb/mysql-test/tokudb/r/mvcc-38.result
blob: 8cbcf3dffd2cd13a03d4226bf889eed59600d8b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
SET DEFAULT_STORAGE_ENGINE = 'tokudb';
# Establish connection conn1 (user = root)
connect  conn1,localhost,root,,;
DROP TABLE IF EXISTS foo, foo_isam;
connection default;
set session transaction isolation level repeatable read;
create table foo (a int, b int, c int, primary key (a), key (b))engine=TokUDB;
show create table foo;
Table	Create Table
foo	CREATE TABLE `foo` (
  `a` int(11) NOT NULL,
  `b` int(11) DEFAULT NULL,
  `c` int(11) DEFAULT NULL,
  PRIMARY KEY (`a`),
  KEY `b` (`b`)
) ENGINE=TokuDB DEFAULT CHARSET=latin1
create table foo_isam (a int, b int, c int) engine=MyISAM;
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);
begin;
select * from foo;
a	b	c
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
# should use key b
explain select * from foo where b=50;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	foo	ref	b	b	5	const	1	
# should grab a read lock on the main table on (5,50,500)
insert into foo_isam select * from foo where b=50;
# should get (5,50,500)
select * From foo_isam;
a	b	c
5	50	500
connection conn1;
set session transaction isolation level repeatable read;
# should fail with lock timeout because of read lock grabbed earlier
replace into foo values (5, 1,1);
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
connection default;
disconnect conn1;
connection default;
set session transaction isolation level serializable;
DROP TABLE foo, foo_isam;