~vkolesnikov/pbxt/pbxt-07-diskfull

« back to all changes in this revision

Viewing changes to pbxt/mysql-test-update/mysql-test/r/rpl_ndb_2myisam.result

  • Committer: paul-mccullagh
  • Date: 2006-10-23 09:14:04 UTC
  • Revision ID: paul-mccullagh-918861e03d351978a9541168a96e58cc826734ee
Initial import

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=ndb;
 
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=ndbcluster 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=PBXT 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=ndbcluster 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=PBXT 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=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = ndbcluster, PARTITION p1 VALUES LESS THAN (1946) ENGINE = ndbcluster, PARTITION p2 VALUES LESS THAN (1966) ENGINE = ndbcluster, PARTITION p3 VALUES LESS THAN (1986) ENGINE = ndbcluster, PARTITION p4 VALUES LESS THAN (2005) ENGINE = ndbcluster, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ndbcluster)
 
190
--- Show table on slave --
 
191
SHOW CREATE TABLE t1;
 
192
Table   Create Table
 
193
t1      CREATE TABLE `t1` (
 
194
  `id` mediumint(9) NOT NULL,
 
195
  `b1` bit(8) DEFAULT NULL,
 
196
  `vc` varchar(255) DEFAULT NULL,
 
197
  `bc` char(255) DEFAULT NULL,
 
198
  `d` decimal(10,4) DEFAULT '0.0000',
 
199
  `f` float DEFAULT '0',
 
200
  `total` bigint(20) unsigned DEFAULT NULL,
 
201
  `y` year(4) DEFAULT NULL,
 
202
  `t` date DEFAULT NULL
 
203
) ENGINE=PBXT DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (1946) ENGINE = MyISAM, PARTITION p2 VALUES LESS THAN (1966) ENGINE = MyISAM, PARTITION p3 VALUES LESS THAN (1986) ENGINE = MyISAM, PARTITION p4 VALUES LESS THAN (2005) ENGINE = MyISAM, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
 
204
--- Perform basic operation on master ---
 
205
--- and ensure replicated correctly ---
 
206
"--- Insert into t1 --" as "";
 
207
--- Select from t1 on master --- 
 
208
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
 
209
id      hex(b1) vc      bc      d       f       total   y       t
 
210
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
 
211
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
 
212
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
 
213
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
 
214
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
 
215
--- Select from t1 on slave ---
 
216
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
 
217
id      hex(b1) vc      bc      d       f       total   y       t
 
218
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
 
219
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
 
220
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
 
221
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
 
222
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
 
223
--- Update t1 on master --
 
224
UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
 
225
--- Check the update on master --- 
 
226
SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
 
227
id      hex(b1) vc      bc      d       f       total   y       t
 
228
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
 
229
--- Check Update on slave ---
 
230
SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
 
231
id      hex(b1) vc      bc      d       f       total   y       t
 
232
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
 
233
--- Remove a record from t1 on master ---
 
234
DELETE FROM t1 WHERE id = 42;
 
235
--- Show current count on master for t1 ---
 
236
SELECT COUNT(*) FROM t1;
 
237
COUNT(*)
 
238
4
 
239
--- Show current count on slave for t1 --- 
 
240
SELECT COUNT(*) FROM t1;
 
241
COUNT(*)
 
242
4
 
243
DELETE FROM t1;
 
244
--- Check that simple Alter statements are replicated correctly ---
 
245
ALTER TABLE t1 ADD PRIMARY KEY(t,id);
 
246
ALTER TABLE t1 MODIFY vc TEXT;
 
247
--- Show the new improved table on the master ---
 
248
SHOW CREATE TABLE t1;
 
249
Table   Create Table
 
