summaryrefslogtreecommitdiff
path: root/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_tables.test
blob: a20e42f1b24fa0ad69cce7fc5afee1371696c65c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
# ==== Purpose ====
#
# Test replication of transactions on tables which have different
# engines on master and slave.  This tests all combinations of innodb,
# myisam, and ndb.
#
# ==== Method ====
#
# Set up six tables, each being innodb, myisam, or innodb on master,
# and another of innodb, myisam, or innodb on slave.  For each table,
# do the following:
#
#  - committed and rollback'ed transactions, with autocommit on and
#    off
#  - non-transactions with autocommit on
#  - non-transactions with autocommit off, where the master table is
#    myisam.
#
# Note: we are running the slave with
# --replicate-ignore-table=mysql.ndb_apply_status .  See BUG#34557 for
# explanation.
#
# ==== Related bugs ====
#
# BUG#26395: if crash during autocommit update to transactional table on master, slave fails
# BUG#29288: myisam transactions replicated to a transactional slave leaves slave unstable
# BUG#34557: Row-based replication from ndb to non-ndb gives error on slave
# BUG#34600: Rolled-back punch transactions not replicated correctly
#
# ==== Todo ====
#
# We should eventually try transactions touching two tables which are
# of different engines on the same server (so that we try, e.g. punch
# transactions; cf BUG#34600).  However, that will make the test much
# bigger (9 master-slave engine combinations [myisam->myisam,
# myisam->ndb, etc].  To try all combinations of one or more such
# tables means 2^9-1=511 transactions.  We need to multiplied by 5
# since we want to test committed/rollback'ed transactions
# with/without AUTOCOMMIT, as well as non-transactions with
# autocommit).  We'd have to write a script to produce the test case.


--echo ==== Initialization ====

--source include/have_ndb.inc
--source include/have_innodb.inc
--source include/ndb_master-slave.inc

--echo ---- setup master ----

CREATE TABLE myisam_innodb (a INT) ENGINE=MYISAM;
CREATE TABLE innodb_myisam (a INT) ENGINE=INNODB;
CREATE TABLE myisam_ndb    (a INT) ENGINE=MYISAM;
CREATE TABLE ndb_myisam    (a INT) ENGINE=NDB;
CREATE TABLE innodb_ndb    (a INT) ENGINE=INNODB;
CREATE TABLE ndb_innodb    (a INT) ENGINE=NDB;

SHOW CREATE TABLE myisam_innodb;
SHOW CREATE TABLE innodb_myisam;
SHOW CREATE TABLE myisam_ndb;
SHOW CREATE TABLE ndb_myisam;
SHOW CREATE TABLE innodb_ndb;
SHOW CREATE TABLE ndb_innodb;

--echo ---- setup slave with different engines ----

sync_slave_with_master;

DROP TABLE myisam_innodb, innodb_myisam;
DROP TABLE myisam_ndb, ndb_myisam;
DROP TABLE innodb_ndb, ndb_innodb;

CREATE TABLE myisam_innodb (a INT) ENGINE=INNODB;
CREATE TABLE innodb_myisam (a INT) ENGINE=MYISAM;
CREATE TABLE myisam_ndb    (a INT) ENGINE=NDB;
CREATE TABLE ndb_myisam    (a INT) ENGINE=MYISAM;
CREATE TABLE innodb_ndb    (a INT) ENGINE=NDB;
CREATE TABLE ndb_innodb    (a INT) ENGINE=INNODB;

SHOW CREATE TABLE myisam_innodb;
SHOW CREATE TABLE innodb_myisam;
SHOW CREATE TABLE myisam_ndb;
SHOW CREATE TABLE ndb_myisam;
SHOW CREATE TABLE innodb_ndb;
SHOW CREATE TABLE ndb_innodb;

connection master;


--echo ==== AUTOCOMMIT=0, transactions ====

--echo ---- COMMIT ----

SET AUTOCOMMIT = 0;

BEGIN;
INSERT INTO myisam_innodb VALUES (1);
INSERT INTO myisam_innodb VALUES (2);
COMMIT;
sync_slave_with_master;
connection master;
BEGIN;
INSERT INTO innodb_myisam VALUES (3);
INSERT INTO innodb_myisam VALUES (4);
COMMIT;
sync_slave_with_master;
connection master;

