1 #######################################
2 # Author: Rafal Somla #
4 # Purpose: Test replication of basic #
5 # table operations in various setups #
7 # Based on rpl_ndb_2multi_eng.test by #
9 #######################################
11 --echo --- Doing pre test cleanup ---
15 DROP TABLE IF EXISTS t1;
18 #################################################
19 --echo --- Create Table Section ---
21 CREATE TABLE t1 (id MEDIUMINT NOT NULL,
25 d DECIMAL(10,4) DEFAULT 0,
27 total BIGINT UNSIGNED,
32 --echo --- Show table on master ---
36 --echo --- Show table on slave ---
38 sync_slave_with_master;
41 --source include/rpl_multi_engine2.inc
43 #################################################
44 # Okay lets see how it holds up to table changes
45 --echo --- Check that simple Alter statements are replicated correctly --
47 ALTER TABLE t1 DROP PRIMARY KEY;
48 # note: table with no PK can't contain blobs if it is to be replicated.
49 ALTER TABLE t1 MODIFY vc char(32);
51 --echo --- Show the new improved table on the master ---
55 --echo --- Make sure that our tables on slave are still same engine ---
56 --echo --- and that the alter statements replicated correctly ---
58 sync_slave_with_master;
61 --source include/rpl_multi_engine2.inc
63 #################################################
64 --echo --- Check that replication works when slave has more columns than master
66 ALTER TABLE t1 ADD PRIMARY KEY(id,total);
67 ALTER TABLE t1 MODIFY vc TEXT;
69 INSERT INTO t1 VALUES(3,1,'Testing MySQL databases is a cool ',
70 'Must make it bug free for the customer',
71 654321.4321,15.21,0,1965,"1905-11-14");
72 INSERT INTO t1 VALUES(20,1,'Testing MySQL databases is a cool ',
73 'Must make it bug free for the customer',
74 654321.4321,15.21,0,1965,"1965-11-14");
75 INSERT INTO t1 VALUES(50,1,'Testing MySQL databases is a cool ',
76 'Must make it bug free for the customer',
77 654321.4321,15.21,0,1965,"1985-11-14");
79 --echo --- Add columns on slave ---
80 --sync_slave_with_master
81 ALTER TABLE t1 ADD (u int, v char(16) default 'default');
82 UPDATE t1 SET u=7 WHERE id < 50;
83 UPDATE t1 SET v='explicit' WHERE id >10;
85 --echo --- Show changed table on slave ---
92 --source include/rpl_multi_engine2.inc
95 #################################################
96 --echo --- Check that replication works when master has more columns than slave
99 --echo --- Remove columns on slave ---
100 --sync_slave_with_master
101 ALTER TABLE t1 DROP COLUMN v;
102 ALTER TABLE t1 DROP COLUMN u;
103 ALTER TABLE t1 DROP COLUMN t;
104 ALTER TABLE t1 DROP COLUMN y;
106 --echo --- Show changed table on slave ---
108 SHOW CREATE TABLE t1;
110 --source include/rpl_multi_engine2.inc
113 #################################################
114 --echo --- Do Cleanup --
116 DROP TABLE IF EXISTS t1;
118 sync_slave_with_master;