~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

« back to all changes in this revision

Viewing changes to mysql-test/suite/rpl_ndb/r/rpl_ndb_innodb2ndb.result

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Tretkowski
  • Date: 2010-03-17 14:56:02 UTC
  • Revision ID: james.westby@ubuntu.com-20100317145602-x7e30l1b2sb5s6w6
Tags: upstream-5.1.45
ImportĀ upstreamĀ versionĀ 5.1.45

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
stop slave;
 
2
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
 
3
reset master;
 
4
reset slave;
 
5
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
 
6
start slave;
 
7
SET storage_engine=innodb;
 
8
--- Doing pre test cleanup --- 
 
9
DROP TABLE IF EXISTS t1;
 
10
--- Start test 1 Basic testing ---
 
11
--- Create Table Section ---
 
12
CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), 
 
13
bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, 
 
14
f FLOAT DEFAULT 0, total BIGINT UNSIGNED, 
 
15
y YEAR, t DATE,PRIMARY KEY(id));
 
16
--- Show table on master ---
 
17
SHOW CREATE TABLE t1;
 
18
Table   Create Table
 
19
t1      CREATE TABLE `t1` (
 
20
  `id` mediumint(9) NOT NULL,
 
21
  `b1` bit(8) DEFAULT NULL,
 
22
  `vc` varchar(255) DEFAULT NULL,
 
23
  `bc` char(255) DEFAULT NULL,
 
24
  `d` decimal(10,4) DEFAULT '0.0000',
 
25
  `f` float DEFAULT '0',
 
26
  `total` bigint(20) unsigned DEFAULT NULL,
 
27
  `y` year(4) DEFAULT NULL,
 
28
  `t` date DEFAULT NULL,
 
29
  PRIMARY KEY (`id`)
 
30
) ENGINE=InnoDB DEFAULT CHARSET=latin1
 
31
--- Show table on slave ---
 
32
SHOW CREATE TABLE t1;
 
33
Table   Create Table
 
34
t1      CREATE TABLE `t1` (
 
35
  `id` mediumint(9) NOT NULL,
 
36
  `b1` bit(8) DEFAULT NULL,
 
37
  `vc` varchar(255) DEFAULT NULL,
 
38
  `bc` char(255) DEFAULT NULL,
 
39
  `d` decimal(10,4) DEFAULT '0.0000',
 
40
  `f` float DEFAULT '0',
 
41
  `total` bigint(20) unsigned DEFAULT NULL,
 
42
  `y` year(4) DEFAULT NULL,
 
43
  `t` date DEFAULT NULL,
 
44
  PRIMARY KEY (`id`)
 
45
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
 
46
--- Perform basic operation on master ---
 
47
--- and ensure replicated correctly ---
 
48
"--- Insert into t1 --" as "";
 
49
--- Select from t1 on master --- 
 
50
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
 
51
id      hex(b1) vc      bc      d       f       total   y       t
 
52
2       1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1965-11-14
 
53
4       1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1985-11-14
 
54
42      1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1905-11-14
 
55
142     1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1995-11-14
 
56
412     1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    2005-11-14
 
57
--- Select from t1 on slave ---
 
58
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
 
59
id      hex(b1) vc      bc      d       f       total   y       t
 
60
2       1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1965-11-14
 
61
4       1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1985-11-14
 
62
42      1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1905-11-14
 
63
142     1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1995-11-14
 
64
412     1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    2005-11-14
 
65
--- Update t1 on master --
 
66
UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
 
67
--- Check the update on master --- 
 
68
SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
 
69
id      hex(b1) vc      bc      d       f       total   y       t
 
70
412     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
--- Check Update on slave ---
 
72
SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
 
73
id      hex(b1) vc      bc      d       f       total   y       t
 
74
412     0       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    2006-02-22
 
75
--- Remove a record from t1 on master ---
 
76
DELETE FROM t1 WHERE id = 42;
 
77
--- Show current count on master for t1 ---
 
78
SELECT COUNT(*) FROM t1;
 
79
COUNT(*)
 
80
4
 
81
--- Show current count on slave for t1 --- 
 
82
SELECT COUNT(*) FROM t1;
 
83
COUNT(*)
 
84
4
 
85
DELETE FROM t1;
 
86
--- Check that simple Alter statements are replicated correctly --
 
87
ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(id, total);
 
88
ALTER TABLE t1 MODIFY vc TEXT;
 
89
--- Show the new improved table on the master ---
 
90
SHOW CREATE TABLE t1;
 
91
Table   Create Table
 
92
t1      CREATE TABLE `t1` (
 
93
  `id` mediumint(9) NOT NULL,
 
94
  `b1` bit(8) DEFAULT NULL,
 
95
  `vc` text,
 
96
  `bc` char(255) DEFAULT NULL,
 
97
  `d` decimal(10,4) DEFAULT '0.0000',
 
98
  `f` float DEFAULT '0',
 
99
  `total` bigint(20) unsigned NOT NULL DEFAULT '0',
 
100
  `y` year(4) DEFAULT NULL,
 
101
  `t` date DEFAULT NULL,
 
102
  PRIMARY KEY (`id`,`total`)
 
103
) ENGINE=InnoDB DEFAULT CHARSET=latin1
 
104
--- Make sure that our tables on slave are still same engine ---
 
105
--- and that the alter statements replicated correctly ---
 
106
SHOW CREATE TABLE t1;
 
107
Table   Create Table
 
108
t1      CREATE TABLE `t1` (
 
109
  `id` mediumint(9) NOT NULL,
 
110
  `b1` bit(8) DEFAULT NULL,
 
111
  `vc` text,
 
112
  `bc` char(255) DEFAULT NULL,
 
113
  `d` decimal(10,4) DEFAULT '0.0000',
 
114
  `f` float DEFAULT '0',
 
115
  `total` bigint(20) unsigned NOT NULL DEFAULT '0',
 
116
  `y` year(4) DEFAULT NULL,
 
117
  `t` date DEFAULT NULL,
 
118
  PRIMARY KEY (`id`,`total`)
 
119
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
 
120
--- Perform basic operation on master ---
 
121
--- and ensure replicated correctly --- 
 
122
"--- Insert into t1 --" as "";
 
123
--- Select from t1 on master --- 
 
124
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
 
125
id      hex(b1) vc      bc      d       f       total   y       t
 
126
2       1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1965-11-14
 
127
4       1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1985-11-14
 
128
42      1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1905-11-14
 
129
142     1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1995-11-14
 
130
412     1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    2005-11-14
 
131
--- Select from t1 on slave ---
 
132
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
 
133
id      hex(b1) vc      bc      d       f       total   y       t
 
134
2       1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1965-11-14
 
135
4       1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1985-11-14
 
136
42      1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1905-11-14
 
137
142     1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1995-11-14
 
138
412     1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    2005-11-14
 
139
--- Update t1 on master --
 
140
UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
 
141
--- Check the update on master --- 
 
142
SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
 
143
id      hex(b1) vc      bc      d       f       total   y       t
 
144
412     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
--- Check Update on slave ---
 
146
SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
 
147
id      hex(b1) vc      bc      d       f       total   y       t
 
148
412     0       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    2006-02-22
 
149
--- Remove a record from t1 on master ---
 
150
DELETE FROM t1 WHERE id = 42;
 
151
--- Show current count on master for t1 ---
 
152
SELECT COUNT(*) FROM t1;
 
153
COUNT(*)
 
154
4
 
155
--- Show current count on slave for t1 --- 
 
156
SELECT COUNT(*) FROM t1;
 
157
COUNT(*)
 
158
4
 
159
DELETE FROM t1;
 
160
--- End test 1 Basic testing ---
 
161
--- Do Cleanup --
 
162
DROP TABLE IF EXISTS t1;
 
163
--- Start test 2 partition RANGE testing --
 
164
--- Do setup --
 
165
CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), 
 
166
bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, 
 
167
f FLOAT DEFAULT 0, total BIGINT UNSIGNED, 
 
168
y YEAR, t DATE)
 