BEGIN;
INSERT INTO myisam_ndb VALUES (5);
INSERT INTO myisam_ndb VALUES (6);
COMMIT;
sync_slave_with_master;
connection master;
BEGIN;
INSERT INTO ndb_myisam VALUES (7);
INSERT INTO ndb_myisam VALUES (8);
COMMIT;
sync_slave_with_master;
connection master;

BEGIN;
INSERT INTO ndb_innodb VALUES (9);
INSERT INTO ndb_innodb VALUES (10);
COMMIT;
sync_slave_with_master;
connection master;
BEGIN;
INSERT INTO innodb_ndb VALUES (11);
INSERT INTO innodb_ndb VALUES (12);
COMMIT;
sync_slave_with_master;
connection master;

--echo ---- ROLLBACK ----

# This test does not work in ROW mode after the changes introduced in
# BUG#40116. After WL#2687 is pushed, Tests should be added again.
--disable_parsing
BEGIN;
INSERT INTO myisam_innodb VALUES (13);
INSERT INTO myisam_innodb VALUES (14);
ROLLBACK;
sync_slave_with_master;
--enable_parsing
connection master;
BEGIN;
INSERT INTO innodb_myisam VALUES (15);
INSERT INTO innodb_myisam VALUES (16);
ROLLBACK;
sync_slave_with_master;
connection master;

# This test does not work in ROW mode after the changes introduced in
# BUG#40116. After WL#2687 is pushed, these tests should be enabled
# again.
--disable_parsing
BEGIN;
INSERT INTO myisam_ndb VALUES (17);
INSERT INTO myisam_ndb VALUES (18);
ROLLBACK;
sync_slave_with_master;
connection master;
--enable_parsing
BEGIN;
INSERT INTO ndb_myisam VALUES (19);
INSERT INTO ndb_myisam VALUES (20);
ROLLBACK;
sync_slave_with_master;
connection master;

BEGIN;
INSERT INTO ndb_innodb VALUES (21);
INSERT INTO ndb_innodb VALUES (22);
ROLLBACK;
sync_slave_with_master;
connection master;
BEGIN;
INSERT INTO innodb_ndb VALUES (23);
INSERT INTO innodb_ndb VALUES (24);
ROLLBACK;
sync_slave_with_master;
connection master;


--echo ==== AUTOCOMMIT=1, transactions ====

--echo ---- COMMIT ----

SET AUTOCOMMIT = 1;

BEGIN;
INSERT INTO myisam_innodb VALUES (25);
INSERT INTO myisam_innodb VALUES (26);
COMMIT;
sync_slave_with_master;
connection master;
BEGIN;
INSERT INTO innodb_myisam VALUES (27);
INSERT INTO innodb_myisam VALUES (28);
COMMIT;
sync_slave_with_master;
connection master;

BEGIN;
INSERT INTO myisam_ndb VALUES (29);
INSERT INTO myisam_ndb VALUES (30);
COMMIT;
sync_slave_with_master;
connection master;
BEGIN;
INSERT INTO ndb_myisam VALUES (31);
INSERT INTO ndb_myisam VALUES (32);
COMMIT;
sync_slave_with_master;
connection master;

BEGIN;
INSERT INTO ndb_innodb VALUES (33);
INSERT INTO ndb_innodb VALUES (34);
COMMIT;
sync_slave_with_master;
connection master;
BEGIN;
INSERT INTO innodb_ndb VALUES (35);
INSERT INTO innodb_ndb VALUES (36);
COMMIT;
sync_slave_with_master;
connection master;

--echo ---- ROLLBACK ----

# This test does not work in ROW mode after the changes introduced in
# BUG#40116. After WL#2687 is pushed, these tests should be enabled
# again.
--disable_parsing
BEGIN;
INSERT INTO myisam_innodb VALUES (37);
INSERT INTO myisam_innodb VALUES (38);
ROLLBACK;
sync_slave_with_master;
connection master;
--enable_parsing
BEGIN;
INSERT INTO innodb_myisam VALUES (39);
INSERT INTO innodb_myisam VALUES (40);
ROLLBACK;
sync_slave_with_master;
connection master;