250
t1      CREATE TABLE `t1` (
 
251
  `id` mediumint(9) NOT NULL,
 
252
  `b1` bit(8) DEFAULT NULL,
 
253
  `vc` text,
 
254
  `bc` char(255) DEFAULT NULL,
 
255
  `d` decimal(10,4) DEFAULT '0.0000',
 
256
  `f` float DEFAULT '0',
 
257
  `total` bigint(20) unsigned DEFAULT NULL,
 
258
  `y` year(4) DEFAULT NULL,
 
259
  `t` date NOT NULL DEFAULT '0000-00-00',
 
260
  PRIMARY KEY (`t`,`id`)
 
261
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = ndbcluster, PARTITION p1 VALUES LESS THAN (1946) ENGINE = ndbcluster, PARTITION p2 VALUES LESS THAN (1966) ENGINE = ndbcluster, PARTITION p3 VALUES LESS THAN (1986) ENGINE = ndbcluster, PARTITION p4 VALUES LESS THAN (2005) ENGINE = ndbcluster, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ndbcluster)
 
262
--- Make sure that our tables on slave are still same engine ---
 
263
--- and that the alter statements replicated correctly ---
 
264
SHOW CREATE TABLE t1;
 
265
Table   Create Table
 
266
t1      CREATE TABLE `t1` (
 
267
  `id` mediumint(9) NOT NULL,
 
268
  `b1` bit(8) DEFAULT NULL,
 
269
  `vc` text,
 
270
  `bc` char(255) DEFAULT NULL,
 
271
  `d` decimal(10,4) DEFAULT '0.0000',
 
272
  `f` float DEFAULT '0',
 
273
  `total` bigint(20) unsigned DEFAULT NULL,
 
274
  `y` year(4) DEFAULT NULL,
 
275
  `t` date NOT NULL DEFAULT '0000-00-00',
 
276
  PRIMARY KEY (`t`,`id`)
 
277
) ENGINE=PBXT DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (1946) ENGINE = MyISAM, PARTITION p2 VALUES LESS THAN (1966) ENGINE = MyISAM, PARTITION p3 VALUES LESS THAN (1986) ENGINE = MyISAM, PARTITION p4 VALUES LESS THAN (2005) ENGINE = MyISAM, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
 
278
--- Perform basic operation on master ---
 
279
--- and ensure replicated correctly ---
 
280
"--- Insert into t1 --" as "";
 
281
--- Select from t1 on master --- 
 
282
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
 
283
id      hex(b1) vc      bc      d       f       total   y       t
 
284
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
 
285
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
 
286
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
 
287
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
 
288
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
 
289
--- Select from t1 on slave ---
 
290
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
 
291
id      hex(b1) vc      bc      d       f       total   y       t
 
292
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
 
293
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
 
294
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
 
295
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
 
296
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
 
297
--- Update t1 on master --
 
298
UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
 
299
--- Check the update on master --- 
 
300
SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
 
301
id      hex(b1) vc      bc      d       f       total   y       t
 
302
412     1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    2006-02-22
 
303
--- Check Update on slave ---
 
304
SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
 
305
id      hex(b1) vc      bc      d       f       total   y       t
 
306
412     1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    2006-02-22
 
307
--- Remove a record from t1 on master ---
 
308
DELETE FROM t1 WHERE id = 42;
 
309
--- Show current count on master for t1 ---
 
310
SELECT COUNT(*) FROM t1;
 
311
COUNT(*)
 
312
4
 
313
--- Show current count on slave for t1 --- 
 
314
SELECT COUNT(*) FROM t1;
 
315
COUNT(*)
 
316
4
 
317
DELETE FROM t1;
 
318
--- End test 2 partition RANGE testing ---
 
319
--- Do Cleanup ---
 
320
DROP TABLE IF EXISTS t1;
 
321
--- Start test 3 partition LIST testing ---
 
322
--- Do setup ---
 
323
CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), 
 
324
bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, 
 
325
f FLOAT DEFAULT 0, total BIGINT UNSIGNED, 
 
326
y YEAR, t DATE)
 
327
PARTITION BY LIST(id) 
 
328
(PARTITION p0 VALUES IN (2, 4), 
 
329
PARTITION p1 VALUES IN (42, 142));
 