169
PARTITION BY RANGE (YEAR(t)) 
 
170
(PARTITION p0 VALUES LESS THAN (1901), 
 
171
PARTITION p1 VALUES LESS THAN (1946),  
 
172
PARTITION p2 VALUES LESS THAN (1966), 
 
173
PARTITION p3 VALUES LESS THAN (1986), 
 
174
PARTITION p4 VALUES LESS THAN (2005), 
 
175
PARTITION p5 VALUES LESS THAN MAXVALUE);
 
176
--- Show table on master ---
 
177
SHOW CREATE TABLE t1;
 
178
Table   Create Table
 
179
t1      CREATE TABLE `t1` (
 
180
  `id` mediumint(9) NOT NULL,
 
181
  `b1` bit(8) DEFAULT NULL,
 
182
  `vc` varchar(255) DEFAULT NULL,
 
183
  `bc` char(255) DEFAULT NULL,
 
184
  `d` decimal(10,4) DEFAULT '0.0000',
 
185
  `f` float DEFAULT '0',
 
186
  `total` bigint(20) unsigned DEFAULT NULL,
 
187
  `y` year(4) DEFAULT NULL,
 
188
  `t` date DEFAULT NULL
 
189
) ENGINE=InnoDB DEFAULT CHARSET=latin1
 
190
/*!50100 PARTITION BY RANGE (YEAR(t))
 
191
(PARTITION p0 VALUES LESS THAN (1901) ENGINE = InnoDB,
 
192
 PARTITION p1 VALUES LESS THAN (1946) ENGINE = InnoDB,
 
193
 PARTITION p2 VALUES LESS THAN (1966) ENGINE = InnoDB,
 
194
 PARTITION p3 VALUES LESS THAN (1986) ENGINE = InnoDB,
 
195
 PARTITION p4 VALUES LESS THAN (2005) ENGINE = InnoDB,
 
196
 PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
 
197
--- Show table on slave --
 
198
SHOW CREATE TABLE t1;
 
199
Table   Create Table
 
200
t1      CREATE TABLE `t1` (
 
201
  `id` mediumint(9) NOT NULL,
 
202
  `b1` bit(8) DEFAULT NULL,
 
203
  `vc` varchar(255) DEFAULT NULL,
 
204
  `bc` char(255) DEFAULT NULL,
 
205
  `d` decimal(10,4) DEFAULT '0.0000',
 
206
  `f` float DEFAULT '0',
 
207
  `total` bigint(20) unsigned DEFAULT NULL,
 
208
  `y` year(4) DEFAULT NULL,
 
209
  `t` date DEFAULT NULL
 
210
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
 
211
/*!50100 PARTITION BY RANGE (YEAR(t))
 
212
(PARTITION p0 VALUES LESS THAN (1901) ENGINE = ndbcluster,
 
213
 PARTITION p1 VALUES LESS THAN (1946) ENGINE = ndbcluster,
 
214
 PARTITION p2 VALUES LESS THAN (1966) ENGINE = ndbcluster,
 
215
 PARTITION p3 VALUES LESS THAN (1986) ENGINE = ndbcluster,
 
216
 PARTITION p4 VALUES LESS THAN (2005) ENGINE = ndbcluster,
 
217
 PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ndbcluster) */
 