# This test does not work in ROW mode after the changes introduced in
# BUG#40116. After WL#2687 is pushed, these tests should be enabled
# again.
--disable_parsing
BEGIN;
INSERT INTO myisam_ndb VALUES (41);
INSERT INTO myisam_ndb VALUES (42);
ROLLBACK;
sync_slave_with_master;
connection master;
--enable_parsing
BEGIN;
INSERT INTO ndb_myisam VALUES (43);
INSERT INTO ndb_myisam VALUES (44);
ROLLBACK;
sync_slave_with_master;
connection master;

BEGIN;
INSERT INTO ndb_innodb VALUES (45);
INSERT INTO ndb_innodb VALUES (46);
ROLLBACK;
sync_slave_with_master;
connection master;
BEGIN;
INSERT INTO innodb_ndb VALUES (47);
INSERT INTO innodb_ndb VALUES (48);
ROLLBACK;
sync_slave_with_master;
connection master;


--echo ==== AUTOCOMMIT=1, single statements ====

INSERT INTO myisam_innodb VALUES (49);
INSERT INTO myisam_innodb VALUES (50);
sync_slave_with_master;
connection master;
INSERT INTO innodb_myisam VALUES (51);
INSERT INTO innodb_myisam VALUES (52);
sync_slave_with_master;
connection master;

INSERT INTO myisam_ndb VALUES (53);
INSERT INTO myisam_ndb VALUES (54);
sync_slave_with_master;
connection master;
INSERT INTO ndb_myisam VALUES (55);
INSERT INTO ndb_myisam VALUES (56);
sync_slave_with_master;
connection master;

INSERT INTO ndb_innodb VALUES (57);
INSERT INTO ndb_innodb VALUES (58);
sync_slave_with_master;
connection master;
INSERT INTO innodb_ndb VALUES (59);
INSERT INTO innodb_ndb VALUES (60);
sync_slave_with_master;
connection master;


--echo ==== AUTOCOMMIT=0, single statements, myisam on master ====

SET AUTOCOMMIT = 0;

# These tests do not work in ROW mode after the changes introduced in
# BUG#40116. After WL#2687 is pushed, these tests should be enabled
# again.
--disable_parsing
# This tests BUG#29288.
INSERT INTO myisam_innodb VALUES (61);
INSERT INTO myisam_innodb VALUES (62);
sync_slave_with_master;
connection master;

INSERT INTO myisam_ndb VALUES (63);
INSERT INTO myisam_ndb VALUES (64);
sync_slave_with_master;
connection master;
--enable_parsing


--echo ==== Show results ====

SELECT * FROM myisam_innodb ORDER BY a;
SELECT * FROM innodb_myisam ORDER BY a;
SELECT * FROM myisam_ndb    ORDER BY a;
SELECT * FROM ndb_myisam    ORDER BY a;
SELECT * FROM innodb_ndb    ORDER BY a;
SELECT * FROM ndb_innodb    ORDER BY a;

let $diff_table_1=master:test.myisam_innodb;
let $diff_table_2=slave:test.myisam_innodb;
source include/diff_tables.inc;

let $diff_table_1=master:test.innodb_myisam;
let $diff_table_2=slave:test.innodb_myisam;
source include/diff_tables.inc;

let $diff_table_1=master:test.myisam_ndb;
let $diff_table_2=slave:test.myisam_ndb;
source include/diff_tables.inc;

let $diff_table_1=master:test.ndb_myisam;
let $diff_table_2=slave:test.ndb_myisam;
source include/diff_tables.inc;

let $diff_table_1=master:test.innodb_ndb;
let $diff_table_2=slave:test.innodb_ndb;
source include/diff_tables.inc;

let $diff_table_1=master:test.ndb_innodb;
let $diff_table_2=slave:test.ndb_innodb;
source include/diff_tables.inc;


--echo ==== Clean up ====

drop table myisam_innodb, innodb_myisam;
drop table myisam_ndb, ndb_myisam;
drop table innodb_ndb, ndb_innodb;
sync_slave_with_master;