1create table t1 (a date not null, b varchar(50) not null, c varchar(50) not null, d enum('m', 'w'), primary key(a,b,c,d)) engine='TokuDB'
2partition by key (a,b,c,d) (
3partition pa1 max_rows=20 min_rows=2,
4partition pa2 max_rows=30 min_rows=3,
5partition pa3 max_rows=30 min_rows=4,
6partition pa4 max_rows=40 min_rows=2);
7show create table t1;
8Table	Create Table
9t1	CREATE TABLE `t1` (
10  `a` date NOT NULL,
11  `b` varchar(50) NOT NULL,
12  `c` varchar(50) NOT NULL,
13  `d` enum('m','w') NOT NULL,
14  PRIMARY KEY (`a`,`b`,`c`,`d`)
15) ENGINE=TokuDB DEFAULT CHARSET=latin1
16/*!50100 PARTITION BY KEY (a,b,c,d)
17(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = TokuDB,
18 PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = TokuDB,
19 PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = TokuDB,
20 PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = TokuDB) */
21insert into t1 values
22('1975-01-01', 'abcde', 'abcde','m'),
23('1983-12-31', 'cdef', 'srtbvsr', 'w'),
24('1980-10-14', 'fgbbd', 'dtzndtz', 'w'),
25('2000-06-15', 'jukg','zikhuk','m');
26select * from t1;
27a	b	c	d
281983-12-31	cdef	srtbvsr	w
291980-10-14	fgbbd	dtzndtz	w
301975-01-01	abcde	abcde	m
312000-06-15	jukg	zikhuk	m
32select * from t1 where a<19851231;
33a	b	c	d
341975-01-01	abcde	abcde	m
351980-10-14	fgbbd	dtzndtz	w
361983-12-31	cdef	srtbvsr	w
37drop table t1;
38create table t1 (a date not null, b varchar(50) not null, c varchar(50) not null, d enum('m', 'w') not null, e int not null, f decimal (18,2) not null, g bigint not null, h tinyint not null, i char(255), primary key(a,b,c,d,e,f,g,h)) engine='TokuDB'
39partition by key(a,b,c,d,e,f,g,h) (
40partition pa1 max_rows=20 min_rows=2,
41partition pa2 max_rows=30 min_rows=3,
42partition pa3 max_rows=30 min_rows=4,
43partition pa4 max_rows=40 min_rows=2);
44show create table t1;
45Table	Create Table
46t1	CREATE TABLE `t1` (
47  `a` date NOT NULL,
48  `b` varchar(50) NOT NULL,
49  `c` varchar(50) NOT NULL,
50  `d` enum('m','w') NOT NULL,
51  `e` int(11) NOT NULL,
52  `f` decimal(18,2) NOT NULL,
53  `g` bigint(20) NOT NULL,
54  `h` tinyint(4) NOT NULL,
55  `i` char(255) DEFAULT NULL,
56  PRIMARY KEY (`a`,`b`,`c`,`d`,`e`,`f`,`g`,`h`)
57) ENGINE=TokuDB DEFAULT CHARSET=latin1
58/*!50100 PARTITION BY KEY (a,b,c,d,e,f,g,h)
59(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = TokuDB,
60 PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = TokuDB,
61 PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = TokuDB,
62 PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = TokuDB) */
63insert into t1 values
64('1975-01-01', 'abcde', 'abcde','m', 1234, 123.45, 32412341234, 113, 'tbhth nrzh ztfghgfh fzh ftzhj fztjh'),
65('1983-12-31', 'cdef', 'srtbvsr', 'w', 45634, 13452.56, 3452346456, 127, 'liuugbzvdmrlti b itiortudirtfgtibm dfi'),
66('1980-10-14', 'fgbbd', 'dtzndtz', 'w', 67856, 5463354.67, 3567845333, 124, 'd,f söierugsig msireg siug ei5ggth lrutluitgzeöjrtnb.rkjthuekuhzrkuthgjdnffjmbr'),
67('2000-06-15', 'jukg','zikhuk','m', 45675, 6465754.13, 435242623462, 18, 'pib mdotkbm.m' );
68select * from t1;
69a	b	c	d	e	f	g	h	i
701980-10-14	fgbbd	dtzndtz	w	67856	5463354.67	3567845333	124	d,f söierugsig msireg siug ei5ggth lrutluitgzeöjrtnb.rkjthuekuhzrkuthgjdnffjmbr
711983-12-31	cdef	srtbvsr	w	45634	13452.56	3452346456	127	liuugbzvdmrlti b itiortudirtfgtibm dfi
721975-01-01	abcde	abcde	m	1234	123.45	32412341234	113	tbhth nrzh ztfghgfh fzh ftzhj fztjh
732000-06-15	jukg	zikhuk	m	45675	6465754.13	435242623462	18	pib mdotkbm.m
74select * from t1 where a<19851231;
75a	b	c	d	e	f	g	h	i
761975-01-01	abcde	abcde	m	1234	123.45	32412341234	113	tbhth nrzh ztfghgfh fzh ftzhj fztjh
771980-10-14	fgbbd	dtzndtz	w	67856	5463354.67	3567845333	124	d,f söierugsig msireg siug ei5ggth lrutluitgzeöjrtnb.rkjthuekuhzrkuthgjdnffjmbr
781983-12-31	cdef	srtbvsr	w	45634	13452.56	3452346456	127	liuugbzvdmrlti b itiortudirtfgtibm dfi
79drop table t1;
80create table t1 (a date not null, b varchar(50) not null, c varchar(50) not null, d enum('m', 'w') not null, e int not null, f decimal (18,2) not null, g bigint not null, h tinyint not null, a1 date not null, b1 varchar(50) not null, c1 varchar(50) not null, d1 enum('m', 'w') not null, e1 int not null, f1 decimal (18,2) not null, g1 bigint not null, h1 tinyint not null, i char(255), primary key(a,b,c,d,e,f,g,h,a1,b1,c1,d1,e1,f1,g1,h1)) engine='TokuDB'
81partition by key(a,b,c,d,e,f,g,h,a1,b1,c1,d1,e1,f1,g1,h1) (
82partition pa1 max_rows=20 min_rows=2,
83partition pa2 max_rows=30 min_rows=3,
84partition pa3 max_rows=30 min_rows=4,
85partition pa4 max_rows=40 min_rows=2);
86show create table t1;
87Table	Create Table
88t1	CREATE TABLE `t1` (
89  `a` date NOT NULL,
90  `b` varchar(50) NOT NULL,
91  `c` varchar(50) NOT NULL,
92  `d` enum('m','w') NOT NULL,
93  `e` int(11) NOT NULL,
94  `f` decimal(18,2) NOT NULL,
95  `g` bigint(20) NOT NULL,
96  `h` tinyint(4) NOT NULL,
97  `a1` date NOT NULL,
98  `b1` varchar(50) NOT NULL,
99  `c1` varchar(50) NOT NULL,
100  `d1` enum('m','w') NOT NULL,
101  `e1` int(11) NOT NULL,
102  `f1` decimal(18,2) NOT NULL,
103  `g1` bigint(20) NOT NULL,
104  `h1` tinyint(4) NOT NULL,
105  `i` char(255) DEFAULT NULL,
106  PRIMARY KEY (`a`,`b`,`c`,`d`,`e`,`f`,`g`,`h`,`a1`,`b1`,`c1`,`d1`,`e1`,`f1`,`g1`,`h1`)
107) ENGINE=TokuDB DEFAULT CHARSET=latin1
108/*!50100 PARTITION BY KEY (a,b,c,d,e,f,g,h,a1,b1,c1,d1,e1,f1,g1,h1)
109(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = TokuDB,
110 PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = TokuDB,
111 PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = TokuDB,
112 PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = TokuDB) */
113insert into t1 values
114('1975-01-01', 'abcde', 'abcde','m', 1234, 123.45, 32412341234, 113,'1975-01-01', 'abcde', 'abcde','m', 1234, 123.45, 32412341234, 113, 'tbhth nrzh ztfghgfh fzh ftzhj fztjh'),
115('1983-12-31', 'cdef', 'srtbvsr', 'w', 45634, 13452.56, 3452346456, 127,'1983-12-31', 'cdef', 'srtbvsr', 'w', 45634, 13452.56, 3452346456, 127, 'liuugbzvdmrlti b itiortudirtfgtibm dfi'),
116('1980-10-14', 'fgbbd', 'dtzndtz', 'w', 67856, 5463354.67, 3567845333, 124,'1980-10-14', 'fgbbd', 'dtzndtz', 'w', 67856, 5463354.67, 3567845333, 124, 'd,f söierugsig msireg siug ei5ggth lrutluitgzeöjrtnb.rkjthuekuhzrkuthgjdnffjmbr'),
117('2000-06-15', 'jukg','zikhuk','m', 45675, 6465754.13, 435242623462, 18, '2000-06-15', 'jukg','zikhuk','m', 45675, 6465754.13, 435242623462, 18, 'pib mdotkbm.m');
118select * from t1;
119a	b	c	d	e	f	g	h	a1	b1	c1	d1	e1	f1	g1	h1	i
1201983-12-31	cdef	srtbvsr	w	45634	13452.56	3452346456	127	1983-12-31	cdef	srtbvsr	w	45634	13452.56	3452346456	127	liuugbzvdmrlti b itiortudirtfgtibm dfi
1211980-10-14	fgbbd	dtzndtz	w	67856	5463354.67	3567845333	124	1980-10-14	fgbbd	dtzndtz	w	67856	5463354.67	3567845333	124	d,f söierugsig msireg siug ei5ggth lrutluitgzeöjrtnb.rkjthuekuhzrkuthgjdnffjmbr
1221975-01-01	abcde	abcde	m	1234	123.45	32412341234	113	1975-01-01	abcde	abcde	m	1234	123.45	32412341234	113	tbhth nrzh ztfghgfh fzh ftzhj fztjh
1232000-06-15	jukg	zikhuk	m	45675	6465754.13	435242623462	18	2000-06-15	jukg	zikhuk	m	45675	6465754.13	435242623462	18	pib mdotkbm.m
124select * from t1 where a<19851231;
125a	b	c	d	e	f	g	h	a1	b1	c1	d1	e1	f1	g1	h1	i
1261975-01-01	abcde	abcde	m	1234	123.45	32412341234	113	1975-01-01	abcde	abcde	m	1234	123.45	32412341234	113	tbhth nrzh ztfghgfh fzh ftzhj fztjh
1271980-10-14	fgbbd	dtzndtz	w	67856	5463354.67	3567845333	124	1980-10-14	fgbbd	dtzndtz	w	67856	5463354.67	3567845333	124	d,f söierugsig msireg siug ei5ggth lrutluitgzeöjrtnb.rkjthuekuhzrkuthgjdnffjmbr
1281983-12-31	cdef	srtbvsr	w	45634	13452.56	3452346456	127	1983-12-31	cdef	srtbvsr	w	45634	13452.56	3452346456	127	liuugbzvdmrlti b itiortudirtfgtibm dfi
129drop table t1;
130create table t1 (a date not null, b varchar(50) not null, c varchar(50) not null, d enum('m', 'w') not null, e int not null, f decimal (18,2) not null, g bigint not null, h tinyint not null, a1 date not null, b1 varchar(50) not null, c1 varchar(50) not null, d1 enum('m', 'w') not null, e1 int not null, f1 decimal (18,2) not null, g1 bigint not null, h1 tinyint not null, a2 date not null, b2 varchar(50) not null, c2 varchar(50) not null, d2 enum('m', 'w') not null, e2 int not null, f2 decimal (18,2) not null, g2 bigint not null, h2 tinyint not null, a3 date not null, b3 varchar(50) not null, c3 varchar(50) not null, d3 enum('m', 'w') not null, e3 int not null, f3 decimal (18,2) not null, g3 bigint not null, h3 tinyint not null, i char(255), primary key(a,b,c,d,e,f,g,h,a1,b1,c1,d1,e1,f1,g1,h1,a2,b2,c2,d2,e2,f2,g2,h2,a3,b3,c3,d3,e3,f3,g3,h3)) engine='TokuDB'
131partition by key(a,b,c,d,e,f,g,h,a1,b1,c1,d1,e1,f1,g1,h1,a2,b2,c2,d2,e2,f2,g2,h2,a3,b3,c3,d3,e3,f3,g3,h3) (
132partition pa1 max_rows=20 min_rows=2,
133partition pa2 max_rows=30 min_rows=3,
134partition pa3 max_rows=30 min_rows=4,
135partition pa4 max_rows=40 min_rows=2);
136ERROR HY000: Too many fields in 'list of partition fields'
137create table t1 (a date not null, b varchar(50) not null, c varchar(50) not null, d enum('m', 'w') not null, e int not null, f decimal (18,2) not null, g bigint not null, h tinyint not null, a1 date not null, b1 varchar(50) not null, c1 varchar(50) not null, d1 enum('m', 'w') not null, e1 int not null, f1 decimal (18,2) not null, g1 bigint not null, h1 tinyint not null, a2 date not null, b2 varchar(50) not null, c2 varchar(50) not null, d2 enum('m', 'w') not null, e2 int not null, f2 decimal (18,2) not null, g2 bigint not null, h2 tinyint not null, a3 date not null, b3 varchar(50) not null, c3 varchar(50) not null, d3 enum('m', 'w') not null, e3 int not null, f3 decimal (18,2) not null, g3 bigint not null, h3 tinyint not null, i char(255), primary key(a,b,c,d,e,f,g,h,a1,b1,c1,d1,e1,f1,g1,h1)) engine='TokuDB'
138partition by key(a,b,c,d,e,f,g,h) (
139partition pa1 max_rows=20 min_rows=2,
140partition pa2 max_rows=30 min_rows=3,
141partition pa3 max_rows=30 min_rows=4,
142partition pa4 max_rows=40 min_rows=2);
143show create table t1;
144Table	Create Table
145t1	CREATE TABLE `t1` (
146  `a` date NOT NULL,
147  `b` varchar(50) NOT NULL,
148  `c` varchar(50) NOT NULL,
149  `d` enum('m','w') NOT NULL,
150  `e` int(11) NOT NULL,
151  `f` decimal(18,2) NOT NULL,
152  `g` bigint(20) NOT NULL,
153  `h` tinyint(4) NOT NULL,
154  `a1` date NOT NULL,
155  `b1` varchar(50) NOT NULL,
156  `c1` varchar(50) NOT NULL,
157  `d1` enum('m','w') NOT NULL,
158  `e1` int(11) NOT NULL,
159  `f1` decimal(18,2) NOT NULL,
160  `g1` bigint(20) NOT NULL,
161  `h1` tinyint(4) NOT NULL,
162  `a2` date NOT NULL,
163  `b2` varchar(50) NOT NULL,
164  `c2` varchar(50) NOT NULL,
165  `d2` enum('m','w') NOT NULL,
166  `e2` int(11) NOT NULL,
167  `f2` decimal(18,2) NOT NULL,
168  `g2` bigint(20) NOT NULL,
169  `h2` tinyint(4) NOT NULL,
170  `a3` date NOT NULL,
171  `b3` varchar(50) NOT NULL,
172  `c3` varchar(50) NOT NULL,
173  `d3` enum('m','w') NOT NULL,
174  `e3` int(11) NOT NULL,
175  `f3` decimal(18,2) NOT NULL,
176  `g3` bigint(20) NOT NULL,
177  `h3` tinyint(4) NOT NULL,
178  `i` char(255) DEFAULT NULL,
179  PRIMARY KEY (`a`,`b`,`c`,`d`,`e`,`f`,`g`,`h`,`a1`,`b1`,`c1`,`d1`,`e1`,`f1`,`g1`,`h1`)
180) ENGINE=TokuDB DEFAULT CHARSET=latin1
181/*!50100 PARTITION BY KEY (a,b,c,d,e,f,g,h)
182(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = TokuDB,
183 PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = TokuDB,
184 PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = TokuDB,
185 PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = TokuDB) */
186insert into t1 values
187('1975-01-01', 'abcde', 'abcde','m', 1234, 123.45, 32412341234, 113,'1975-01-01', 'abcde', 'abcde','m', 1234, 123.45, 32412341234, 113,'1975-01-01', 'abcde', 'abcde','m', 1234, 123.45, 32412341234, 113, '1975-01-01', 'abcde', 'abcde','m', 1234, 123.45, 32412341234, 113, 'tbhth nrzh ztfghgfh fzh ftzhj fztjh'),
188('1983-12-31', 'cdef', 'srtbvsr', 'w', 45634, 13452.56, 3452346456, 127,'1983-12-31', 'cdef', 'srtbvsr', 'w', 45634, 13452.56, 3452346456, 127, '1983-12-31', 'cdef', 'srtbvsr', 'w', 45634, 13452.56, 3452346456, 127, '1983-12-31', 'cdef', 'srtbvsr', 'w', 45634, 13452.56, 3452346456, 127, 'liuugbzvdmrlti b itiortudirtfgtibm dfi'),
189('1980-10-14', 'fgbbd', 'dtzndtz', 'w', 67856, 5463354.67, 3567845333, 124, '1980-10-14', 'fgbbd', 'dtzndtz', 'w', 67856, 5463354.67, 3567845333, 124, '1980-10-14', 'fgbbd', 'dtzndtz', 'w', 67856, 5463354.67, 3567845333, 124, '1980-10-14', 'fgbbd', 'dtzndtz', 'w', 67856, 5463354.67, 3567845333, 124, 'd,f söierugsig msireg siug ei5ggth lrutluitgzeöjrtnb.rkjthuekuhzrkuthgjdnffjmbr'),
190('2000-06-15', 'jukg','zikhuk','m', 45675, 6465754.13, 435242623462, 18, '2000-06-15', 'jukg','zikhuk','m', 45675, 6465754.13, 435242623462, 18, '2000-06-15', 'jukg','zikhuk','m', 45675, 6465754.13, 435242623462, 18, '2000-06-15', 'jukg','zikhuk','m', 45675, 6465754.13, 435242623462, 18, 'pib mdotkbm.m');
191select * from t1;
192a	b	c	d	e	f	g	h	a1	b1	c1	d1	e1	f1	g1	h1	a2	b2	c2	d2	e2	f2	g2	h2	a3	b3	c3	d3	e3	f3	g3	h3	i
1931980-10-14	fgbbd	dtzndtz	w	67856	5463354.67	3567845333	124	1980-10-14	fgbbd	dtzndtz	w	67856	5463354.67	3567845333	124	1980-10-14	fgbbd	dtzndtz	w	67856	5463354.67	3567845333	124	1980-10-14	fgbbd	dtzndtz	w	67856	5463354.67	3567845333	124	d,f söierugsig msireg siug ei5ggth lrutluitgzeöjrtnb.rkjthuekuhzrkuthgjdnffjmbr
1941983-12-31	cdef	srtbvsr	w	45634	13452.56	3452346456	127	1983-12-31	cdef	srtbvsr	w	45634	13452.56	3452346456	127	1983-12-31	cdef	srtbvsr	w	45634	13452.56	3452346456	127	1983-12-31	cdef	srtbvsr	w	45634	13452.56	3452346456	127	liuugbzvdmrlti b itiortudirtfgtibm dfi
1951975-01-01	abcde	abcde	m	1234	123.45	32412341234	113	1975-01-01	abcde	abcde	m	1234	123.45	32412341234	113	1975-01-01	abcde	abcde	m	1234	123.45	32412341234	113	1975-01-01	abcde	abcde	m	1234	123.45	32412341234	113	tbhth nrzh ztfghgfh fzh ftzhj fztjh
1962000-06-15	jukg	zikhuk	m	45675	6465754.13	435242623462	18	2000-06-15	jukg	zikhuk	m	45675	6465754.13	435242623462	18	2000-06-15	jukg	zikhuk	m	45675	6465754.13	435242623462	18	2000-06-15	jukg	zikhuk	m	45675	6465754.13	435242623462	18	pib mdotkbm.m
197select * from t1 where a<19851231;
198a	b	c	d	e	f	g	h	a1	b1	c1	d1	e1	f1	g1	h1	a2	b2	c2	d2	e2	f2	g2	h2	a3	b3	c3	d3	e3	f3	g3	h3	i
1991975-01-01	abcde	abcde	m	1234	123.45	32412341234	113	1975-01-01	abcde	abcde	m	1234	123.45	32412341234	113	1975-01-01	abcde	abcde	m	1234	123.45	32412341234	113	1975-01-01	abcde	abcde	m	1234	123.45	32412341234	113	tbhth nrzh ztfghgfh fzh ftzhj fztjh
2001980-10-14	fgbbd	dtzndtz	w	67856	5463354.67	3567845333	124	1980-10-14	fgbbd	dtzndtz	w	67856	5463354.67	3567845333	124	1980-10-14	fgbbd	dtzndtz	w	67856	5463354.67	3567845333	124	1980-10-14	fgbbd	dtzndtz	w	67856	5463354.67	3567845333	124	d,f söierugsig msireg siug ei5ggth lrutluitgzeöjrtnb.rkjthuekuhzrkuthgjdnffjmbr
2011983-12-31	cdef	srtbvsr	w	45634	13452.56	3452346456	127	1983-12-31	cdef	srtbvsr	w	45634	13452.56	3452346456	127	1983-12-31	cdef	srtbvsr	w	45634	13452.56	3452346456	127	1983-12-31	cdef	srtbvsr	w	45634	13452.56	3452346456	127	liuugbzvdmrlti b itiortudirtfgtibm dfi
202drop table t1;
203# Bug#34604 - Assertion 'inited==RND' failed in handler::ha_rnd_end
204CREATE TABLE t1 (
205a INT AUTO_INCREMENT,
206b VARCHAR(255),
207PRIMARY KEY (a))
208ENGINE = TokuDB
209PARTITION BY HASH (a)
210PARTITIONS 2;
211SET autocommit=OFF;
212START TRANSACTION;
213INSERT INTO t1 VALUES (NULL, 'first row t2');
214SET autocommit=OFF;
215SET SESSION lock_wait_timeout= 1;
216ALTER TABLE t1 AUTO_INCREMENT = 10;
217ERROR HY000: Lock wait timeout exceeded; try restarting transaction
218DROP TABLE t1;
219#
220# Bug#53676: Unexpected errors and possible table corruption on
221#            ADD PARTITION and LOCK TABLE
222CREATE TABLE t1 ( i INT NOT NULL AUTO_INCREMENT PRIMARY KEY, f INT )
223ENGINE = TokuDB PARTITION BY HASH(i) PARTITIONS 2;
224SET lock_wait_timeout = 2;
225#Connection 1 locks the table
226LOCK TABLE t1 READ;
227# Connection 2 tries to add partitions:
228# First attempt: lock wait timeout (as expected)
229ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
230ERROR HY000: Lock wait timeout exceeded; try restarting transaction
231# Second attempt: says that partition already exists
232ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
233ERROR HY000: Lock wait timeout exceeded; try restarting transaction
234# Connection 1 unlocks the table and locks it again:
235UNLOCK TABLES;
236LOCK TABLE t1 READ;
237# Connection 2 tries again to add partitions:
238# Third attempt: says that the table does not exist
239ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
240ERROR HY000: Lock wait timeout exceeded; try restarting transaction
241# Check table returns the same (not after fixing bug#56172!)
242CHECK TABLE t1;
243Table	Op	Msg_type	Msg_text
244test.t1	check	status	OK
245UNLOCK TABLES;
246DROP TABLE t1;
247CREATE TABLE t2 ( i INT NOT NULL AUTO_INCREMENT PRIMARY KEY, f INT )
248ENGINE = TokuDB PARTITION BY HASH(i) PARTITIONS 2;
249SET lock_wait_timeout = 2;
250LOCK TABLE t2 READ;
251ALTER TABLE t2 ADD PARTITION PARTITIONS 2;
252ERROR HY000: Lock wait timeout exceeded; try restarting transaction
253ALTER TABLE t2 ADD PARTITION PARTITIONS 2;
254UNLOCK TABLES;
255CHECK TABLE t2;
256Table	Op	Msg_type	Msg_text
257test.t2	check	status	OK
258SELECT * FROM t2;
259i	f
260DROP TABLE t2;
261CREATE TABLE t3 ( i INT NOT NULL AUTO_INCREMENT PRIMARY KEY, f INT )
262ENGINE = TokuDB PARTITION BY HASH(i) PARTITIONS 2;
263SET lock_wait_timeout = 2;
264# Connection 1 locks the table
265LOCK TABLE t3 READ;
266# Connection 2 tries to add partitions (timeout):
267ALTER TABLE t3 ADD PARTITION PARTITIONS 2;
268ERROR HY000: Lock wait timeout exceeded; try restarting transaction
269SET lock_wait_timeout = 2;
270# Connection 3 tries to add partitions (partition already exists):
271ALTER TABLE t3 ADD PARTITION PARTITIONS 2;
272ERROR HY000: Lock wait timeout exceeded; try restarting transaction
273# Connection 4 tries to rename the table:
274RENAME TABLE t3 TO t4;
275# Connection 1 unlocks the table:
276UNLOCK TABLES;
277# Connection 4 gets error on rename:
278# SHOW TABLES returns the table (not renamed):
279SHOW TABLES;
280Tables_in_test
281t4
282# Connection 5 attempts to read from the table (table does not exist):
283SELECT * FROM t3;
284ERROR 42S02: Table 'test.t3' doesn't exist
285DROP TABLE t4;
286#
287# PS-5174: Check COMPRESSED COLUMNS support on partitioned tables
288#
289SET @dictionary_data = 'one' 'two' 'three' 'four';
290CREATE COMPRESSION_DICTIONARY numbers (@dictionary_data);
291CREATE TABLE comp1(
292id BIGINT UNSIGNED NOT NULL,
293a VARCHAR(250) COLUMN_FORMAT COMPRESSED WITH COMPRESSION_DICTIONARY numbers DEFAULT NULL
294) ENGINE = 'TokuDB'
295PARTITION BY RANGE (id) (
296PARTITION p1 VALUES LESS THAN (100),
297PARTITION p2 VALUES LESS THAN MAXVALUE
298);
299ERROR HY000: Table storage engine 'TokuDB' does not support the create option 'COMPRESSED COLUMNS'
300DROP COMPRESSION_DICTIONARY numbers;
301