218
--- Perform basic operation on master ---
 
219
--- and ensure replicated correctly ---
 
220
"--- Insert into t1 --" as "";
 
221
--- Select from t1 on master --- 
 
222
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
 
223
id      hex(b1) vc      bc      d       f       total   y       t
 
224
2       1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1965-11-14
 
225
4       1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1985-11-14
 
226
42      1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1905-11-14
 
227
142     1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1995-11-14
 
228
412     1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    2005-11-14
 
229
--- Select from t1 on slave ---
 
230
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
 
231
id      hex(b1) vc      bc      d       f       total   y       t
 
232
2       1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1965-11-14
 
233
4       1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1985-11-14
 
234
42      1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1905-11-14
 
235
142     1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1995-11-14
 
236
412     1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    2005-11-14
 
237
--- Update t1 on master --
 
238
UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
 
239
--- Check the update on master --- 
 
240
SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
 
241
id      hex(b1) vc      bc      d       f       total   y       t
 
242
412     0       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    2006-02-22
 
243
--- Check Update on slave ---
 
244
SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
 
245
id      hex(b1) vc      bc      d       f       total   y       t
 
246
412     0       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    2006-02-22
 
247
--- Remove a record from t1 on master ---
 
248
DELETE FROM t1 WHERE id = 42;
 
249
--- Show current count on master for t1 ---
 
250
SELECT COUNT(*) FROM t1;
 
251
COUNT(*)
 
252
4
 
253
--- Show current count on slave for t1 --- 
 
254
SELECT COUNT(*) FROM t1;
 
255
COUNT(*)
 
256
4
 
257
DELETE FROM t1;
 
258
--- Check that simple Alter statements are replicated correctly ---
 
259
ALTER TABLE t1 ADD PRIMARY KEY(t,id);
 
260
ALTER TABLE t1 MODIFY vc TEXT;
 
261
--- Show the new improved table on the master ---
 
262
SHOW CREATE TABLE t1;
 
263
Table   Create Table
 
264
t1      CREATE TABLE `t1` (
 
265
  `id` mediumint(9) NOT NULL,
 
266
  `b1` bit(8) DEFAULT NULL,
 
267
  `vc` text,
 
268
  `bc` char(255) DEFAULT NULL,
 
269
  `d` decimal(10,4) DEFAULT '0.0000',
 
270
  `f` float DEFAULT '0',
 
271
  `total` bigint(20) unsigned DEFAULT NULL,
 
272
  `y` year(4) DEFAULT NULL,
 
273
  `t` date NOT NULL DEFAULT '0000-00-00',
 
274
  PRIMARY KEY (`t`,`id`)
 
275
) ENGINE=InnoDB DEFAULT CHARSET=latin1
 
276
/*!50100 PARTITION BY RANGE (YEAR(t))
 
277
(PARTITION p0 VALUES LESS THAN (1901) ENGINE = InnoDB,
 
278
 PARTITION p1 VALUES LESS THAN (1946) ENGINE = InnoDB,
 
279
 PARTITION p2 VALUES LESS THAN (1966) ENGINE = InnoDB,
 
280
 PARTITION p3 VALUES LESS THAN (1986) ENGINE = InnoDB,
 
281
 PARTITION p4 VALUES LESS THAN (2005) ENGINE = InnoDB,
 
282
 PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
 
283
--- Make sure that our tables on slave are still same engine ---
 
284
--- and that the alter statements replicated correctly ---
 
285
SHOW CREATE TABLE t1;
 
286
Table   Create Table
 
287
t1      CREATE TABLE `t1` (
 
288
  `id` mediumint(9) NOT NULL,
 
289
  `b1` bit(8) DEFAULT NULL,
 
290
  `vc` text,
 
291
  `bc` char(255) DEFAULT NULL,
 
292
  `d` decimal(10,4) DEFAULT '0.0000',
 
293
  `f` float DEFAULT '0',
 
294
  `total` bigint(20) unsigned DEFAULT NULL,
 
295
  `y` year(4) DEFAULT NULL,
 
296
  `t` date NOT NULL DEFAULT '0000-00-00',
 
297
  PRIMARY KEY (`t`,`id`)
 
298
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
 
299
/*!50100 PARTITION BY RANGE (YEAR(t))
 
300
(PARTITION p0 VALUES LESS THAN (1901) ENGINE = ndbcluster,
 
301
 PARTITION p1 VALUES LESS THAN (1946) ENGINE = ndbcluster,
 
302
 PARTITION p2 VALUES LESS THAN (1966) ENGINE = ndbcluster,
 
303
 PARTITION p3 VALUES LESS THAN (1986) ENGINE = ndbcluster,
 
304
 PARTITION p4 VALUES LESS THAN (2005) ENGINE = ndbcluster,
 
305
 PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ndbcluster) */
 
306
--- Perform basic operation on master ---
 
307
--- and ensure replicated correctly ---
 
308
"--- Insert into t1 --" as "";
 
309
--- Select from t1 on master --- 
 
310
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
 
311
id      hex(b1) vc      bc      d       f       total   y       t
 
312
2       1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1965-11-14
 
313
4       1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1985-11-14
 
314
42      1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1905-11-14
 
315
142     1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1995-11-14
 
316
412     1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    2005-11-14
 
317
--- Select from t1 on slave ---
 