330
--- Test 3 Alter to add partition ---
 
331
ALTER TABLE t1 ADD PARTITION (PARTITION p2 VALUES IN (412));
 
332
--- Show table on master ---
 
333
SHOW CREATE TABLE t1;
 
334
Table   Create Table
 
335
t1      CREATE TABLE `t1` (
 
336
  `id` mediumint(9) NOT NULL,
 
337
  `b1` bit(8) DEFAULT NULL,
 
338
  `vc` varchar(255) DEFAULT NULL,
 
339
  `bc` char(255) DEFAULT NULL,
 
340
  `d` decimal(10,4) DEFAULT '0.0000',
 
341
  `f` float DEFAULT '0',
 
342
  `total` bigint(20) unsigned DEFAULT NULL,
 
343
  `y` year(4) DEFAULT NULL,
 
344
  `t` date DEFAULT NULL
 
345
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = ndbcluster, PARTITION p1 VALUES IN (42,142) ENGINE = ndbcluster, PARTITION p2 VALUES IN (412) ENGINE = ndbcluster)
 
346
--- Show table on slave ---
 
347
SHOW CREATE TABLE t1;
 
348
Table   Create Table
 
349
t1      CREATE TABLE `t1` (
 
350
  `id` mediumint(9) NOT NULL,
 
351
  `b1` bit(8) DEFAULT NULL,
 
352
  `vc` varchar(255) DEFAULT NULL,
 
353
  `bc` char(255) DEFAULT NULL,
 
354
  `d` decimal(10,4) DEFAULT '0.0000',
 
355
  `f` float DEFAULT '0',
 
356
  `total` bigint(20) unsigned DEFAULT NULL,
 
357
  `y` year(4) DEFAULT NULL,
 
358
  `t` date DEFAULT NULL
 
359
) ENGINE=PBXT DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = MyISAM, PARTITION p1 VALUES IN (42,142) ENGINE = MyISAM, PARTITION p2 VALUES IN (412) ENGINE = MyISAM)
 
360
--- Perform basic operation on master ---
 
361
--- and ensure replicated correctly ---
 
362
"--- Insert into t1 --" as "";
 
363
--- Select from t1 on master --- 
 
364
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
 
365
id      hex(b1) vc      bc      d       f       total   y       t
 
366
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
 
367
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
 
368
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
 
369
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
 
370
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
 
371
--- Select from t1 on slave ---
 
372
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
 
373
id      hex(b1) vc      bc      d       f       total   y       t
 
374
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
 
375
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
 
376
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
 
377
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
 
378
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
 
379
--- Update t1 on master --
 
380
UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
 
381
--- Check the update on master --- 
 
382
SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
 
383
id      hex(b1) vc      bc      d       f       total   y       t
 
384
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
 
385
--- Check Update on slave ---
 
386
SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
 
387
id      hex(b1) vc      bc      d       f       total   y       t
 
388
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
 
389
--- Remove a record from t1 on master ---
 
390
DELETE FROM t1 WHERE id = 42;
 
391
--- Show current count on master for t1 ---
 
392
SELECT COUNT(*) FROM t1;
 
393
COUNT(*)
 
394
4
 
395
--- Show current count on slave for t1 --- 
 
396
SELECT COUNT(*) FROM t1;
 
397
COUNT(*)
 
398
4
 
399
DELETE FROM t1;
 
400
--- Check that simple Alter statements are replicated correctly ---
 
401
ALTER TABLE t1 ADD PRIMARY KEY(id);
 
402
ALTER TABLE t1 MODIFY vc TEXT;
 
403
--- Show the new improved table on the master ---
 
404
SHOW CREATE TABLE t1;
 
405
Table   Create Table
 
