~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

« back to all changes in this revision

Viewing changes to mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_tables.test

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2010-06-21 15:31:05 UTC
  • mfrom: (1.1.3 upstream)
  • mto: This revision was merged to the branch mainline in revision 6.
  • Revision ID: james.westby@ubuntu.com-20100621153105-pbbz3t6nyrf9t2zq
Tags: upstream-5.1.48
ImportĀ upstreamĀ versionĀ 5.1.48

Show diffs side-by-side

added added

removed removed

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