318
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
 
319
id      hex(b1) vc      bc      d       f       total   y       t
 
320
2       1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1965-11-14
 
321
4       1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1985-11-14
 
322
42      1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1905-11-14
 
323
142     1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1995-11-14
 
324
412     1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    2005-11-14
 
325
--- Update t1 on master --
 
326
UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
 
327
--- Check the update on master --- 
 
328
SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
 
329
id      hex(b1) vc      bc      d       f       total   y       t
 
330
412     0       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    2006-02-22
 
331
--- Check Update on slave ---
 
332
SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
 
333
id      hex(b1) vc      bc      d       f       total   y       t
 
334
412     0       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    2006-02-22
 
335
--- Remove a record from t1 on master ---
 
336
DELETE FROM t1 WHERE id = 42;
 
337
--- Show current count on master for t1 ---
 
338
SELECT COUNT(*) FROM t1;
 
339
COUNT(*)
 
340
4
 
341
--- Show current count on slave for t1 --- 
 
342
SELECT COUNT(*) FROM t1;
 
343
COUNT(*)
 
344
4
 
345
DELETE FROM t1;
 
346
--- End test 2 partition RANGE testing ---
 
347
--- Do Cleanup ---
 
348
DROP TABLE IF EXISTS t1;
 
349
--- Start test 3 partition LIST testing ---
 
350
--- Do setup ---
 
351
CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), 
 
352
bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, 
 
353
f FLOAT DEFAULT 0, total BIGINT UNSIGNED, 
 
354
y YEAR, t DATE)
 
355
PARTITION BY LIST(id) 
 
356
(PARTITION p0 VALUES IN (2, 4), 
 
357
PARTITION p1 VALUES IN (42, 142));
 
358
--- Test 3 Alter to add partition ---
 
359
ALTER TABLE t1 ADD PARTITION (PARTITION p2 VALUES IN (412));
 
360
--- Show table on master ---
 
361
SHOW CREATE TABLE t1;
 
362
Table   Create Table
 
363
t1      CREATE TABLE `t1` (
 
364
  `id` mediumint(9) NOT NULL,
 
365
  `b1` bit(8) DEFAULT NULL,
 
366
  `vc` varchar(255) DEFAULT NULL,
 
367
  `bc` char(255) DEFAULT NULL,
 
368
  `d` decimal(10,4) DEFAULT '0.0000',
 
369
  `f` float DEFAULT '0',
 
370
  `total` bigint(20) unsigned DEFAULT NULL,
 
371
  `y` year(4) DEFAULT NULL,
 
372
  `t` date DEFAULT NULL
 
373
) ENGINE=InnoDB DEFAULT CHARSET=latin1
 
374
/*!50100 PARTITION BY LIST (id)
 
375
(PARTITION p0 VALUES IN (2,4) ENGINE = InnoDB,
 
376
 PARTITION p1 VALUES IN (42,142) ENGINE = InnoDB,
 
377
 PARTITION p2 VALUES IN (412) ENGINE = InnoDB) */
 
378
--- Show table on slave ---
 
379
SHOW CREATE TABLE t1;
 
380
Table   Create Table
 