406
t1      CREATE TABLE `t1` (
 
407
  `id` mediumint(9) NOT NULL,
 
408
  `b1` bit(8) DEFAULT NULL,
 
409
  `vc` text,
 
410
  `bc` char(255) DEFAULT NULL,
 
411
  `d` decimal(10,4) DEFAULT '0.0000',
 
412
  `f` float DEFAULT '0',
 
413
  `total` bigint(20) unsigned DEFAULT NULL,
 
414
  `y` year(4) DEFAULT NULL,
 
415
  `t` date DEFAULT NULL,
 
416
  PRIMARY KEY (`id`)
 
417
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = ndbcluster, PARTITION p1 VALUES IN (42,142) ENGINE = ndbcluster, PARTITION p2 VALUES IN (412) ENGINE = ndbcluster)
 
418
--- Make sure that our tables on slave are still same engine ---
 
419
--- and that the alter statements replicated correctly ---
 
420
SHOW CREATE TABLE t1;
 
421
Table   Create Table
 
422
t1      CREATE TABLE `t1` (
 
423
  `id` mediumint(9) NOT NULL,
 
424
  `b1` bit(8) DEFAULT NULL,
 
425
  `vc` text,
 
426
  `bc` char(255) DEFAULT NULL,
 
427
  `d` decimal(10,4) DEFAULT '0.0000',
 
428
  `f` float DEFAULT '0',
 
429
  `total` bigint(20) unsigned DEFAULT NULL,
 
430
  `y` year(4) DEFAULT NULL,
 
431
  `t` date DEFAULT NULL,
 
432
  PRIMARY KEY (`id`)
 
433
) ENGINE=PBXT DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = MyISAM, PARTITION p1 VALUES IN (42,142) ENGINE = MyISAM, PARTITION p2 VALUES IN (412) ENGINE = MyISAM)
 
434
--- Perform basic operation on master ---
 
435
--- and ensure replicated correctly ---
 
436
"--- Insert into t1 --" as "";
 
437
--- Select from t1 on master --- 
 
438
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
 
439
id      hex(b1) vc      bc      d       f       total   y       t
 
440
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
 
441
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
 
442
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
 
443
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
 
444
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
 
445
--- Select from t1 on slave ---
 
446
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
 
447
id      hex(b1) vc      bc      d       f       total   y       t
 
448
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
 
449
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
 
450
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
 
451
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
 
452
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
 
453
--- Update t1 on master --
 
454
UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
 
455
--- Check the update on master --- 
 
456
SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
 
457
id      hex(b1) vc      bc      d       f       total   y       t
 
458
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
 
459
--- Check Update on slave ---
 
460
SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
 
461
id      hex(b1) vc      bc      d       f       total   y       t
 
462
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
 
463
--- Remove a record from t1 on master ---
 
464
DELETE FROM t1 WHERE id = 42;
 
465
--- Show current count on master for t1 ---
 
466
SELECT COUNT(*) FROM t1;
 
467
COUNT(*)
 
468
4
 
469
--- Show current count on slave for t1 --- 
 
470
SELECT COUNT(*) FROM t1;
 
471
COUNT(*)
 
472
4
 
473
DELETE FROM t1;
 
474
--- End test 3 partition LIST testing ---
 
475
--- Do Cleanup --
 
476
DROP TABLE IF EXISTS t1;
 
477
--- Start test 4 partition HASH testing ---
 
478
--- Do setup ---
 
479
CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), 
 
480
bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, 
 
481
f FLOAT DEFAULT 0, total BIGINT UNSIGNED, 
 
482
y YEAR, t DATE)
 
483
PARTITION BY HASH( YEAR(t) ) 
 
484
PARTITIONS 4;
 
485
--- show that tables have been created correctly ---
 
486
SHOW CREATE TABLE t1;
 
487
Table   Create Table
 
