1 include/master-slave.inc
3 SET storage_engine=ndb;
7 set @old_slave_exec_mode= @@global.slave_exec_mode;
8 set @@global.slave_exec_mode= 'IDEMPOTENT';
9 CREATE TABLE mysql.ndb_apply_status
10 ( server_id INT UNSIGNED NOT NULL,
11 epoch BIGINT UNSIGNED NOT NULL,
12 log_name VARCHAR(255) BINARY NOT NULL,
13 start_pos BIGINT UNSIGNED NOT NULL,
14 end_pos BIGINT UNSIGNED NOT NULL,
15 PRIMARY KEY USING HASH (server_id)) ENGINE=MYISAM;
16 SET storage_engine=myisam;
17 --- Doing pre test cleanup ---
18 DROP TABLE IF EXISTS t1;
19 --- Create Table Section ---
20 CREATE TABLE t1 (id MEDIUMINT NOT NULL,
24 d DECIMAL(10,4) DEFAULT 0,
26 total BIGINT UNSIGNED,
30 --- Show table on master ---
33 t1 CREATE TABLE `t1` (
34 `id` mediumint(9) NOT NULL,
35 `b1` int(11) DEFAULT NULL,
36 `vc` varchar(255) DEFAULT NULL,
37 `bc` char(255) DEFAULT NULL,
38 `d` decimal(10,4) DEFAULT '0.0000',
39 `f` float DEFAULT '0',
40 `total` bigint(20) unsigned DEFAULT NULL,
41 `y` year(4) DEFAULT NULL,
42 `t` date DEFAULT NULL,
44 ) ENGINE=ndbcluster DEFAULT CHARSET=latin1
45 --- Show table on slave ---
48 t1 CREATE TABLE `t1` (
49 `id` mediumint(9) NOT NULL,
50 `b1` int(11) DEFAULT NULL,
51 `vc` varchar(255) DEFAULT NULL,
52 `bc` char(255) DEFAULT NULL,
53 `d` decimal(10,4) DEFAULT '0.0000',
54 `f` float DEFAULT '0',
55 `total` bigint(20) unsigned DEFAULT NULL,
56 `y` year(4) DEFAULT NULL,
57 `t` date DEFAULT NULL,
59 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
64 --- Populate t1 with data ---
65 --- Select from t1 on master ---
69 id b1 vc bc d f total y t
70 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
71 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
72 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
73 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
74 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
75 --- Select from t1 on slave ---
79 id b1 vc bc d f total y t
80 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
81 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
82 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
83 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
84 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
85 --- Perform basic operation on master ---
86 --- and ensure replicated correctly ---
87 --- Update t1 on master --
88 UPDATE t1 SET b1 = 0, bc='updated', t="2006-02-22"
91 --- Check the update on master ---
96 id b1 vc bc d f total y t
97 2 0 Testing MySQL databases is a cool updated 654321.4321 15.21 0 1965 2006-02-22
98 4 0 Testing MySQL databases is a cool updated 654321.4321 15.21 0 1965 2006-02-22
99 42 0 Testing MySQL databases is a cool updated 654321.4321 15.21 0 1965 2006-02-22
100 --- Check Update on slave ---
105 id b1 vc bc d f total y t
106 2 0 Testing MySQL databases is a cool updated 654321.4321 15.21 0 1965 2006-02-22
107 4 0 Testing MySQL databases is a cool updated 654321.4321 15.21 0 1965 2006-02-22
108 42 0 Testing MySQL databases is a cool updated 654321.4321 15.21 0 1965 2006-02-22
109 --- Remove a record from t1 on master ---
110 DELETE FROM t1 WHERE id = 412;
111 --- Show current count on master for t1 ---
112 SELECT COUNT(*) FROM t1;
115 --- Show current count on slave for t1 ---
116 SELECT COUNT(*) FROM t1;
120 --- Check that simple Alter statements are replicated correctly --
121 ALTER TABLE t1 DROP PRIMARY KEY;
122 ALTER TABLE t1 MODIFY vc char(32);
123 --- Show the new improved table on the master ---
124 SHOW CREATE TABLE t1;
126 t1 CREATE TABLE `t1` (
127 `id` mediumint(9) NOT NULL,
128 `b1` int(11) DEFAULT NULL,
129 `vc` char(32) DEFAULT NULL,
130 `bc` char(255) DEFAULT NULL,
131 `d` decimal(10,4) DEFAULT '0.0000',
132 `f` float DEFAULT '0',
133 `total` bigint(20) unsigned DEFAULT NULL,
134 `y` year(4) DEFAULT NULL,
135 `t` date DEFAULT NULL
136 ) ENGINE=ndbcluster DEFAULT CHARSET=latin1
137 --- Make sure that our tables on slave are still same engine ---
138 --- and that the alter statements replicated correctly ---
139 SHOW CREATE TABLE t1;
141 t1 CREATE TABLE `t1` (
142 `id` mediumint(9) NOT NULL,
143 `b1` int(11) DEFAULT NULL,
144 `vc` char(32) DEFAULT NULL,
145 `bc` char(255) DEFAULT NULL,
146 `d` decimal(10,4) DEFAULT '0.0000',
147 `f` float DEFAULT '0',
148 `total` bigint(20) unsigned DEFAULT NULL,
149 `y` year(4) DEFAULT NULL,
150 `t` date DEFAULT NULL
151 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
156 --- Populate t1 with data ---
157 --- Select from t1 on master ---
161 id b1 vc bc d f total y t
162 2 1 Testing MySQL databases is a coo Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
163 4 1 Testing MySQL databases is a coo Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
164 42 1 Testing MySQL databases is a coo Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
165 142 1 Testing MySQL databases is a coo Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
166 412 1 Testing MySQL databases is a coo Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
167 --- Select from t1 on slave ---
171 id b1 vc bc d f total y t
172 2 1 Testing MySQL databases is a coo Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
173 4 1 Testing MySQL databases is a coo Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
174 42 1 Testing MySQL databases is a coo Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
175 142 1 Testing MySQL databases is a coo Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
176 412 1 Testing MySQL databases is a coo Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
177 --- Perform basic operation on master ---
178 --- and ensure replicated correctly ---
179 --- Update t1 on master --
180 UPDATE t1 SET b1 = 0, bc='updated', t="2006-02-22"
183 --- Check the update on master ---
188 id b1 vc bc d f total y t
189 2 0 Testing MySQL databases is a coo updated 654321.4321 15.21 0 1965 2006-02-22
190 4 0 Testing MySQL databases is a coo updated 654321.4321 15.21 0 1965 2006-02-22
191 42 0 Testing MySQL databases is a coo updated 654321.4321 15.21 0 1965 2006-02-22
192 --- Check Update on slave ---
197 id b1 vc bc d f total y t
198 2 0 Testing MySQL databases is a coo updated 654321.4321 15.21 0 1965 2006-02-22
199 4 0 Testing MySQL databases is a coo updated 654321.4321 15.21 0 1965 2006-02-22
200 42 0 Testing MySQL databases is a coo updated 654321.4321 15.21 0 1965 2006-02-22
201 --- Remove a record from t1 on master ---
202 DELETE FROM t1 WHERE id = 412;
203 --- Show current count on master for t1 ---
204 SELECT COUNT(*) FROM t1;
207 --- Show current count on slave for t1 ---
208 SELECT COUNT(*) FROM t1;
212 --- Check that replication works when slave has more columns than master
213 ALTER TABLE t1 ADD PRIMARY KEY(id,total);
214 ALTER TABLE t1 MODIFY vc TEXT;
215 INSERT INTO t1 VALUES(3,1,'Testing MySQL databases is a cool ',
216 'Must make it bug free for the customer',
217 654321.4321,15.21,0,1965,"1905-11-14");
218 INSERT INTO t1 VALUES(20,1,'Testing MySQL databases is a cool ',
219 'Must make it bug free for the customer',
220 654321.4321,15.21,0,1965,"1965-11-14");
221 INSERT INTO t1 VALUES(50,1,'Testing MySQL databases is a cool ',
222 'Must make it bug free for the customer',
223 654321.4321,15.21,0,1965,"1985-11-14");
224 --- Add columns on slave ---
225 ALTER TABLE t1 ADD (u int, v char(16) default 'default');
226 UPDATE t1 SET u=7 WHERE id < 50;
227 UPDATE t1 SET v='explicit' WHERE id >10;
228 --- Show changed table on slave ---
229 SHOW CREATE TABLE t1;
231 t1 CREATE TABLE `t1` (
232 `id` mediumint(9) NOT NULL,
233 `b1` int(11) DEFAULT NULL,
235 `bc` char(255) DEFAULT NULL,
236 `d` decimal(10,4) DEFAULT '0.0000',
237 `f` float DEFAULT '0',
238 `total` bigint(20) unsigned NOT NULL DEFAULT '0',
239 `y` year(4) DEFAULT NULL,
240 `t` date DEFAULT NULL,
241 `u` int(11) DEFAULT NULL,
242 `v` char(16) DEFAULT 'default',
243 PRIMARY KEY (`id`,`total`)
244 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
248 id b1 vc bc d f total y t u v
249 3 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 7 default
250 20 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 7 explicit
251 50 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 NULL explicit
256 --- Populate t1 with data ---
257 --- Select from t1 on master ---
261 id b1 vc bc d f total y t
262 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
263 3 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
264 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
265 20 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
266 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
267 50 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
268 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
269 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
270 --- Select from t1 on slave ---
274 id b1 vc bc d f total y t u v
275 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 NULL default
276 3 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 7 default
277 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 NULL default
278 20 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 7 explicit
279 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 NULL default
280 50 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 NULL explicit
281 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 NULL default
282 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 NULL default
283 --- Perform basic operation on master ---
284 --- and ensure replicated correctly ---
285 --- Update t1 on master --
286 UPDATE t1 SET b1 = 0, bc='updated', t="2006-02-22"
289 --- Check the update on master ---
294 id b1 vc bc d f total y t
295 2 0 Testing MySQL databases is a cool updated 654321.4321 15.21 0 1965 2006-02-22
296 3 0 Testing MySQL databases is a cool updated 654321.4321 15.21 0 1965 2006-02-22
297 4 0 Testing MySQL databases is a cool updated 654321.4321 15.21 0 1965 2006-02-22
298 20 0 Testing MySQL databases is a cool updated 654321.4321 15.21 0 1965 2006-02-22
299 42 0 Testing MySQL databases is a cool updated 654321.4321 15.21 0 1965 2006-02-22
300 50 0 Testing MySQL databases is a cool updated 654321.4321 15.21 0 1965 2006-02-22
301 --- Check Update on slave ---
306 id b1 vc bc d f total y t u v
307 2 0 Testing MySQL databases is a cool updated 654321.4321 15.21 0 1965 2006-02-22 NULL default
308 3 0 Testing MySQL databases is a cool updated 654321.4321 15.21 0 1965 2006-02-22 7 default
309 4 0 Testing MySQL databases is a cool updated 654321.4321 15.21 0 1965 2006-02-22 NULL default
310 20 0 Testing MySQL databases is a cool updated 654321.4321 15.21 0 1965 2006-02-22 7 explicit
311 42 0 Testing MySQL databases is a cool updated 654321.4321 15.21 0 1965 2006-02-22 NULL default
312 50 0 Testing MySQL databases is a cool updated 654321.4321 15.21 0 1965 2006-02-22 NULL explicit
313 --- Remove a record from t1 on master ---
314 DELETE FROM t1 WHERE id = 412;
315 --- Show current count on master for t1 ---
316 SELECT COUNT(*) FROM t1;
319 --- Show current count on slave for t1 ---
320 SELECT COUNT(*) FROM t1;
325 --- Check that replication works when master has more columns than slave
326 --- Remove columns on slave ---
327 ALTER TABLE t1 DROP COLUMN v;
328 ALTER TABLE t1 DROP COLUMN u;
329 ALTER TABLE t1 DROP COLUMN t;
330 ALTER TABLE t1 DROP COLUMN y;
331 --- Show changed table on slave ---
332 SHOW CREATE TABLE t1;
334 t1 CREATE TABLE `t1` (
335 `id` mediumint(9) NOT NULL,
336 `b1` int(11) DEFAULT NULL,
338 `bc` char(255) DEFAULT NULL,
339 `d` decimal(10,4) DEFAULT '0.0000',
340 `f` float DEFAULT '0',
341 `total` bigint(20) unsigned NOT NULL DEFAULT '0',
342 PRIMARY KEY (`id`,`total`)
343 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
348 --- Populate t1 with data ---
349 --- Select from t1 on master ---
353 id b1 vc bc d f total y t
354 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
355 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
356 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
357 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
358 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
359 --- Select from t1 on slave ---
363 id b1 vc bc d f total
364 2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0
365 4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0
366 42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0
367 142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0
368 412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0
369 --- Perform basic operation on master ---
370 --- and ensure replicated correctly ---
371 --- Update t1 on master --
372 UPDATE t1 SET b1 = 0, bc='updated', t="2006-02-22"
375 --- Check the update on master ---
380 id b1 vc bc d f total y t
381 2 0 Testing MySQL databases is a cool updated 654321.4321 15.21 0 1965 2006-02-22
382 4 0 Testing MySQL databases is a cool updated 654321.4321 15.21 0 1965 2006-02-22
383 42 0 Testing MySQL databases is a cool updated 654321.4321 15.21 0 1965 2006-02-22
384 --- Check Update on slave ---
389 id b1 vc bc d f total
390 2 0 Testing MySQL databases is a cool updated 654321.4321 15.21 0
391 4 0 Testing MySQL databases is a cool updated 654321.4321 15.21 0
392 42 0 Testing MySQL databases is a cool updated 654321.4321 15.21 0
393 --- Remove a record from t1 on master ---
394 DELETE FROM t1 WHERE id = 412;
395 --- Show current count on master for t1 ---
396 SELECT COUNT(*) FROM t1;
399 --- Show current count on slave for t1 ---
400 SELECT COUNT(*) FROM t1;
406 DROP TABLE IF EXISTS t1;
408 === NDB -> INNODB ===
410 alter table mysql.ndb_apply_status engine=innodb;
411 SET storage_engine=innodb;
412 --- Doing pre test cleanup ---
413 DROP TABLE IF EXISTS t1;
414 --- Create Table Section ---
415 CREATE TABLE t1 (id MEDIUMINT NOT NULL,
419 d DECIMAL(10,4) DEFAULT 0,
421 total BIGINT UNSIGNED,
425 --- Show table on master ---
426 SHOW CREATE TABLE t1;
428 t1 CREATE TABLE `t1` (
429 `id` mediumint(9) NOT NULL,
430 `b1` int(11) DEFAULT NULL,
431 `vc` varchar(255) DEFAULT NULL,
432 `bc` char(255) DEFAULT NULL,
433 `d` decimal(10,4) DEFAULT '0.0000',
434 `f` float DEFAULT '0',
435 `total` bigint(20) unsigned DEFAULT NULL,
436 `y` year(4) DEFAULT NULL,
437 `t` date DEFAULT NULL,
439 ) ENGINE=ndbcluster DEFAULT CHARSET=latin1
440 --- Show table on slave ---
441 SHOW CREATE TABLE t1;
443 t1 CREATE TABLE `t1` (
444 `id` mediumint(9) NOT NULL,
445 `b1` int(11) DEFAULT NULL,
446 `vc` varchar(255) DEFAULT NULL,
447 `bc` char(255) DEFAULT NULL,
448 `d` decimal(10,4) DEFAULT '0.0000',
449 `f` float DEFAULT '0',
450 `total` bigint(20) unsigned DEFAULT NULL,
451 `y` year(4) DEFAULT NULL,
452 `t` date DEFAULT NULL,
454 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
459 --- Populate t1 with data ---
460 --- Select from t1 on master ---
464 id b1 vc bc d f total y t
465 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
466 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
467 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
468 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
469 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
470 --- Select from t1 on slave ---
474 id b1 vc bc d f total y t
475 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
476 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
477 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
478 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
479 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
480 --- Perform basic operation on master ---
481 --- and ensure replicated correctly ---
482 --- Update t1 on master --
483 UPDATE t1 SET b1 = 0, bc='updated', t="2006-02-22"
486 --- Check the update on master ---
491 id b1 vc bc d f total y t
492 2 0 Testing MySQL databases is a cool updated 654321.4321 15.21 0 1965 2006-02-22
493 4 0 Testing MySQL databases is a cool updated 654321.4321 15.21 0 1965 2006-02-22
494 42 0 Testing MySQL databases is a cool updated 654321.4321 15.21 0 1965 2006-02-22
495 --- Check Update on slave ---
500 id b1 vc bc d f total y t
501 2 0 Testing MySQL databases is a cool updated 654321.4321 15.21 0 1965 2006-02-22
502 4 0 Testing MySQL databases is a cool updated 654321.4321 15.21 0 1965 2006-02-22
503 42 0 Testing MySQL databases is a cool updated 654321.4321 15.21 0 1965 2006-02-22
504 --- Remove a record from t1 on master ---
505 DELETE FROM t1 WHERE id = 412;
506 --- Show current count on master for t1 ---
507 SELECT COUNT(*) FROM t1;
510 --- Show current count on slave for t1 ---
511 SELECT COUNT(*) FROM t1;
515 --- Check that simple Alter statements are replicated correctly --
516 ALTER TABLE t1 DROP PRIMARY KEY;
517 ALTER TABLE t1 MODIFY vc char(32);
518 --- Show the new improved table on the master ---
519 SHOW CREATE TABLE t1;
521 t1 CREATE TABLE `t1` (
522 `id` mediumint(9) NOT NULL,
523 `b1` int(11) DEFAULT NULL,
524 `vc` char(32) DEFAULT NULL,
525 `bc` char(255) DEFAULT NULL,
526 `d` decimal(10,4) DEFAULT '0.0000',
527 `f` float DEFAULT '0',
528 `total` bigint(20) unsigned DEFAULT NULL,
529 `y` year(4) DEFAULT NULL,
530 `t` date DEFAULT NULL
531 ) ENGINE=ndbcluster DEFAULT CHARSET=latin1
532 --- Make sure that our tables on slave are still same engine ---
533 --- and that the alter statements replicated correctly ---
534 SHOW CREATE TABLE t1;
536 t1 CREATE TABLE `t1` (
537 `id` mediumint(9) NOT NULL,
538 `b1` int(11) DEFAULT NULL,
539 `vc` char(32) DEFAULT NULL,
540 `bc` char(255) DEFAULT NULL,
541 `d` decimal(10,4) DEFAULT '0.0000',
542 `f` float DEFAULT '0',
543 `total` bigint(20) unsigned DEFAULT NULL,
544 `y` year(4) DEFAULT NULL,
545 `t` date DEFAULT NULL
546 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
551 --- Populate t1 with data ---
552 --- Select from t1 on master ---
556 id b1 vc bc d f total y t
557 2 1 Testing MySQL databases is a coo Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
558 4 1 Testing MySQL databases is a coo Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
559 42 1 Testing MySQL databases is a coo Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
560 142 1 Testing MySQL databases is a coo Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
561 412 1 Testing MySQL databases is a coo Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
562 --- Select from t1 on slave ---
566 id b1 vc bc d f total y t
567 2 1 Testing MySQL databases is a coo Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
568 4 1 Testing MySQL databases is a coo Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
569 42 1 Testing MySQL databases is a coo Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
570 142 1 Testing MySQL databases is a coo Must make it bug free for the customer 654321.4321 15.21 0 1965 1995-11-14
571 412 1 Testing MySQL databases is a coo Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-11-14
572 --- Perform basic operation on master ---
573 --- and ensure replicated correctly ---
574 --- Update t1 on master --
575 UPDATE t1 SET b1 = 0, bc='updated', t="2006-02-22"
578 --- Check the update on master ---
583 id b1 vc bc d f total y t
584 2 0 Testing MySQL databases is a coo updated 654321.4321 15.21 0 1965 2006-02-22
585 4 0 Testing MySQL databases is a coo updated 654321.4321 15.21 0 1965 2006-02-22
586 42 0 Testing MySQL databases is a coo updated 654321.4321 15.21 0 1965 2006-02-22
587 --- Check Update on slave ---
592 id b1 vc bc d f total y t
593 2 0 Testing MySQL databases is a coo updated 654321.4321 15.21 0 1965 2006-02-22
594 4 0 Testing MySQL databases is a coo updated 654321.4321 15.21 0 1965 2006-02-22
595 42 0 Testing MySQL databases is a coo updated 654321.4321 15.21 0 1965 2006-02-22
596 --- Remove a record from t1 on master ---
597 DELETE FROM t1 WHERE id = 412;
598 --- Show current count on master for t1 ---
599 SELECT COUNT(*) FROM t1;
602 --- Show current count on slave for t1 ---
603 SELECT COUNT(*) FROM t1;
607 --- Check that replication works when slave has more columns than master
608 ALTER TABLE t1 ADD PRIMARY KEY(id,total);
609 ALTER TABLE t1 MODIFY vc TEXT;
610 INSERT INTO t1 VALUES(3,1,'Testing MySQL databases is a cool ',
611 'Must make it bug free for the customer',
612 654321.4321,15.21,0,1965,"1905-11-14");
613 INSERT INTO t1 VALUES(20,1,'Testing MySQL databases is a cool ',
614 'Must make it bug free for the customer',
615 654321.4321,15.21,0,1965,"1965-11-14");
616 INSERT INTO t1 VALUES(50,1,'Testing MySQL databases is a cool ',
617 'Must make it bug free for the customer',
618 654321.4321,15.21,0,1965,"1985-11-14");
619 --- Add columns on slave ---
620 ALTER TABLE t1 ADD (u int, v char(16) default 'default');
621 UPDATE t1 SET u=7 WHERE id < 50;
622 UPDATE t1 SET v='explicit' WHERE id >10;
623 --- Show changed table on slave ---
624 SHOW CREATE TABLE t1;
626 t1 CREATE TABLE `t1` (
627 `id` mediumint(9) NOT NULL,
628 `b1` int(11) DEFAULT NULL,
630 `bc` char(255) DEFAULT NULL,
631 `d` decimal(10,4) DEFAULT '0.0000',
632 `f` float DEFAULT '0',
633 `total` bigint(20) unsigned NOT NULL DEFAULT '0',
634 `y` year(4) DEFAULT NULL,
635 `t` date DEFAULT NULL,
636 `u` int(11) DEFAULT NULL,
637 `v` char(16) DEFAULT 'default',
638 PRIMARY KEY (`id`,`total`)
639 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
643 id b1 vc bc d f total y t u v
644 3 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 7 default
645 20 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 7 explicit
646 50 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 NULL explicit
651 --- Populate t1 with data ---
652 --- Select from t1 on master ---
656 id b1 vc bc d f total y t
657 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
658 3 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14
659 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
660 20 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14
661 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
662 50 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14
663 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
664 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
665 --- Select from t1 on slave ---
669 id b1 vc bc d f total y t u v
670 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 NULL default
671 3 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1905-11-14 7 default
672 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 NULL default
673 20 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1965-11-14 7 explicit
674 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 NULL default
675 50 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 1985-11-14 NULL explicit
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 NULL default
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 NULL default
678 --- Perform basic operation on master ---
679 --- and ensure replicated correctly ---
680 --- Update t1 on master --
681 UPDATE t1 SET b1 = 0, bc='updated', t="2006-02-22"
684 --- Check the update on master ---
689 id b1 vc bc d f total y t
690 2 0 Testing MySQL databases is a cool updated 654321.4321 15.21 0 1965 2006-02-22
691 3 0 Testing MySQL databases is a cool updated 654321.4321 15.21 0 1965 2006-02-22
692 4 0 Testing MySQL databases is a cool updated 654321.4321 15.21 0 1965 2006-02-22
693 20 0 Testing MySQL databases is a cool updated 654321.4321 15.21 0 1965 2006-02-22
694 42 0 Testing MySQL databases is a cool updated 654321.4321 15.21 0 1965 2006-02-22
695 50 0 Testing MySQL databases is a cool updated 654321.4321 15.21 0 1965 2006-02-22
696 --- Check Update on slave ---
701 id b1 vc bc d f total y t u v
702 2 0 Testing MySQL databases is a cool updated 654321.4321 15.21 0 1965 2006-02-22 NULL default
703 3 0 Testing MySQL databases is a cool updated 654321.4321 15.21 0 1965 2006-02-22 7 default
704 4 0 Testing MySQL databases is a cool updated 654321.4321 15.21 0 1965 2006-02-22 NULL default
705 20 0 Testing MySQL databases is a cool updated 654321.4321 15.21 0 1965 2006-02-22 7 explicit
706 42 0 Testing MySQL databases is a cool updated 654321.4321 15.21 0 1965 2006-02-22 NULL default
707 50 0 Testing MySQL databases is a cool updated 654321.4321 15.21 0 1965 2006-02-22 NULL explicit
708 --- Remove a record from t1 on master ---
709 DELETE FROM t1 WHERE id = 412;
710 --- Show current count on master for t1 ---
711 SELECT COUNT(*) FROM t1;
714 --- Show current count on slave for t1 ---
715 SELECT COUNT(*) FROM t1;
720 --- Check that replication works when master has more columns than slave
721 --- Remove columns on slave ---
722 ALTER TABLE t1 DROP COLUMN v;
723 ALTER TABLE t1 DROP COLUMN u;
724 ALTER TABLE t1 DROP COLUMN t;
725 ALTER TABLE t1 DROP COLUMN y;
726 --- Show changed table on slave ---
727 SHOW CREATE TABLE t1;
729 t1 CREATE TABLE `t1` (
730 `id` mediumint(9) NOT NULL,
731 `b1` int(11) DEFAULT NULL,
733 `bc` char(255) DEFAULT NULL,
734 `d` decimal(10,4) DEFAULT '0.0000',
735 `f` float DEFAULT '0',
736 `total` bigint(20) unsigned NOT NULL DEFAULT '0',
737 PRIMARY KEY (`id`,`total`)
738 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
743 --- Populate t1 with data ---
744 --- Select from t1 on master ---
748 id b1 vc bc d f total y t
749 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
750 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
751 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
752 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
753 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
754 --- Select from t1 on slave ---
758 id b1 vc bc d f total
759 2 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0
760 4 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0
761 42 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0
762 142 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0
763 412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0
764 --- Perform basic operation on master ---
765 --- and ensure replicated correctly ---
766 --- Update t1 on master --
767 UPDATE t1 SET b1 = 0, bc='updated', t="2006-02-22"
770 --- Check the update on master ---
775 id b1 vc bc d f total y t
776 2 0 Testing MySQL databases is a cool updated 654321.4321 15.21 0 1965 2006-02-22
777 4 0 Testing MySQL databases is a cool updated 654321.4321 15.21 0 1965 2006-02-22
778 42 0 Testing MySQL databases is a cool updated 654321.4321 15.21 0 1965 2006-02-22
779 --- Check Update on slave ---
784 id b1 vc bc d f total
785 2 0 Testing MySQL databases is a cool updated 654321.4321 15.21 0
786 4 0 Testing MySQL databases is a cool updated 654321.4321 15.21 0
787 42 0 Testing MySQL databases is a cool updated 654321.4321 15.21 0
788 --- Remove a record from t1 on master ---
789 DELETE FROM t1 WHERE id = 412;
790 --- Show current count on master for t1 ---
791 SELECT COUNT(*) FROM t1;
794 --- Show current count on slave for t1 ---
795 SELECT COUNT(*) FROM t1;
801 DROP TABLE IF EXISTS t1;
802 drop table mysql.ndb_apply_status;
803 set @@global.slave_exec_mode= @old_slave_exec_mode;