381
t1      CREATE TABLE `t1` (
 
382
  `id` mediumint(9) NOT NULL,
 
383
  `b1` bit(8) DEFAULT NULL,
 
384
  `vc` varchar(255) DEFAULT NULL,
 
385
  `bc` char(255) DEFAULT NULL,
 
386
  `d` decimal(10,4) DEFAULT '0.0000',
 
387
  `f` float DEFAULT '0',
 
388
  `total` bigint(20) unsigned DEFAULT NULL,
 
389
  `y` year(4) DEFAULT NULL,
 
390
  `t` date DEFAULT NULL
 
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 --- 
 
400
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
 
401
id      hex(b1) vc      bc      d       f       total   y       t
 
402
2       1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1965-11-14
 
403
4       1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1985-11-14
 
404
42      1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1905-11-14
 
405
142     1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1995-11-14
 
406
412     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 ---
 
408
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
 
409
id      hex(b1) vc      bc      d       f       total   y       t
 
410
2       1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1965-11-14
 
411
4       1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1985-11-14
 
412
42      1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1905-11-14
 
413
142     1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1995-11-14
 
414
412     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 --
 
416
UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
 
417
--- Check the update on master --- 
 
418
SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
 
419
id      hex(b1) vc      bc      d       f       total   y       t
 
420
412     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 ---
 
422
SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
 
423
id      hex(b1) vc      bc      d       f       total   y       t
 
424
412     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 ---
 
426
DELETE FROM t1 WHERE id = 42;
 
427
--- Show current count on master for t1 ---
 
428
SELECT COUNT(*) FROM t1;
 
429
COUNT(*)
 
430
4
 
431
--- Show current count on slave for t1 --- 
 
432
SELECT COUNT(*) FROM t1;
 
433
COUNT(*)
 
434
4
 
435
DELETE FROM t1;
 
436
--- Check that simple Alter statements are replicated correctly ---
 
437
ALTER TABLE t1 ADD PRIMARY KEY(id);
 
438
ALTER TABLE t1 MODIFY vc TEXT;
 
439
--- Show the new improved table on the master ---
 
440
SHOW CREATE TABLE t1;
 
441
Table   Create Table
 
442
t1      CREATE TABLE `t1` (
 
443
  `id` mediumint(9) NOT NULL,
 
444
  `b1` bit(8) DEFAULT NULL,
 
445
  `vc` text,
 
446
  `bc` char(255) DEFAULT NULL,
 
447
  `d` decimal(10,4) DEFAULT '0.0000',
 
448
  `f` float DEFAULT '0',
 
449
  `total` bigint(20) unsigned DEFAULT NULL,
 
450
  `y` year(4) DEFAULT NULL,
 
451
  `t` date DEFAULT NULL,
 
452
  PRIMARY KEY (`id`)
 
453
) ENGINE=InnoDB DEFAULT CHARSET=latin1
 
454
/*!50100 PARTITION BY LIST (id)
 
455
(PARTITION p0 VALUES IN (2,4) ENGINE = InnoDB,
 
456
 PARTITION p1 VALUES IN (42,142) ENGINE = InnoDB,
 
457
 PARTITION p2 VALUES IN (412) ENGINE = InnoDB) */
 
458
--- Make sure that our tables on slave are still same engine ---
 
459
--- and that the alter statements replicated correctly ---
 
460
SHOW CREATE TABLE t1;
 
461
Table   Create Table
 
462
t1      CREATE TABLE `t1` (
 
463
  `id` mediumint(9) NOT NULL,
 
464
  `b1` bit(8) DEFAULT NULL,
 
465
  `vc` text,
 
466
  `bc` char(255) DEFAULT NULL,
 
467
  `d` decimal(10,4) DEFAULT '0.0000',
 
468
  `f` float DEFAULT '0',
 
469
  `total` bigint(20) unsigned DEFAULT NULL,
 
470
  `y` year(4) DEFAULT NULL,
 
471
  `t` date DEFAULT NULL,
 
472
  PRIMARY KEY (`id`)
 
473
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
 
474
/*!50100 PARTITION BY LIST (id)
 
475
(PARTITION p0 VALUES IN (2,4) ENGINE = ndbcluster,
 
476
 PARTITION p1 VALUES IN (42,142) ENGINE = ndbcluster,
 
477
 PARTITION p2 VALUES IN (412) ENGINE = ndbcluster) */
 
478
--- Perform basic operation on master ---
 
479
--- and ensure replicated correctly ---
 
480
"--- Insert into t1 --" as "";
 
481
--- Select from t1 on master --- 
 
482
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
 
483
id      hex(b1) vc      bc      d       f       total   y       t
 
484
2       1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1965-11-14
 
485
4       1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1985-11-14
 
486
42      1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1905-11-14
 
487
142     1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1995-11-14
 
488
412     1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    2005-11-14
 
489
--- Select from t1 on slave ---
 
490
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
 
491
id      hex(b1) vc      bc      d       f       total   y       t
 
492
2       1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1965-11-14
 
493
4       1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1985-11-14
 
494
42      1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1905-11-14
 
495
142     1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1995-11-14
 
496
412     1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    2005-11-14
 
497
--- Update t1 on master --
 
498
UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
 
499
--- Check the update on master --- 
 
500
SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
 
501
id      hex(b1) vc      bc      d       f       total   y       t
 
502
412     0       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    2006-02-22
 
503
--- Check Update on slave ---
 
504
SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
 
505
id      hex(b1) vc      bc      d       f       total   y       t
 
506
412     0       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    2006-02-22
 
507
--- Remove a record from t1 on master ---
 
508
DELETE FROM t1 WHERE id = 42;
 
509
--- Show current count on master for t1 ---
 
510
SELECT COUNT(*) FROM t1;
 
511
COUNT(*)
 
512
4
 
513
--- Show current count on slave for t1 --- 
 
514
SELECT COUNT(*) FROM t1;
 
515
COUNT(*)
 
516
4
 
517
DELETE FROM t1;
 
518
--- End test 3 partition LIST testing ---
 
519
--- Do Cleanup --
 
520
DROP TABLE IF EXISTS t1;
 
521
--- Start test 4 partition HASH testing ---
 
522
--- Do setup ---
 
523
CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), 
 
524
bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, 
 
525
f FLOAT DEFAULT 0, total BIGINT UNSIGNED, 
 
526
y YEAR, t DATE)
 
527
PARTITION BY HASH( YEAR(t) ) 
 
528
PARTITIONS 4;
 
529
--- show that tables have been created correctly ---
 
530
SHOW CREATE TABLE t1;
 
531
Table   Create Table
 
532
t1      CREATE TABLE `t1` (
 
533
  `id` mediumint(9) NOT NULL,
 
534
  `b1` bit(8) DEFAULT NULL,
 
535
  `vc` varchar(255) DEFAULT NULL,
 
536
  `bc` char(255) DEFAULT NULL,
 
537
  `d` decimal(10,4) DEFAULT '0.0000',
 
538
  `f` float DEFAULT '0',
 
539
  `total` bigint(20) unsigned DEFAULT NULL,
 
540
  `y` year(4) DEFAULT NULL,
 
541
  `t` date DEFAULT NULL
 
542
) ENGINE=InnoDB DEFAULT CHARSET=latin1
 
543
/*!50100 PARTITION BY HASH ( YEAR(t))
 
544
PARTITIONS 4 */
 
545
SHOW CREATE TABLE t1;
 
546
Table   Create Table
 
547
t1      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 DEFAULT NULL
 
557
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
 
558
/*!50100 PARTITION BY HASH ( YEAR(t))
 
559
PARTITIONS 4 */
 
560
--- Perform basic operation on master ---
 
561
--- and ensure replicated correctly ---
 
562
"--- Insert into t1 --" as "";
 
563
--- Select from t1 on master --- 
 
564
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
 
565
id      hex(b1) vc      bc      d       f       total   y       t
 