488
t1      CREATE TABLE `t1` (
 
489
  `id` mediumint(9) NOT NULL,
 
490
  `b1` bit(8) DEFAULT NULL,
 
491
  `vc` varchar(255) DEFAULT NULL,
 
492
  `bc` char(255) DEFAULT NULL,
 
493
  `d` decimal(10,4) DEFAULT '0.0000',
 
494
  `f` float DEFAULT '0',
 
495
  `total` bigint(20) unsigned DEFAULT NULL,
 
496
  `y` year(4) DEFAULT NULL,
 
497
  `t` date DEFAULT NULL
 
498
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 
 
499
SHOW CREATE TABLE t1;
 
500
Table   Create Table
 
501
t1      CREATE TABLE `t1` (
 
502
  `id` mediumint(9) NOT NULL,
 
503
  `b1` bit(8) DEFAULT NULL,
 
504
  `vc` varchar(255) DEFAULT NULL,
 
505
  `bc` char(255) DEFAULT NULL,
 
506
  `d` decimal(10,4) DEFAULT '0.0000',
 
507
  `f` float DEFAULT '0',
 
508
  `total` bigint(20) unsigned DEFAULT NULL,
 
509
  `y` year(4) DEFAULT NULL,
 
510
  `t` date DEFAULT NULL
 
511
) ENGINE=PBXT DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 
 
512
--- Perform basic operation on master ---
 
513
--- and ensure replicated correctly ---
 
514
"--- Insert into t1 --" as "";
 
515
--- Select from t1 on master --- 
 
516
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
 
517
id      hex(b1) vc      bc      d       f       total   y       t
 
518
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
 
519
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
 
520
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
 
521
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
 
522
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
 
523
--- Select from t1 on slave ---
 
524
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
 
525
id      hex(b1) vc      bc      d       f       total   y       t
 
526
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
 
527
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
 
528
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
 
529
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
 
530
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
 
531
--- Update t1 on master --
 
532
UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
 
533
--- Check the update on master --- 
 
534
SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
 
535
id      hex(b1) vc      bc      d       f       total   y       t
 
536
412     1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    2006-02-22
 
537
--- Check Update on slave ---
 
538
SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
 
539
id      hex(b1) vc      bc      d       f       total   y       t
 
540
412     1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    2006-02-22
 
541
--- Remove a record from t1 on master ---
 
542
DELETE FROM t1 WHERE id = 42;
 
543
--- Show current count on master for t1 ---
 
544
SELECT COUNT(*) FROM t1;
 
545
COUNT(*)
 
546
4
 
547
--- Show current count on slave for t1 --- 
 
548
SELECT COUNT(*) FROM t1;
 
549
COUNT(*)
 
550
4
 
551
DELETE FROM t1;
 
552
--- Check that simple Alter statements are replicated correctly ---
 
553
ALTER TABLE t1 ADD PRIMARY KEY(t,id);
 
554
ALTER TABLE t1 MODIFY vc TEXT;
 
555
--- Show the new improved table on the master ---
 
556
SHOW CREATE TABLE t1;
 
557
Table   Create Table
 
558
t1      CREATE TABLE `t1` (
 
559
  `id` mediumint(9) NOT NULL,
 
560
  `b1` bit(8) DEFAULT NULL,
 
561
  `vc` text,
 
562
  `bc` char(255) DEFAULT NULL,
 
563
  `d` decimal(10,4) DEFAULT '0.0000',
 
564
  `f` float DEFAULT '0',
 
565
  `total` bigint(20) unsigned DEFAULT NULL,
 
566
  `y` year(4) DEFAULT NULL,
 
567
  `t` date NOT NULL DEFAULT '0000-00-00',
 
568
  PRIMARY KEY (`t`,`id`)
 
569
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 
 
570
--- Make sure that our tables on slave are still same engine ---
 
571
--- and that the alter statements replicated correctly ---
 
572
SHOW CREATE TABLE t1;
 
573
Table   Create Table
 
574
t1      CREATE TABLE `t1` (
 
575
  `id` mediumint(9) NOT NULL,
 
576
  `b1` bit(8) DEFAULT NULL,
 
577
  `vc` text,
 
578
  `bc` char(255) DEFAULT NULL,
 
579
  `d` decimal(10,4) DEFAULT '0.0000',
 
580
  `f` float DEFAULT '0',
 
581
  `total` bigint(20) unsigned DEFAULT NULL,
 
582
  `y` year(4) DEFAULT NULL,
 
583
  `t` date NOT NULL DEFAULT '0000-00-00',
 
584
  PRIMARY KEY (`t`,`id`)
 
585
) ENGINE=PBXT DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 
 
586
--- Perform basic operation on master ---
 
587
--- and ensure replicated correctly ---
 
588
"--- Insert into t1 --" as "";
 
589
--- Select from t1 on master --- 
 
590
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
 
591
id      hex(b1) vc      bc      d       f       total   y       t
 
592
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
 
593
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
 
594
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
 
595
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
 
596
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
 
597
--- Select from t1 on slave ---
 
598
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
 
599
id      hex(b1) vc      bc      d       f       total   y       t
 
600
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
 
601
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
 
602
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
 
603
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
 
604
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
 
605
--- Update t1 on master --
 
606
UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
 
607
--- Check the update on master --- 
 
608
SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
 
609
id      hex(b1) vc      bc      d       f       total   y       t
 
610
412     1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    2006-02-22
 
611
--- Check Update on slave ---
 
612
SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
 
613
id      hex(b1) vc      bc      d       f       total   y       t
 
614
412     1       Testing MySQL databases is a cool       Must make it bug free for the customer  654321.4321     15.21   0       1965    2006-02-22
 
615
--- Remove a record from t1 on master ---
 
616
DELETE FROM t1 WHERE id = 42;
 
617
--- Show current count on master for t1 ---
 
618
SELECT COUNT(*) FROM t1;
 
619
COUNT(*)
 
620
4
 
621
--- Show current count on slave for t1 --- 
 
622
SELECT COUNT(*) FROM t1;
 
623
COUNT(*)
 
624
4
 
625
DELETE FROM t1;
 
626
--- End test 4 partition HASH testing ---
 
627
--- Do Cleanup --
 
628
DROP TABLE IF EXISTS t1;
 
629
--- Start test 5 partition by key testing ---
 
630
--- Create Table Section ---
 
631
CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), 
 
632
bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, 
 
633
f FLOAT DEFAULT 0, total BIGINT UNSIGNED, 
 
634
y YEAR, t DATE,PRIMARY KEY(id))
 
