1 #######################################
4 # Purpose: See if replication between #
5 # NDB -> MyISAM and InnoDB works. #
7 # MyISAM and InnoDB -> NDB works. #
8 #######################################
11 # Change: Implemented review comments #
12 #######################################
14 --echo --- Doing pre
test cleanup ---
18 DROP
TABLE IF EXISTS t1;
21 --echo --- Start
test 1 Basic testing ---
22 --echo --- Create Table Section ---
24 #################################################
25 # Requirment: Create basic table, replicate #
26 # basice operations such at insert, update #
27 # delete between 2 different storage engines #
28 # Alter table and ensure table is handled #
29 # Correctly on the slave #
30 #################################################
32 CREATE
TABLE t1 (
id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255),
33 bc CHAR(255), d DECIMAL(10,4) DEFAULT 0,
34 f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
35 y YEAR, t DATE,PRIMARY
KEY(
id));
37 --echo --- Show
table on master ---
41 --echo --- Show
table on slave ---
43 sync_slave_with_master;
46 --echo --- Perform basic operation on master ---
47 --echo --- and ensure replicated correctly ---
49 --source include/rpl_multi_engine3.inc
51 # Okay lets see how it holds up to table changes
52 --echo ---
Check that simple Alter statements are replicated correctly --
54 ALTER
TABLE t1 DROP PRIMARY
KEY, ADD PRIMARY KEY(
id, total);
55 ALTER
TABLE t1 MODIFY vc TEXT;
57 --echo --- Show the
new improved
table on the master ---
61 --echo --- Make sure that our tables on slave are still same engine ---
62 --echo --- and that the alter statements replicated correctly ---
64 sync_slave_with_master;
67 --echo --- Perform basic operation on master ---
68 --echo --- and ensure replicated correctly ---
70 --source include/rpl_multi_engine3.inc
72 --echo --- End
test 1 Basic testing ---
73 --echo --- Do Cleanup --
75 DROP
TABLE IF EXISTS t1;
77 #################################################################
79 --echo --- Start
test 2 partition RANGE testing --
80 --echo --- Do setup --
83 #################################################
84 # Requirment: Create table that is partitioned #
85 # by range on year i.e. year(t) and replicate #
86 # basice operations such at insert, update #
87 # delete between 2 different storage engines #
88 # Alter table and ensure table is handled #
89 # Correctly on the slave #
90 #################################################
92 CREATE
TABLE t1 (
id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255),
93 bc CHAR(255), d DECIMAL(10,4) DEFAULT 0,
94 f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
95 y YEAR, t DATE, primary key(t))
96 PARTITION BY RANGE (YEAR(t))
97 (PARTITION p0 VALUES LESS THAN (1901),
98 PARTITION p1 VALUES LESS THAN (1946),
99 PARTITION p2 VALUES LESS THAN (1966),
100 PARTITION p3 VALUES LESS THAN (1986),
101 PARTITION p4 VALUES LESS THAN (2005),
102 PARTITION p5 VALUES LESS THAN MAXVALUE);
104 --echo --- Show
table on master ---
106 SHOW CREATE
TABLE t1;
108 --echo --- Show
table on slave --
110 sync_slave_with_master;
111 SHOW CREATE
TABLE t1;
113 --echo --- Perform basic operation on master ---
114 --echo --- and ensure replicated correctly ---
116 --source include/rpl_multi_engine3.inc
118 --echo ---
Check that simple Alter statements are replicated correctly ---
120 ALTER
TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(t,
id);
121 ALTER
TABLE t1 MODIFY vc TEXT;
123 --echo --- Show the new improved
table on the master ---
125 SHOW CREATE
TABLE t1;
127 --echo --- Make sure that our tables on slave are still same engine ---
128 --echo --- and that the alter statements replicated correctly ---
130 sync_slave_with_master;
131 SHOW CREATE
TABLE t1;
133 --echo --- Perform basic operation on master ---
134 --echo --- and ensure replicated correctly ---
137 --source include/rpl_multi_engine3.inc
139 --echo --- End
test 2 partition RANGE testing ---
140 --echo --- Do Cleanup ---
142 DROP
TABLE IF EXISTS t1;
144 ########################################################
146 --echo --- Start
test 3 partition
LIST testing ---
147 --echo --- Do setup ---
148 #################################################
149 # Requirment: Create table that is partitioned #
150 # by list on id i.e. (2,4). Pretend that we #
151 # missed one and alter to add. Then replicate #
152 # basice operations such at insert, update #
153 # delete between 2 different storage engines #
154 # Alter table and ensure table is handled #
155 # Correctly on the slave #
156 #################################################
159 CREATE
TABLE t1 (
id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255),
160 bc CHAR(255), d DECIMAL(10,4) DEFAULT 0,
161 f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
162 y YEAR, t DATE, primary key(
id))
163 PARTITION BY
LIST(
id)
164 (PARTITION p0 VALUES IN (2, 4),
165 PARTITION p1 VALUES IN (42, 142));
167 --echo ---
Test 3 Alter
to add partition ---
169 ALTER
TABLE t1 ADD PARTITION (PARTITION p2 VALUES IN (412));
171 --echo --- Show
table on master ---
173 SHOW CREATE
TABLE t1;
175 --echo --- Show
table on slave ---
177 sync_slave_with_master;
178 SHOW CREATE
TABLE t1;
180 --echo --- Perform basic operation on master ---
181 --echo --- and ensure replicated correctly ---
183 --source include/rpl_multi_engine3.inc
185 --echo ---
Check that simple Alter statements are replicated correctly ---
187 ALTER
TABLE t1 MODIFY vc TEXT;
189 --echo --- Show the new improved
table on the master ---
191 SHOW CREATE
TABLE t1;
193 --echo --- Make sure that our tables on slave are still same engine ---
194 --echo --- and that the alter statements replicated correctly ---
196 sync_slave_with_master;
197 SHOW CREATE
TABLE t1;
199 --echo --- Perform basic operation on master ---
200 --echo --- and ensure replicated correctly ---
202 --source include/rpl_multi_engine3.inc
204 --echo --- End
test 3 partition
LIST testing ---
205 --echo --- Do Cleanup --
207 DROP
TABLE IF EXISTS t1;
209 ########################################################
211 --echo --- Start
test 4 partition
HASH testing ---
212 --echo --- Do setup ---
213 #################################################
214 # Requirment: Create table that is partitioned #
215 # by hash on year i.e. YEAR(t). Then replicate #
216 # basice operations such at insert, update #
217 # delete between 2 different storage engines #
218 # Alter table and ensure table is handled #
219 # Correctly on the slave #
220 #################################################
223 CREATE
TABLE t1 (
id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255),
224 bc CHAR(255), d DECIMAL(10,4) DEFAULT 0,
225 f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
226 y YEAR, t DATE, primary key(t))
227 PARTITION BY
HASH( YEAR(t) )
230 --echo --- show that tables have been created correctly ---
232 SHOW CREATE
TABLE t1;
233 sync_slave_with_master;
234 SHOW CREATE
TABLE t1;
236 --echo --- Perform basic operation on master ---
237 --echo --- and ensure replicated correctly ---
239 --source include/rpl_multi_engine3.inc
241 --echo ---
Check that simple Alter statements are replicated correctly ---
243 ALTER
TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(t,
id);
244 ALTER
TABLE t1 MODIFY vc TEXT;
246 --echo --- Show the new improved
table on the master ---
248 SHOW CREATE
TABLE t1;
250 --echo --- Make sure that our tables on slave are still same engine ---
251 --echo --- and that the alter statements replicated correctly ---
253 sync_slave_with_master;
254 SHOW CREATE
TABLE t1;
256 --echo --- Perform basic operation on master ---
257 --echo --- and ensure replicated correctly ---
259 --source include/rpl_multi_engine3.inc
261 --echo --- End
test 4 partition
HASH testing ---
262 --echo --- Do Cleanup --
264 DROP
TABLE IF EXISTS t1;
266 ########################################################
268 --echo --- Start
test 5 partition by key testing ---
269 --echo --- Create Table Section ---
271 #################################################
272 # Requirment: Create table that is partitioned #
273 # by key on id with 4 parts. Then replicate #
274 # basice operations such at insert, update #
275 # delete between 2 different storage engines #
276 # Alter table and ensure table is handled #
277 # Correctly on the slave #
278 #################################################
280 CREATE
TABLE t1 (
id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255),
281 bc CHAR(255), d DECIMAL(10,4) DEFAULT 0,
282 f FLOAT DEFAULT 0, total BIGINT UNSIGNED,
283 y YEAR, t DATE,PRIMARY KEY(
id))
287 --echo --- Show that tables on master are ndbcluster tables ---
289 SHOW CREATE
TABLE t1;
291 --echo --- Show that tables on slave ---
293 sync_slave_with_master;
294 SHOW CREATE
TABLE t1;
296 --echo --- Perform basic operation on master ---
297 --echo --- and ensure replicated correctly ---
299 --source include/rpl_multi_engine3.inc
301 # Okay lets see how it holds up to table changes
302 --echo ---
Check that simple Alter statements are replicated correctly ---
304 ALTER
TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(
id, total);
306 --echo --- Show the
new improved
table on the master ---
308 SHOW CREATE
TABLE t1;
310 --echo --- Make sure that our tables on slave are still right
type ---
311 --echo --- and that the alter statements replicated correctly ---
313 sync_slave_with_master;
314 SHOW CREATE
TABLE t1;
316 --echo --- Perform basic operation on master ---
317 --echo --- and ensure replicated correctly ---
319 --source include/rpl_multi_engine3.inc
321 --echo ---
Check that simple Alter statements are replicated correctly ---
323 ALTER
TABLE t1 MODIFY vc TEXT;
325 --echo --- Show the
new improved
table on the master ---
327 SHOW CREATE
TABLE t1;
329 --echo --- Make sure that our tables on slave are still same engine ---
330 --echo --- and that the alter statements replicated correctly ---
332 sync_slave_with_master;
333 SHOW CREATE
TABLE t1;
335 --echo --- Perform basic operation on master ---
336 --echo --- and ensure replicated correctly ---
338 --source include/rpl_multi_engine3.inc
340 --echo --- End
test 5 key partition testing ---
341 --echo --- Do Cleanup ---
343 DROP
TABLE IF EXISTS t1;
344 sync_slave_with_master;
346 # End of 5.1 test case