566
2       1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1965-11-14
 
567
4       1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1985-11-14
 
568
42      1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1905-11-14
 
569
142     1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1995-11-14
 
570
412     1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    2005-11-14
 
571
--- Select from t1 on slave ---
 
572
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
 
573
id      hex(b1) vc      bc      d       f       total   y       t
 
574
2       1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1965-11-14
 
575
4       1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1985-11-14
 
576
42      1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1905-11-14
 
577
142     1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1995-11-14
 
578
412     1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    2005-11-14
 
579
--- Update t1 on master --
 
580
UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
 
581
--- Check the update on master --- 
 
582
SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
 
583
id      hex(b1) vc      bc      d       f       total   y       t
 
584
412     0       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    2006-02-22
 
585
--- Check Update on slave ---
 
586
SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
 
587
id      hex(b1) vc      bc      d       f       total   y       t
 
588
412     0       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    2006-02-22
 
589
--- Remove a record from t1 on master ---
 
590
DELETE FROM t1 WHERE id = 42;
 
591
--- Show current count on master for t1 ---
 
592
SELECT COUNT(*) FROM t1;
 
593
COUNT(*)
 
594
4
 
595
--- Show current count on slave for t1 --- 
 
596
SELECT COUNT(*) FROM t1;
 
597
COUNT(*)
 
598
4
 
599
DELETE FROM t1;
 
600
--- Check that simple Alter statements are replicated correctly ---
 
601
ALTER TABLE t1 ADD PRIMARY KEY(t,id);
 
602
ALTER TABLE t1 MODIFY vc TEXT;
 
603
--- Show the new improved table on the master ---
 
604
SHOW CREATE TABLE t1;
 
605
Table   Create Table
 
606
t1      CREATE TABLE `t1` (
 
607
  `id` mediumint(9) NOT NULL,
 
608
  `b1` bit(8) DEFAULT NULL,
 
609
  `vc` text,
 
610
  `bc` char(255) DEFAULT NULL,
 
611
  `d` decimal(10,4) DEFAULT '0.0000',
 
612
  `f` float DEFAULT '0',
 
613
  `total` bigint(20) unsigned DEFAULT NULL,
 
614
  `y` year(4) DEFAULT NULL,
 
615
  `t` date NOT NULL DEFAULT '0000-00-00',
 
616
  PRIMARY KEY (`t`,`id`)
 
617
) ENGINE=InnoDB DEFAULT CHARSET=latin1
 
618
/*!50100 PARTITION BY HASH ( YEAR(t))
 
619
PARTITIONS 4 */
 
620
--- Make sure that our tables on slave are still same engine ---
 
621
--- and that the alter statements replicated correctly ---
 
622
SHOW CREATE TABLE t1;
 
623
Table   Create Table
 
624
t1      CREATE TABLE `t1` (
 
625
  `id` mediumint(9) NOT NULL,
 
626
  `b1` bit(8) DEFAULT NULL,
 
627
  `vc` text,
 
628
  `bc` char(255) DEFAULT NULL,
 
629
  `d` decimal(10,4) DEFAULT '0.0000',
 
630
  `f` float DEFAULT '0',
 
631
  `total` bigint(20) unsigned DEFAULT NULL,
 
632
  `y` year(4) DEFAULT NULL,
 
633
  `t` date NOT NULL DEFAULT '0000-00-00',
 
634
  PRIMARY KEY (`t`,`id`)
 
635
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
 
636
/*!50100 PARTITION BY HASH ( YEAR(t))
 
637
PARTITIONS 4 */
 
638
--- Perform basic operation on master ---
 
639
--- and ensure replicated correctly ---
 
640
"--- Insert into t1 --" as "";
 
641
--- Select from t1 on master --- 
 
642
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
 
643
id      hex(b1) vc      bc      d       f       total   y       t
 
644
2       1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1965-11-14
 
645
4       1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1985-11-14
 
646
42      1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1905-11-14
 
647
142     1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1995-11-14
 
648
412     1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    2005-11-14
 
649
--- Select from t1 on slave ---
 
650
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
 
651
id      hex(b1) vc      bc      d       f       total   y       t
 
652
2       1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1965-11-14
 
653
4       1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1985-11-14
 
654
42      1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1905-11-14
 
655
142     1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1995-11-14
 
656
412     1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    2005-11-14
 
657
--- Update t1 on master --
 
658
UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
 
659
--- Check the update on master --- 
 
660
SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
 
661
id      hex(b1) vc      bc      d       f       total   y       t
 
662
412     0       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    2006-02-22
 
663
--- Check Update on slave ---
 
664
SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
 
665
id      hex(b1) vc      bc      d       f       total   y       t
 
666
412     0       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    2006-02-22
 
667
--- Remove a record from t1 on master ---
 
668
DELETE FROM t1 WHERE id = 42;
 
669
--- Show current count on master for t1 ---
 
670
SELECT COUNT(*) FROM t1;
 
671
COUNT(*)
 
672
4
 
673
--- Show current count on slave for t1 --- 
 
674
SELECT COUNT(*) FROM t1;
 
675
COUNT(*)
 
676
4
 
677
DELETE FROM t1;
 
678
--- End test 4 partition HASH testing ---
 
679
--- Do Cleanup --
 
680
DROP TABLE IF EXISTS t1;
 
681
--- Start test 5 partition by key testing ---
 
682
--- Create Table Section ---
 
683
CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), 
 
684
bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, 
 
685
f FLOAT DEFAULT 0, total BIGINT UNSIGNED, 
 
