1include/master-slave.inc
2[connection master]
3SET storage_engine=myisam;
4--- Doing pre test cleanup ---
5DROP TABLE IF EXISTS t1;
6--- Start test 1 Basic testing ---
7--- Create Table Section ---
8CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255),
9bc CHAR(255), d DECIMAL(10,4) DEFAULT 0,
10f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
11y YEAR, t DATE,PRIMARY KEY(id));
12--- Show table on master ---
13SHOW CREATE TABLE t1;
14Table	Create Table
15t1	CREATE TABLE `t1` (
16  `id` mediumint(9) NOT NULL,
17  `b1` bit(8) DEFAULT NULL,
18  `vc` varchar(255) DEFAULT NULL,
19  `bc` char(255) DEFAULT NULL,
20  `d` decimal(10,4) DEFAULT '0.0000',
21  `f` float DEFAULT '0',
22  `total` bigint(20) unsigned DEFAULT NULL,
23  `y` year(4) DEFAULT NULL,
24  `t` date DEFAULT NULL,
25  PRIMARY KEY (`id`)
26) ENGINE=MyISAM DEFAULT CHARSET=latin1
27--- Show table on slave ---
28SHOW CREATE TABLE t1;
29Table	Create Table
30t1	CREATE TABLE `t1` (
31  `id` mediumint(9) NOT NULL,
32  `b1` bit(8) DEFAULT NULL,
33  `vc` varchar(255) DEFAULT NULL,
34  `bc` char(255) DEFAULT NULL,
35  `d` decimal(10,4) DEFAULT '0.0000',
36  `f` float DEFAULT '0',
37  `total` bigint(20) unsigned DEFAULT NULL,
38  `y` year(4) DEFAULT NULL,
39  `t` date DEFAULT NULL,
40  PRIMARY KEY (`id`)
41) ENGINE=ndbcluster DEFAULT CHARSET=latin1
42--- Perform basic operation on master ---
43--- and ensure replicated correctly ---
44"--- Insert into t1 --" as "";
45--- Select from t1 on master ---
46select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
47id	hex(b1)	vc	bc	d	f	total	y	t
482	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1965-11-14
494	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1985-11-14
5042	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1905-11-14
51142	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1995-11-14
52412	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2005-11-14
53--- Select from t1 on slave ---
54select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
55id	hex(b1)	vc	bc	d	f	total	y	t
562	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1965-11-14
574	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1985-11-14
5842	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1905-11-14
59142	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1995-11-14
60412	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2005-11-14
61--- Update t1 on master --
62UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
63--- Check the update on master ---
64SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
65id	hex(b1)	vc	bc	d	f	total	y	t
66412	0	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2006-02-22
67--- Check Update on slave ---
68SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
69id	hex(b1)	vc	bc	d	f	total	y	t
70412	0	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2006-02-22
71--- Remove a record from t1 on master ---
72DELETE FROM t1 WHERE id = 42;
73--- Show current count on master for t1 ---
74SELECT COUNT(*) FROM t1;
75COUNT(*)
764
77--- Show current count on slave for t1 ---
78SELECT COUNT(*) FROM t1;
79COUNT(*)
804
81DELETE FROM t1;
82--- Check that simple Alter statements are replicated correctly --
83ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(id, total);
84ALTER TABLE t1 MODIFY vc TEXT;
85--- Show the new improved table on the master ---
86SHOW CREATE TABLE t1;
87Table	Create Table
88t1	CREATE TABLE `t1` (
89  `id` mediumint(9) NOT NULL,
90  `b1` bit(8) DEFAULT NULL,
91  `vc` text,
92  `bc` char(255) DEFAULT NULL,
93  `d` decimal(10,4) DEFAULT '0.0000',
94  `f` float DEFAULT '0',
95  `total` bigint(20) unsigned NOT NULL DEFAULT '0',
96  `y` year(4) DEFAULT NULL,
97  `t` date DEFAULT NULL,
98  PRIMARY KEY (`id`,`total`)
99) ENGINE=MyISAM DEFAULT CHARSET=latin1
100--- Make sure that our tables on slave are still same engine ---
101--- and that the alter statements replicated correctly ---
102SHOW CREATE TABLE t1;
103Table	Create Table
104t1	CREATE TABLE `t1` (
105  `id` mediumint(9) NOT NULL,
106  `b1` bit(8) DEFAULT NULL,
107  `vc` text,
108  `bc` char(255) DEFAULT NULL,
109  `d` decimal(10,4) DEFAULT '0.0000',
110  `f` float DEFAULT '0',
111  `total` bigint(20) unsigned NOT NULL DEFAULT '0',
112  `y` year(4) DEFAULT NULL,
113  `t` date DEFAULT NULL,
114  PRIMARY KEY (`id`,`total`)
115) ENGINE=ndbcluster DEFAULT CHARSET=latin1
116--- Perform basic operation on master ---
117--- and ensure replicated correctly ---
118"--- Insert into t1 --" as "";
119--- Select from t1 on master ---
120select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
121id	hex(b1)	vc	bc	d	f	total	y	t
1222	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1965-11-14
1234	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1985-11-14
12442	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1905-11-14
125142	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1995-11-14
126412	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2005-11-14
127--- Select from t1 on slave ---
128select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
129id	hex(b1)	vc	bc	d	f	total	y	t
1302	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1965-11-14
1314	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1985-11-14
13242	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1905-11-14
133142	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1995-11-14
134412	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2005-11-14
135--- Update t1 on master --
136UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
137--- Check the update on master ---
138SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
139id	hex(b1)	vc	bc	d	f	total	y	t
140412	0	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2006-02-22
141--- Check Update on slave ---
142SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
143id	hex(b1)	vc	bc	d	f	total	y	t
144412	0	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2006-02-22
145--- Remove a record from t1 on master ---
146DELETE FROM t1 WHERE id = 42;
147--- Show current count on master for t1 ---
148SELECT COUNT(*) FROM t1;
149COUNT(*)
1504
151--- Show current count on slave for t1 ---
152SELECT COUNT(*) FROM t1;
153COUNT(*)
1544
155DELETE FROM t1;
156--- End test 1 Basic testing ---
157--- Do Cleanup --
158DROP TABLE IF EXISTS t1;
159--- Start test 2 partition RANGE testing --
160--- Do setup --
161CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255),
162bc CHAR(255), d DECIMAL(10,4) DEFAULT 0,
163f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
164y YEAR, t DATE, primary key(t))
165PARTITION BY RANGE (YEAR(t))
166(PARTITION p0 VALUES LESS THAN (1901),
167PARTITION p1 VALUES LESS THAN (1946),
168PARTITION p2 VALUES LESS THAN (1966),
169PARTITION p3 VALUES LESS THAN (1986),
170PARTITION p4 VALUES LESS THAN (2005),
171PARTITION p5 VALUES LESS THAN MAXVALUE);
172--- Show table on master ---
173SHOW CREATE TABLE t1;
174Table	Create Table
175t1	CREATE TABLE `t1` (
176  `id` mediumint(9) NOT NULL,
177  `b1` bit(8) DEFAULT NULL,
178  `vc` varchar(255) DEFAULT NULL,
179  `bc` char(255) DEFAULT NULL,
180  `d` decimal(10,4) DEFAULT '0.0000',
181  `f` float DEFAULT '0',
182  `total` bigint(20) unsigned DEFAULT NULL,
183  `y` year(4) DEFAULT NULL,
184  `t` date NOT NULL DEFAULT '0000-00-00',
185  PRIMARY KEY (`t`)
186) ENGINE=MyISAM DEFAULT CHARSET=latin1
187/*!50100 PARTITION BY RANGE (YEAR(t))
188(PARTITION p0 VALUES LESS THAN (1901) ENGINE = MyISAM,
189 PARTITION p1 VALUES LESS THAN (1946) ENGINE = MyISAM,
190 PARTITION p2 VALUES LESS THAN (1966) ENGINE = MyISAM,
191 PARTITION p3 VALUES LESS THAN (1986) ENGINE = MyISAM,
192 PARTITION p4 VALUES LESS THAN (2005) ENGINE = MyISAM,
193 PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
194--- Show table on slave --
195SHOW CREATE TABLE t1;
196Table	Create Table
197t1	CREATE TABLE `t1` (
198  `id` mediumint(9) NOT NULL,
199  `b1` bit(8) DEFAULT NULL,
200  `vc` varchar(255) DEFAULT NULL,
201  `bc` char(255) DEFAULT NULL,
202  `d` decimal(10,4) DEFAULT '0.0000',
203  `f` float DEFAULT '0',
204  `total` bigint(20) unsigned DEFAULT NULL,
205  `y` year(4) DEFAULT NULL,
206  `t` date NOT NULL DEFAULT '0000-00-00',
207  PRIMARY KEY (`t`)
208) ENGINE=ndbcluster DEFAULT CHARSET=latin1
209/*!50100 PARTITION BY RANGE (YEAR(t))
210(PARTITION p0 VALUES LESS THAN (1901) ENGINE = ndbcluster,
211 PARTITION p1 VALUES LESS THAN (1946) ENGINE = ndbcluster,
212 PARTITION p2 VALUES LESS THAN (1966) ENGINE = ndbcluster,
213 PARTITION p3 VALUES LESS THAN (1986) ENGINE = ndbcluster,
214 PARTITION p4 VALUES LESS THAN (2005) ENGINE = ndbcluster,
215 PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ndbcluster) */
216--- Perform basic operation on master ---
217--- and ensure replicated correctly ---
218"--- Insert into t1 --" as "";
219--- Select from t1 on master ---
220select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
221id	hex(b1)	vc	bc	d	f	total	y	t
2222	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1965-11-14
2234	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1985-11-14
22442	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1905-11-14
225142	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1995-11-14
226412	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2005-11-14
227--- Select from t1 on slave ---
228select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
229id	hex(b1)	vc	bc	d	f	total	y	t
2302	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1965-11-14
2314	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1985-11-14
23242	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1905-11-14
233142	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1995-11-14
234412	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2005-11-14
235--- Update t1 on master --
236UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
237--- Check the update on master ---
238SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
239id	hex(b1)	vc	bc	d	f	total	y	t
240412	0	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2006-02-22
241--- Check Update on slave ---
242SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
243id	hex(b1)	vc	bc	d	f	total	y	t
244412	0	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2006-02-22
245--- Remove a record from t1 on master ---
246DELETE FROM t1 WHERE id = 42;
247--- Show current count on master for t1 ---
248SELECT COUNT(*) FROM t1;
249COUNT(*)
2504
251--- Show current count on slave for t1 ---
252SELECT COUNT(*) FROM t1;
253COUNT(*)
2544
255DELETE FROM t1;
256--- Check that simple Alter statements are replicated correctly ---
257ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(t, id);
258ALTER TABLE t1 MODIFY vc TEXT;
259--- Show the new improved table on the master ---
260SHOW CREATE TABLE t1;
261Table	Create Table
262t1	CREATE TABLE `t1` (
263  `id` mediumint(9) NOT NULL,
264  `b1` bit(8) DEFAULT NULL,
265  `vc` text,
266  `bc` char(255) DEFAULT NULL,
267  `d` decimal(10,4) DEFAULT '0.0000',
268  `f` float DEFAULT '0',
269  `total` bigint(20) unsigned DEFAULT NULL,
270  `y` year(4) DEFAULT NULL,
271  `t` date NOT NULL DEFAULT '0000-00-00',
272  PRIMARY KEY (`t`,`id`)
273) ENGINE=MyISAM DEFAULT CHARSET=latin1
274/*!50100 PARTITION BY RANGE (YEAR(t))
275(PARTITION p0 VALUES LESS THAN (1901) ENGINE = MyISAM,
276 PARTITION p1 VALUES LESS THAN (1946) ENGINE = MyISAM,
277 PARTITION p2 VALUES LESS THAN (1966) ENGINE = MyISAM,
278 PARTITION p3 VALUES LESS THAN (1986) ENGINE = MyISAM,
279 PARTITION p4 VALUES LESS THAN (2005) ENGINE = MyISAM,
280 PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
281--- Make sure that our tables on slave are still same engine ---
282--- and that the alter statements replicated correctly ---
283SHOW CREATE TABLE t1;
284Table	Create Table
285t1	CREATE TABLE `t1` (
286  `id` mediumint(9) NOT NULL,
287  `b1` bit(8) DEFAULT NULL,
288  `vc` text,
289  `bc` char(255) DEFAULT NULL,
290  `d` decimal(10,4) DEFAULT '0.0000',
291  `f` float DEFAULT '0',
292  `total` bigint(20) unsigned DEFAULT NULL,
293  `y` year(4) DEFAULT NULL,
294  `t` date NOT NULL DEFAULT '0000-00-00',
295  PRIMARY KEY (`t`,`id`)
296) ENGINE=ndbcluster DEFAULT CHARSET=latin1
297/*!50100 PARTITION BY RANGE (YEAR(t))
298(PARTITION p0 VALUES LESS THAN (1901) ENGINE = ndbcluster,
299 PARTITION p1 VALUES LESS THAN (1946) ENGINE = ndbcluster,
300 PARTITION p2 VALUES LESS THAN (1966) ENGINE = ndbcluster,
301 PARTITION p3 VALUES LESS THAN (1986) ENGINE = ndbcluster,
302 PARTITION p4 VALUES LESS THAN (2005) ENGINE = ndbcluster,
303 PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ndbcluster) */
304--- Perform basic operation on master ---
305--- and ensure replicated correctly ---
306"--- Insert into t1 --" as "";
307--- Select from t1 on master ---
308select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
309id	hex(b1)	vc	bc	d	f	total	y	t
3102	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1965-11-14
3114	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1985-11-14
31242	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1905-11-14
313142	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1995-11-14
314412	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2005-11-14
315--- Select from t1 on slave ---
316select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
317id	hex(b1)	vc	bc	d	f	total	y	t
3182	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1965-11-14
3194	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1985-11-14
32042	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1905-11-14
321142	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1995-11-14
322412	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2005-11-14
323--- Update t1 on master --
324UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
325--- Check the update on master ---
326SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
327id	hex(b1)	vc	bc	d	f	total	y	t
328412	0	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2006-02-22
329--- Check Update on slave ---
330SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
331id	hex(b1)	vc	bc	d	f	total	y	t
332412	0	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2006-02-22
333--- Remove a record from t1 on master ---
334DELETE FROM t1 WHERE id = 42;
335--- Show current count on master for t1 ---
336SELECT COUNT(*) FROM t1;
337COUNT(*)
3384
339--- Show current count on slave for t1 ---
340SELECT COUNT(*) FROM t1;
341COUNT(*)
3424
343DELETE FROM t1;
344--- End test 2 partition RANGE testing ---
345--- Do Cleanup ---
346DROP TABLE IF EXISTS t1;
347--- Start test 3 partition LIST testing ---
348--- Do setup ---
349CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255),
350bc CHAR(255), d DECIMAL(10,4) DEFAULT 0,
351f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
352y YEAR, t DATE, primary key(id))
353PARTITION BY LIST(id)
354(PARTITION p0 VALUES IN (2, 4),
355PARTITION p1 VALUES IN (42, 142));
356--- Test 3 Alter to add partition ---
357ALTER TABLE t1 ADD PARTITION (PARTITION p2 VALUES IN (412));
358--- Show table on master ---
359SHOW CREATE TABLE t1;
360Table	Create Table
361t1	CREATE TABLE `t1` (
362  `id` mediumint(9) NOT NULL,
363  `b1` bit(8) DEFAULT NULL,
364  `vc` varchar(255) DEFAULT NULL,
365  `bc` char(255) DEFAULT NULL,
366  `d` decimal(10,4) DEFAULT '0.0000',
367  `f` float DEFAULT '0',
368  `total` bigint(20) unsigned DEFAULT NULL,
369  `y` year(4) DEFAULT NULL,
370  `t` date DEFAULT NULL,
371  PRIMARY KEY (`id`)
372) ENGINE=MyISAM DEFAULT CHARSET=latin1
373/*!50100 PARTITION BY LIST (id)
374(PARTITION p0 VALUES IN (2,4) ENGINE = MyISAM,
375 PARTITION p1 VALUES IN (42,142) ENGINE = MyISAM,
376 PARTITION p2 VALUES IN (412) ENGINE = MyISAM) */
377--- Show table on slave ---
378SHOW CREATE TABLE t1;
379Table	Create Table
380t1	CREATE TABLE `t1` (
381  `id` mediumint(9) NOT NULL,
382  `b1` bit(8) DEFAULT NULL,
383  `vc` varchar(255) DEFAULT NULL,
384  `bc` char(255) DEFAULT NULL,
385  `d` decimal(10,4) DEFAULT '0.0000',
386  `f` float DEFAULT '0',
387  `total` bigint(20) unsigned DEFAULT NULL,
388  `y` year(4) DEFAULT NULL,
389  `t` date DEFAULT NULL,
390  PRIMARY KEY (`id`)
391) ENGINE=ndbcluster DEFAULT CHARSET=latin1
392/*!50100 PARTITION BY LIST (id)
393(PARTITION p0 VALUES IN (2,4) ENGINE = ndbcluster,
394 PARTITION p1 VALUES IN (42,142) ENGINE = ndbcluster,
395 PARTITION p2 VALUES IN (412) ENGINE = ndbcluster) */
396--- Perform basic operation on master ---
397--- and ensure replicated correctly ---
398"--- Insert into t1 --" as "";
399--- Select from t1 on master ---
400select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
401id	hex(b1)	vc	bc	d	f	total	y	t
4022	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1965-11-14
4034	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1985-11-14
40442	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1905-11-14
405142	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1995-11-14
406412	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2005-11-14
407--- Select from t1 on slave ---
408select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
409id	hex(b1)	vc	bc	d	f	total	y	t
4102	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1965-11-14
4114	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1985-11-14
41242	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1905-11-14
413142	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1995-11-14
414412	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2005-11-14
415--- Update t1 on master --
416UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
417--- Check the update on master ---
418SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
419id	hex(b1)	vc	bc	d	f	total	y	t
420412	0	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2006-02-22
421--- Check Update on slave ---
422SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
423id	hex(b1)	vc	bc	d	f	total	y	t
424412	0	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2006-02-22
425--- Remove a record from t1 on master ---
426DELETE FROM t1 WHERE id = 42;
427--- Show current count on master for t1 ---
428SELECT COUNT(*) FROM t1;
429COUNT(*)
4304
431--- Show current count on slave for t1 ---
432SELECT COUNT(*) FROM t1;
433COUNT(*)
4344
435DELETE FROM t1;
436--- Check that simple Alter statements are replicated correctly ---
437ALTER TABLE t1 MODIFY vc TEXT;
438--- Show the new improved table on the master ---
439SHOW CREATE TABLE t1;
440Table	Create Table
441t1	CREATE TABLE `t1` (
442  `id` mediumint(9) NOT NULL,
443  `b1` bit(8) DEFAULT NULL,
444  `vc` text,
445  `bc` char(255) DEFAULT NULL,
446  `d` decimal(10,4) DEFAULT '0.0000',
447  `f` float DEFAULT '0',
448  `total` bigint(20) unsigned DEFAULT NULL,
449  `y` year(4) DEFAULT NULL,
450  `t` date DEFAULT NULL,
451  PRIMARY KEY (`id`)
452) ENGINE=MyISAM DEFAULT CHARSET=latin1
453/*!50100 PARTITION BY LIST (id)
454(PARTITION p0 VALUES IN (2,4) ENGINE = MyISAM,
455 PARTITION p1 VALUES IN (42,142) ENGINE = MyISAM,
456 PARTITION p2 VALUES IN (412) ENGINE = MyISAM) */
457--- Make sure that our tables on slave are still same engine ---
458--- and that the alter statements replicated correctly ---
459SHOW CREATE TABLE t1;
460Table	Create Table
461t1	CREATE TABLE `t1` (
462  `id` mediumint(9) NOT NULL,
463  `b1` bit(8) DEFAULT NULL,
464  `vc` text,
465  `bc` char(255) DEFAULT NULL,
466  `d` decimal(10,4) DEFAULT '0.0000',
467  `f` float DEFAULT '0',
468  `total` bigint(20) unsigned DEFAULT NULL,
469  `y` year(4) DEFAULT NULL,
470  `t` date DEFAULT NULL,
471  PRIMARY KEY (`id`)
472) ENGINE=ndbcluster DEFAULT CHARSET=latin1
473/*!50100 PARTITION BY LIST (id)
474(PARTITION p0 VALUES IN (2,4) ENGINE = ndbcluster,
475 PARTITION p1 VALUES IN (42,142) ENGINE = ndbcluster,
476 PARTITION p2 VALUES IN (412) ENGINE = ndbcluster) */
477--- Perform basic operation on master ---
478--- and ensure replicated correctly ---
479"--- Insert into t1 --" as "";
480--- Select from t1 on master ---
481select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
482id	hex(b1)	vc	bc	d	f	total	y	t
4832	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1965-11-14
4844	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1985-11-14
48542	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1905-11-14
486142	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1995-11-14
487412	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2005-11-14
488--- Select from t1 on slave ---
489select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
490id	hex(b1)	vc	bc	d	f	total	y	t
4912	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1965-11-14
4924	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1985-11-14
49342	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1905-11-14
494142	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1995-11-14
495412	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2005-11-14
496--- Update t1 on master --
497UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
498--- Check the update on master ---
499SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
500id	hex(b1)	vc	bc	d	f	total	y	t
501412	0	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2006-02-22
502--- Check Update on slave ---
503SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
504id	hex(b1)	vc	bc	d	f	total	y	t
505412	0	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2006-02-22
506--- Remove a record from t1 on master ---
507DELETE FROM t1 WHERE id = 42;
508--- Show current count on master for t1 ---
509SELECT COUNT(*) FROM t1;
510COUNT(*)
5114
512--- Show current count on slave for t1 ---
513SELECT COUNT(*) FROM t1;
514COUNT(*)
5154
516DELETE FROM t1;
517--- End test 3 partition LIST testing ---
518--- Do Cleanup --
519DROP TABLE IF EXISTS t1;
520--- Start test 4 partition HASH testing ---
521--- Do setup ---
522CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255),
523bc CHAR(255), d DECIMAL(10,4) DEFAULT 0,
524f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
525y YEAR, t DATE, primary key(t))
526PARTITION BY HASH( YEAR(t) )
527PARTITIONS 4;
528--- show that tables have been created correctly ---
529SHOW CREATE TABLE t1;
530Table	Create Table
531t1	CREATE TABLE `t1` (
532  `id` mediumint(9) NOT NULL,
533  `b1` bit(8) DEFAULT NULL,
534  `vc` varchar(255) DEFAULT NULL,
535  `bc` char(255) DEFAULT NULL,
536  `d` decimal(10,4) DEFAULT '0.0000',
537  `f` float DEFAULT '0',
538  `total` bigint(20) unsigned DEFAULT NULL,
539  `y` year(4) DEFAULT NULL,
540  `t` date NOT NULL DEFAULT '0000-00-00',
541  PRIMARY KEY (`t`)
542) ENGINE=MyISAM DEFAULT CHARSET=latin1
543/*!50100 PARTITION BY HASH ( YEAR(t))
544PARTITIONS 4 */
545SHOW CREATE TABLE t1;
546Table	Create Table
547t1	CREATE TABLE `t1` (
548  `id` mediumint(9) NOT NULL,
549  `b1` bit(8) DEFAULT NULL,
550  `vc` varchar(255) DEFAULT NULL,
551  `bc` char(255) DEFAULT NULL,
552  `d` decimal(10,4) DEFAULT '0.0000',
553  `f` float DEFAULT '0',
554  `total` bigint(20) unsigned DEFAULT NULL,
555  `y` year(4) DEFAULT NULL,
556  `t` date NOT NULL DEFAULT '0000-00-00',
557  PRIMARY KEY (`t`)
558) ENGINE=ndbcluster DEFAULT CHARSET=latin1
559/*!50100 PARTITION BY HASH ( YEAR(t))
560PARTITIONS 4 */
561--- Perform basic operation on master ---
562--- and ensure replicated correctly ---
563"--- Insert into t1 --" as "";
564--- Select from t1 on master ---
565select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
566id	hex(b1)	vc	bc	d	f	total	y	t
5672	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1965-11-14
5684	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1985-11-14
56942	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1905-11-14
570142	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1995-11-14
571412	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2005-11-14
572--- Select from t1 on slave ---
573select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
574id	hex(b1)	vc	bc	d	f	total	y	t
5752	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1965-11-14
5764	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1985-11-14
57742	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1905-11-14
578142	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1995-11-14
579412	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2005-11-14
580--- Update t1 on master --
581UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
582--- Check the update on master ---
583SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
584id	hex(b1)	vc	bc	d	f	total	y	t
585412	0	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2006-02-22
586--- Check Update on slave ---
587SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
588id	hex(b1)	vc	bc	d	f	total	y	t
589412	0	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2006-02-22
590--- Remove a record from t1 on master ---
591DELETE FROM t1 WHERE id = 42;
592--- Show current count on master for t1 ---
593SELECT COUNT(*) FROM t1;
594COUNT(*)
5954
596--- Show current count on slave for t1 ---
597SELECT COUNT(*) FROM t1;
598COUNT(*)
5994
600DELETE FROM t1;
601--- Check that simple Alter statements are replicated correctly ---
602ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(t,id);
603ALTER TABLE t1 MODIFY vc TEXT;
604--- Show the new improved table on the master ---
605SHOW CREATE TABLE t1;
606Table	Create Table
607t1	CREATE TABLE `t1` (
608  `id` mediumint(9) NOT NULL,
609  `b1` bit(8) DEFAULT NULL,
610  `vc` text,
611  `bc` char(255) DEFAULT NULL,
612  `d` decimal(10,4) DEFAULT '0.0000',
613  `f` float DEFAULT '0',
614  `total` bigint(20) unsigned DEFAULT NULL,
615  `y` year(4) DEFAULT NULL,
616  `t` date NOT NULL DEFAULT '0000-00-00',
617  PRIMARY KEY (`t`,`id`)
618) ENGINE=MyISAM DEFAULT CHARSET=latin1
619/*!50100 PARTITION BY HASH ( YEAR(t))
620PARTITIONS 4 */
621--- Make sure that our tables on slave are still same engine ---
622--- and that the alter statements replicated correctly ---
623SHOW CREATE TABLE t1;
624Table	Create Table
625t1	CREATE TABLE `t1` (
626  `id` mediumint(9) NOT NULL,
627  `b1` bit(8) DEFAULT NULL,
628  `vc` text,
629  `bc` char(255) DEFAULT NULL,
630  `d` decimal(10,4) DEFAULT '0.0000',
631  `f` float DEFAULT '0',
632  `total` bigint(20) unsigned DEFAULT NULL,
633  `y` year(4) DEFAULT NULL,
634  `t` date NOT NULL DEFAULT '0000-00-00',
635  PRIMARY KEY (`t`,`id`)
636) ENGINE=ndbcluster DEFAULT CHARSET=latin1
637/*!50100 PARTITION BY HASH ( YEAR(t))
638PARTITIONS 4 */
639--- Perform basic operation on master ---
640--- and ensure replicated correctly ---
641"--- Insert into t1 --" as "";
642--- Select from t1 on master ---
643select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
644id	hex(b1)	vc	bc	d	f	total	y	t
6452	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1965-11-14
6464	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1985-11-14
64742	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1905-11-14
648142	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1995-11-14
649412	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2005-11-14
650--- Select from t1 on slave ---
651select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
652id	hex(b1)	vc	bc	d	f	total	y	t
6532	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1965-11-14
6544	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1985-11-14
65542	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1905-11-14
656142	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1995-11-14
657412	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2005-11-14
658--- Update t1 on master --
659UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
660--- Check the update on master ---
661SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
662id	hex(b1)	vc	bc	d	f	total	y	t
663412	0	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2006-02-22
664--- Check Update on slave ---
665SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
666id	hex(b1)	vc	bc	d	f	total	y	t
667412	0	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2006-02-22
668--- Remove a record from t1 on master ---
669DELETE FROM t1 WHERE id = 42;
670--- Show current count on master for t1 ---
671SELECT COUNT(*) FROM t1;
672COUNT(*)
6734
674--- Show current count on slave for t1 ---
675SELECT COUNT(*) FROM t1;
676COUNT(*)
6774
678DELETE FROM t1;
679--- End test 4 partition HASH testing ---
680--- Do Cleanup --
681DROP TABLE IF EXISTS t1;
682--- Start test 5 partition by key testing ---
683--- Create Table Section ---
684CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255),
685bc CHAR(255), d DECIMAL(10,4) DEFAULT 0,
686f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
687y YEAR, t DATE,PRIMARY KEY(id))
688PARTITION BY KEY()
689PARTITIONS 4;
690--- Show that tables on master are ndbcluster tables ---
691SHOW CREATE TABLE t1;
692Table	Create Table
693t1	CREATE TABLE `t1` (
694  `id` mediumint(9) NOT NULL,
695  `b1` bit(8) DEFAULT NULL,
696  `vc` varchar(255) DEFAULT NULL,
697  `bc` char(255) DEFAULT NULL,
698  `d` decimal(10,4) DEFAULT '0.0000',
699  `f` float DEFAULT '0',
700  `total` bigint(20) unsigned DEFAULT NULL,
701  `y` year(4) DEFAULT NULL,
702  `t` date DEFAULT NULL,
703  PRIMARY KEY (`id`)
704) ENGINE=MyISAM DEFAULT CHARSET=latin1
705/*!50100 PARTITION BY KEY ()
706PARTITIONS 4 */
707--- Show that tables on slave ---
708SHOW CREATE TABLE t1;
709Table	Create Table
710t1	CREATE TABLE `t1` (
711  `id` mediumint(9) NOT NULL,
712  `b1` bit(8) DEFAULT NULL,
713  `vc` varchar(255) DEFAULT NULL,
714  `bc` char(255) DEFAULT NULL,
715  `d` decimal(10,4) DEFAULT '0.0000',
716  `f` float DEFAULT '0',
717  `total` bigint(20) unsigned DEFAULT NULL,
718  `y` year(4) DEFAULT NULL,
719  `t` date DEFAULT NULL,
720  PRIMARY KEY (`id`)
721) ENGINE=ndbcluster DEFAULT CHARSET=latin1
722/*!50100 PARTITION BY KEY ()
723PARTITIONS 4 */
724--- Perform basic operation on master ---
725--- and ensure replicated correctly ---
726"--- Insert into t1 --" as "";
727--- Select from t1 on master ---
728select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
729id	hex(b1)	vc	bc	d	f	total	y	t
7302	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1965-11-14
7314	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1985-11-14
73242	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1905-11-14
733142	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1995-11-14
734412	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2005-11-14
735--- Select from t1 on slave ---
736select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
737id	hex(b1)	vc	bc	d	f	total	y	t
7382	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1965-11-14
7394	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1985-11-14
74042	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1905-11-14
741142	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1995-11-14
742412	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2005-11-14
743--- Update t1 on master --
744UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
745--- Check the update on master ---
746SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
747id	hex(b1)	vc	bc	d	f	total	y	t
748412	0	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2006-02-22
749--- Check Update on slave ---
750SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
751id	hex(b1)	vc	bc	d	f	total	y	t
752412	0	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2006-02-22
753--- Remove a record from t1 on master ---
754DELETE FROM t1 WHERE id = 42;
755--- Show current count on master for t1 ---
756SELECT COUNT(*) FROM t1;
757COUNT(*)
7584
759--- Show current count on slave for t1 ---
760SELECT COUNT(*) FROM t1;
761COUNT(*)
7624
763DELETE FROM t1;
764--- Check that simple Alter statements are replicated correctly ---
765ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(id, total);
766--- Show the new improved table on the master ---
767SHOW CREATE TABLE t1;
768Table	Create Table
769t1	CREATE TABLE `t1` (
770  `id` mediumint(9) NOT NULL,
771  `b1` bit(8) DEFAULT NULL,
772  `vc` varchar(255) DEFAULT NULL,
773  `bc` char(255) DEFAULT NULL,
774  `d` decimal(10,4) DEFAULT '0.0000',
775  `f` float DEFAULT '0',
776  `total` bigint(20) unsigned NOT NULL DEFAULT '0',
777  `y` year(4) DEFAULT NULL,
778  `t` date DEFAULT NULL,
779  PRIMARY KEY (`id`,`total`)
780) ENGINE=MyISAM DEFAULT CHARSET=latin1
781/*!50100 PARTITION BY KEY ()
782PARTITIONS 4 */
783--- Make sure that our tables on slave are still right type ---
784--- and that the alter statements replicated correctly ---
785SHOW CREATE TABLE t1;
786Table	Create Table
787t1	CREATE TABLE `t1` (
788  `id` mediumint(9) NOT NULL,
789  `b1` bit(8) DEFAULT NULL,
790  `vc` varchar(255) DEFAULT NULL,
791  `bc` char(255) DEFAULT NULL,
792  `d` decimal(10,4) DEFAULT '0.0000',
793  `f` float DEFAULT '0',
794  `total` bigint(20) unsigned NOT NULL DEFAULT '0',
795  `y` year(4) DEFAULT NULL,
796  `t` date DEFAULT NULL,
797  PRIMARY KEY (`id`,`total`)
798) ENGINE=ndbcluster DEFAULT CHARSET=latin1
799/*!50100 PARTITION BY KEY ()
800PARTITIONS 4 */
801--- Perform basic operation on master ---
802--- and ensure replicated correctly ---
803"--- Insert into t1 --" as "";
804--- Select from t1 on master ---
805select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
806id	hex(b1)	vc	bc	d	f	total	y	t
8072	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1965-11-14
8084	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1985-11-14
80942	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1905-11-14
810142	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1995-11-14
811412	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2005-11-14
812--- Select from t1 on slave ---
813select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
814id	hex(b1)	vc	bc	d	f	total	y	t
8152	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1965-11-14
8164	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1985-11-14
81742	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1905-11-14
818142	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1995-11-14
819412	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2005-11-14
820--- Update t1 on master --
821UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
822--- Check the update on master ---
823SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
824id	hex(b1)	vc	bc	d	f	total	y	t
825412	0	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2006-02-22
826--- Check Update on slave ---
827SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
828id	hex(b1)	vc	bc	d	f	total	y	t
829412	0	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2006-02-22
830--- Remove a record from t1 on master ---
831DELETE FROM t1 WHERE id = 42;
832--- Show current count on master for t1 ---
833SELECT COUNT(*) FROM t1;
834COUNT(*)
8354
836--- Show current count on slave for t1 ---
837SELECT COUNT(*) FROM t1;
838COUNT(*)
8394
840DELETE FROM t1;
841--- Check that simple Alter statements are replicated correctly ---
842ALTER TABLE t1 MODIFY vc TEXT;
843--- Show the new improved table on the master ---
844SHOW CREATE TABLE t1;
845Table	Create Table
846t1	CREATE TABLE `t1` (
847  `id` mediumint(9) NOT NULL,
848  `b1` bit(8) DEFAULT NULL,
849  `vc` text,
850  `bc` char(255) DEFAULT NULL,
851  `d` decimal(10,4) DEFAULT '0.0000',
852  `f` float DEFAULT '0',
853  `total` bigint(20) unsigned NOT NULL DEFAULT '0',
854  `y` year(4) DEFAULT NULL,
855  `t` date DEFAULT NULL,
856  PRIMARY KEY (`id`,`total`)
857) ENGINE=MyISAM DEFAULT CHARSET=latin1
858/*!50100 PARTITION BY KEY ()
859PARTITIONS 4 */
860--- Make sure that our tables on slave are still same engine ---
861--- and that the alter statements replicated correctly ---
862SHOW CREATE TABLE t1;
863Table	Create Table
864t1	CREATE TABLE `t1` (
865  `id` mediumint(9) NOT NULL,
866  `b1` bit(8) DEFAULT NULL,
867  `vc` text,
868  `bc` char(255) DEFAULT NULL,
869  `d` decimal(10,4) DEFAULT '0.0000',
870  `f` float DEFAULT '0',
871  `total` bigint(20) unsigned NOT NULL DEFAULT '0',
872  `y` year(4) DEFAULT NULL,
873  `t` date DEFAULT NULL,
874  PRIMARY KEY (`id`,`total`)
875) ENGINE=ndbcluster DEFAULT CHARSET=latin1
876/*!50100 PARTITION BY KEY ()
877PARTITIONS 4 */
878--- Perform basic operation on master ---
879--- and ensure replicated correctly ---
880"--- Insert into t1 --" as "";
881--- Select from t1 on master ---
882select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
883id	hex(b1)	vc	bc	d	f	total	y	t
8842	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1965-11-14
8854	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1985-11-14
88642	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1905-11-14
887142	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1995-11-14
888412	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2005-11-14
889--- Select from t1 on slave ---
890select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
891id	hex(b1)	vc	bc	d	f	total	y	t
8922	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1965-11-14
8934	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1985-11-14
89442	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1905-11-14
895142	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	1995-11-14
896412	1	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2005-11-14
897--- Update t1 on master --
898UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
899--- Check the update on master ---
900SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
901id	hex(b1)	vc	bc	d	f	total	y	t
902412	0	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2006-02-22
903--- Check Update on slave ---
904SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
905id	hex(b1)	vc	bc	d	f	total	y	t
906412	0	Testing MySQL databases is a cool 	Must make it bug free for the customer	654321.4321	15.21	0	1965	2006-02-22
907--- Remove a record from t1 on master ---
908DELETE FROM t1 WHERE id = 42;
909--- Show current count on master for t1 ---
910SELECT COUNT(*) FROM t1;
911COUNT(*)
9124
913--- Show current count on slave for t1 ---
914SELECT COUNT(*) FROM t1;
915COUNT(*)
9164
917DELETE FROM t1;
918--- End test 5 key partition testing ---
919--- Do Cleanup ---
920DROP TABLE IF EXISTS t1;
921include/rpl_end.inc
922