635
PARTITION BY KEY() 
 
636
PARTITIONS 4;
 
637
--- Show that tables on master are ndbcluster tables ---
 
638
SHOW CREATE TABLE t1;
 
639
Table   Create Table
 
640
t1      CREATE TABLE `t1` (
 
641
  `id` mediumint(9) NOT NULL,
 
642
  `b1` bit(8) DEFAULT NULL,
 
643
  `vc` varchar(255) DEFAULT NULL,
 
644
  `bc` char(255) DEFAULT NULL,
 
645
  `d` decimal(10,4) DEFAULT '0.0000',
 
646
  `f` float DEFAULT '0',
 
647
  `total` bigint(20) unsigned DEFAULT NULL,
 
648
  `y` year(4) DEFAULT NULL,
 
649
  `t` date DEFAULT NULL,
 
650
  PRIMARY KEY (`id`)
 
651
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 
 
652
--- Show that tables on slave ---
 
653
SHOW CREATE TABLE t1;
 
654
Table   Create Table
 
655
t1      CREATE TABLE `t1` (
 
656
  `id` mediumint(9) NOT NULL,
 
657
  `b1` bit(8) DEFAULT NULL,
 
658
  `vc` varchar(255) DEFAULT NULL,
 
659
  `bc` char(255) DEFAULT NULL,
 
660
  `d` decimal(10,4) DEFAULT '0.0000',
 
661
  `f` float DEFAULT '0',
 
662
  `total` bigint(20) unsigned DEFAULT NULL,
 
663
  `y` year(4) DEFAULT NULL,
 
664
  `t` date DEFAULT NULL,
 
665
  PRIMARY KEY (`id`)
 
666
) ENGINE=PBXT DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 
 
667
--- Perform basic operation on master ---
 
668
--- and ensure replicated correctly ---
 
669
"--- Insert into t1 --" as "";
 
670
--- Select from t1 on master --- 
 
671
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
 
672
id      hex(b1) vc      bc      d       f       total   y       t
 
673
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
 
674
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
 
675
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
 
676
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
 
677
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
 
678
--- Select from t1 on slave ---
 
679
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
 
680
id      hex(b1) vc      bc      d       f       total   y       t
 
681
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
 
682
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
 
683
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
 
684
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
 
685
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
 
686
--- Update t1 on master --
 
687
UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
 
688
--- Check the update on master --- 
 
689
SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
 
690
id      hex(b1) vc      bc      d       f       total   y       t
 
691
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
 
692
--- Check Update on slave ---
 
693
SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
 
694
id      hex(b1) vc      bc      d       f       total   y       t
 
695
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
 
696
--- Remove a record from t1 on master ---
 
697
DELETE FROM t1 WHERE id = 42;
 
698
--- Show current count on master for t1 ---
 
699
SELECT COUNT(*) FROM t1;
 
700
COUNT(*)
 
701
4
 
702
--- Show current count on slave for t1 --- 
 
703
SELECT COUNT(*) FROM t1;
 
704
COUNT(*)
 
705
4
 
706
DELETE FROM t1;
 
707
--- Check that simple Alter statements are replicated correctly ---
 
708
ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(id, total);
 
709
--- Show the new improved table on the master ---
 
710
SHOW CREATE TABLE t1;
 
711
Table   Create Table
 
712
t1      CREATE TABLE `t1` (
 
713
  `id` mediumint(9) NOT NULL,
 
714
  `b1` bit(8) DEFAULT NULL,
 
715
  `vc` varchar(255) DEFAULT NULL,
 
716
  `bc` char(255) DEFAULT NULL,
 
717
  `d` decimal(10,4) DEFAULT '0.0000',
 
718
  `f` float DEFAULT '0',
 
719
  `total` bigint(20) unsigned NOT NULL DEFAULT '0',
 
720
  `y` year(4) DEFAULT NULL,
 
721
  `t` date DEFAULT NULL,
 
722
  PRIMARY KEY (`id`,`total`)
 
723
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 
 
724
--- Make sure that our tables on slave are still right type ---
 
725
--- and that the alter statements replicated correctly ---
 
726
SHOW CREATE TABLE t1;
 
727
Table   Create Table
 
728
t1      CREATE TABLE `t1` (
 
729
  `id` mediumint(9) NOT NULL,
 
730
  `b1` bit(8) DEFAULT NULL,
 
731
  `vc` varchar(255) DEFAULT NULL,
 
732
  `bc` char(255) DEFAULT NULL,
 
733
  `d` decimal(10,4) DEFAULT '0.0000',
 
734
  `f` float DEFAULT '0',
 
735
  `total` bigint(20) unsigned NOT NULL DEFAULT '0',
 
736
  `y` year(4) DEFAULT NULL,
 
737
  `t` date DEFAULT NULL,
 
738
  PRIMARY KEY (`id`,`total`)
 
739
) ENGINE=PBXT DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 
 
740
--- Perform basic operation on master ---
 
741
--- and ensure replicated correctly ---
 
742
"--- Insert into t1 --" as "";
 
743
--- Select from t1 on master --- 
 
744
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
 
745
id      hex(b1) vc      bc      d       f       total   y       t
 
746
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
 
747
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
 
748
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
 
749
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
 
750
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
 
751
--- Select from t1 on slave ---
 
752
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
 
753
id      hex(b1) vc      bc      d       f       total   y       t
 
754
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
 
755
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
 
756
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
 
757
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
 
758
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
 
759
--- Update t1 on master --
 
760
UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
 
761
--- Check the update on master --- 
 
762
SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
 
763
id      hex(b1) vc      bc      d       f       total   y       t
 
764
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
 
765
--- Check Update on slave ---
 
766
SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
 
767
id      hex(b1) vc      bc      d       f       total   y       t
 
768
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
 
769
--- Remove a record from t1 on master ---
 
770
DELETE FROM t1 WHERE id = 42;
 
771
--- Show current count on master for t1 ---
 
772
SELECT COUNT(*) FROM t1;
 
773
COUNT(*)
 
774
4
 
775
--- Show current count on slave for t1 --- 
 
776
SELECT COUNT(*) FROM t1;
 
777
COUNT(*)
 
778
4
 
779
DELETE FROM t1;
 
780
--- Check that simple Alter statements are replicated correctly ---
 
781
ALTER TABLE t1 MODIFY vc TEXT;
 
782
--- Show the new improved table on the master ---
 
783
SHOW CREATE TABLE t1;
 
784
Table   Create Table
 
785
t1      CREATE TABLE `t1` (
 
786
  `id` mediumint(9) NOT NULL,
 
787
  `b1` bit(8) DEFAULT NULL,
 
788
  `vc` text,
 
789
  `bc` char(255) DEFAULT NULL,
 
790
  `d` decimal(10,4) DEFAULT '0.0000',
 
791
  `f` float DEFAULT '0',
 
792
  `total` bigint(20) unsigned NOT NULL DEFAULT '0',
 
793
  `y` year(4) DEFAULT NULL,
 
794
  `t` date DEFAULT NULL,
 
795
  PRIMARY KEY (`id`,`total`)
 
796
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 
 
797
--- Make sure that our tables on slave are still same engine ---
 
798
--- and that the alter statements replicated correctly ---
 
799
SHOW CREATE TABLE t1;
 
800
Table   Create Table
 
801
t1      CREATE TABLE `t1` (
 
802
  `id` mediumint(9) NOT NULL,
 
803
  `b1` bit(8) DEFAULT NULL,
 
804
  `vc` text,
 
805
  `bc` char(255) DEFAULT NULL,
 
806
  `d` decimal(10,4) DEFAULT '0.0000',
 
807
  `f` float DEFAULT '0',
 
808
  `total` bigint(20) unsigned NOT NULL DEFAULT '0',
 
809
  `y` year(4) DEFAULT NULL,
 
810
  `t` date DEFAULT NULL,
 
811
  PRIMARY KEY (`id`,`total`)
 
812
) ENGINE=PBXT DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 
 
813
--- Perform basic operation on master ---
 
814
--- and ensure replicated correctly ---
 
815
"--- Insert into t1 --" as "";
 
816
--- Select from t1 on master --- 
 
817
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
 
818
id      hex(b1) vc      bc      d       f       total   y       t
 
819
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
 
820
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
 
821
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
 
822
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
 
823
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
 
824
--- Select from t1 on slave ---
 
825
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
 
826
id      hex(b1) vc      bc      d       f       total   y       t
 
827
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
 
828
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
 
829
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
 
830
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
 
831
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
 
832
--- Update t1 on master --
 
833
UPDATE t1 SET b1 = 0, t="2006-02-22" WHERE id = 412;
 
834
--- Check the update on master --- 
 
835
SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
 
836
id      hex(b1) vc      bc      d       f       total   y       t
 
837
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
 
838
--- Check Update on slave ---
 
839
SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412;
 
840
id      hex(b1) vc      bc      d       f       total   y       t
 
841
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
 
842
--- Remove a record from t1 on master ---
 
843
DELETE FROM t1 WHERE id = 42;
 
844
--- Show current count on master for t1 ---
 
845
SELECT COUNT(*) FROM t1;
 
846
COUNT(*)
 
847
4
 
848
--- Show current count on slave for t1 --- 
 
849
SELECT COUNT(*) FROM t1;
 
850
COUNT(*)
 
851
4
 
852
DELETE FROM t1;
 
853
--- End test 5 key partition testing ---
 
854
--- Do Cleanup ---
 
855
DROP TABLE IF EXISTS t1;