686
y YEAR, t DATE,PRIMARY KEY(id))
 
687
PARTITION BY KEY() 
 
688
PARTITIONS 4;
 
689
--- Show that tables on master are ndbcluster tables ---
 
690
SHOW CREATE TABLE t1;
 
691
Table   Create Table
 
692
t1      CREATE TABLE `t1` (
 
693
  `id` mediumint(9) NOT NULL,
 
694
  `b1` bit(8) DEFAULT NULL,
 
695
  `vc` varchar(255) DEFAULT NULL,
 
696
  `bc` char(255) DEFAULT NULL,
 
697
  `d` decimal(10,4) DEFAULT '0.0000',
 
698
  `f` float DEFAULT '0',
 
699
  `total` bigint(20) unsigned DEFAULT NULL,
 
700
  `y` year(4) DEFAULT NULL,
 
701
  `t` date DEFAULT NULL,
 
702
  PRIMARY KEY (`id`)
 
703
) ENGINE=InnoDB DEFAULT CHARSET=latin1
 
704
/*!50100 PARTITION BY KEY ()
 
705
PARTITIONS 4 */
 
706
--- Show that tables on slave ---
 
707
SHOW CREATE TABLE t1;
 
708
Table   Create Table
 
709
t1      CREATE TABLE `t1` (
 
710
  `id` mediumint(9) NOT NULL,
 
711
  `b1` bit(8) DEFAULT NULL,
 
712
  `vc` varchar(255) DEFAULT NULL,
 
713
  `bc` char(255) DEFAULT NULL,
 
714
  `d` decimal(10,4) DEFAULT '0.0000',
 
715
  `f` float DEFAULT '0',
 
716
  `total` bigint(20) unsigned DEFAULT NULL,
 
717
  `y` year(4) DEFAULT NULL,
 
718
  `t` date DEFAULT NULL,
 
719
  PRIMARY KEY (`id`)
 
720
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
 
721
/*!50100 PARTITION BY KEY ()
 
722
PARTITIONS 4 */
 
723
--- Perform basic operation on master ---
 
724
--- and ensure replicated correctly ---
 
725
"--- Insert into t1 --" as "";
 
726
--- Select from t1 on master --- 
 
727
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
 
728
id      hex(b1) vc      bc      d       f       total   y       t
 
729
2       1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1965-11-14
 
730
4       1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1985-11-14
 
731
42      1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1905-11-14
 
732
142     1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1995-11-14
 
733
412     1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    2005-11-14
 
734
--- Select from t1 on slave ---
 
735
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
 
736
id      hex(b1) vc      bc      d       f       total   y       t
 
737
2       1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1965-11-14
 
738
4       1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1985-11-14
 
739
42      1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1905-11-14
 
740
142     1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1995-11-14
 
741
412     1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    2005-11-14
 
742
--- Update t1 on master --
 
743
UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
 
744
--- Check the update on master --- 
 
745
SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
 
746
id      hex(b1) vc      bc      d       f       total   y       t
 
747
412     0       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    2006-02-22
 
748
--- Check Update on slave ---
 
749
SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
 
750
id      hex(b1) vc      bc      d       f       total   y       t
 
751
412     0       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    2006-02-22
 
752
--- Remove a record from t1 on master ---
 
753
DELETE FROM t1 WHERE id = 42;
 
754
--- Show current count on master for t1 ---
 
755
SELECT COUNT(*) FROM t1;
 
756
COUNT(*)
 
757
4
 
758
--- Show current count on slave for t1 --- 
 
759
SELECT COUNT(*) FROM t1;
 
760
COUNT(*)
 
761
4
 
762
DELETE FROM t1;
 
763
--- Check that simple Alter statements are replicated correctly ---
 
764
ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(id, total);
 
765
--- Show the new improved table on the master ---
 
766
SHOW CREATE TABLE t1;
 
767
Table   Create Table
 
768
t1      CREATE TABLE `t1` (
 
769
  `id` mediumint(9) NOT NULL,
 
770
  `b1` bit(8) DEFAULT NULL,
 
771
  `vc` varchar(255) DEFAULT NULL,
 
772
  `bc` char(255) DEFAULT NULL,
 
773
  `d` decimal(10,4) DEFAULT '0.0000',
 
774
  `f` float DEFAULT '0',
 
775
  `total` bigint(20) unsigned NOT NULL DEFAULT '0',
 
776
  `y` year(4) DEFAULT NULL,
 
777
  `t` date DEFAULT NULL,
 
778
  PRIMARY KEY (`id`,`total`)
 
779
) ENGINE=InnoDB DEFAULT CHARSET=latin1
 
780
/*!50100 PARTITION BY KEY ()
 
781
PARTITIONS 4 */
 
782
--- Make sure that our tables on slave are still right type ---
 
783
--- and that the alter statements replicated correctly ---
 
784
SHOW CREATE TABLE t1;
 
785
Table   Create Table
 
786
t1      CREATE TABLE `t1` (
 
787
  `id` mediumint(9) NOT NULL,
 
788
  `b1` bit(8) DEFAULT NULL,
 
789
  `vc` varchar(255) DEFAULT NULL,
 
790
  `bc` char(255) DEFAULT NULL,
 
791
  `d` decimal(10,4) DEFAULT '0.0000',
 
792
  `f` float DEFAULT '0',
 
793
  `total` bigint(20) unsigned NOT NULL DEFAULT '0',
 
794
  `y` year(4) DEFAULT NULL,
 
795
  `t` date DEFAULT NULL,
 
796
  PRIMARY KEY (`id`,`total`)
 
797
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
 
798
/*!50100 PARTITION BY KEY ()
 
799
PARTITIONS 4 */
 
800
--- Perform basic operation on master ---
 
801
--- and ensure replicated correctly ---
 
802
"--- Insert into t1 --" as "";
 
803
--- Select from t1 on master --- 
 
804
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
 
805
id      hex(b1) vc      bc      d       f       total   y       t
 
806
2       1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1965-11-14
 
807
4       1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1985-11-14
 
808
42      1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1905-11-14
 
809
142     1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1995-11-14
 
810
412     1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    2005-11-14
 
811
--- Select from t1 on slave ---
 
812
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
 
813
id      hex(b1) vc      bc      d       f       total   y       t
 
814
2       1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1965-11-14
 
815
4       1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1985-11-14
 
816
42      1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1905-11-14
 
817
142     1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1995-11-14
 
818
412     1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    2005-11-14
 
819
--- Update t1 on master --
 
820
UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
 
821
--- Check the update on master --- 
 
822
SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
 
823
id      hex(b1) vc      bc      d       f       total   y       t
 
824
412     0       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    2006-02-22
 
825
--- Check Update on slave ---
 
826
SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
 
827
id      hex(b1) vc      bc      d       f       total   y       t
 
828
412     0       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    2006-02-22
 
829
--- Remove a record from t1 on master ---
 
830
DELETE FROM t1 WHERE id = 42;
 
831
--- Show current count on master for t1 ---
 
832
SELECT COUNT(*) FROM t1;
 
833
COUNT(*)
 
834
4
 
835
--- Show current count on slave for t1 --- 
 
836
SELECT COUNT(*) FROM t1;
 
837
COUNT(*)
 
838
4
 
839
DELETE FROM t1;
 
840
--- Check that simple Alter statements are replicated correctly ---
 
841
ALTER TABLE t1 MODIFY vc TEXT;
 
842
--- Show the new improved table on the master ---
 
843
SHOW CREATE TABLE t1;
 
844
Table   Create Table
 
845
t1      CREATE TABLE `t1` (
 
846
  `id` mediumint(9) NOT NULL,
 
847
  `b1` bit(8) DEFAULT NULL,
 
848
  `vc` text,
 
849
  `bc` char(255) DEFAULT NULL,
 
850
  `d` decimal(10,4) DEFAULT '0.0000',
 
851
  `f` float DEFAULT '0',
 
852
  `total` bigint(20) unsigned NOT NULL DEFAULT '0',
 
853
  `y` year(4) DEFAULT NULL,
 
854
  `t` date DEFAULT NULL,
 
855
  PRIMARY KEY (`id`,`total`)
 
856
) ENGINE=InnoDB DEFAULT CHARSET=latin1
 
857
/*!50100 PARTITION BY KEY ()
 
858
PARTITIONS 4 */
 
859
--- Make sure that our tables on slave are still same engine ---
 
860
--- and that the alter statements replicated correctly ---
 
861
SHOW CREATE TABLE t1;
 
862
Table   Create Table
 
863
t1      CREATE TABLE `t1` (
 
864
  `id` mediumint(9) NOT NULL,
 
865
  `b1` bit(8) DEFAULT NULL,
 
866
  `vc` text,
 
867
  `bc` char(255) DEFAULT NULL,
 
868
  `d` decimal(10,4) DEFAULT '0.0000',
 
869
  `f` float DEFAULT '0',
 
870
  `total` bigint(20) unsigned NOT NULL DEFAULT '0',
 
871
  `y` year(4) DEFAULT NULL,
 
872
  `t` date DEFAULT NULL,
 
873
  PRIMARY KEY (`id`,`total`)
 
874
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
 
875
/*!50100 PARTITION BY KEY ()
 
876
PARTITIONS 4 */
 
877
--- Perform basic operation on master ---
 
878
--- and ensure replicated correctly ---
 
879
"--- Insert into t1 --" as "";
 
880
--- Select from t1 on master --- 
 
881
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
 
882
id      hex(b1) vc      bc      d       f       total   y       t
 
883
2       1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1965-11-14
 
884
4       1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1985-11-14
 
885
42      1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1905-11-14
 
886
142     1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1995-11-14
 
887
412     1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    2005-11-14
 
888
--- Select from t1 on slave ---
 
889
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
 
890
id      hex(b1) vc      bc      d       f       total   y       t
 
891
2       1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1965-11-14
 
892
4       1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1985-11-14
 
893
42      1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1905-11-14
 
894
142     1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    1995-11-14
 
895
412     1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    2005-11-14
 
896
--- Update t1 on master --
 
897
UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
 
898
--- Check the update on master --- 
 
899
SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
 
900
id      hex(b1) vc      bc      d       f       total   y       t
 
901
412     0       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    2006-02-22
 
902
--- Check Update on slave ---
 
903
SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
 
904
id      hex(b1) vc      bc      d       f       total   y       t
 
905
412     0       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    2006-02-22
 
906
--- Remove a record from t1 on master ---
 
907
DELETE FROM t1 WHERE id = 42;
 
908
--- Show current count on master for t1 ---
 
909
SELECT COUNT(*) FROM t1;
 
910
COUNT(*)
 
911
4
 
912
--- Show current count on slave for t1 --- 
 
913
SELECT COUNT(*) FROM t1;
 
914
COUNT(*)
 
915
4
 
916
DELETE FROM t1;
 
917
--- End test 5 key partition testing ---
 
918
--- Do Cleanup ---
 
919
DROP TABLE IF EXISTS t1;