~ubuntu-branches/ubuntu/utopic/mariadb-5.5/utopic-security

« back to all changes in this revision

Viewing changes to .pc/90_spelling.diff/mysql-test/extra/rpl_tests/rpl_row_basic.test

  • Committer: Package Import Robot
  • Author(s): Otto Kekäläinen
  • Date: 2014-08-27 21:12:36 UTC
  • mfrom: (2.1.6 sid)
  • Revision ID: package-import@ubuntu.com-20140827211236-se41hwfe4xy0hpef
* d/control: Removed Provides: libmysqlclient-dev (Closes: #759309)
* d/control: Removed Provides: libmysqld-dev with same motivation
* Re-introduced tha HPPA build patch as the upstream fix wasn't complete
* Fixed all kFreeBSD build and test suite issues
* Added Italian translation (Closes: #759813)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
# Basic tests of row-level logging
 
3
#
 
4
 
 
5
#
 
6
# First we test tables with only an index.
 
7
#
 
8
 
 
9
#BUG#12662190 - COM_COMMIT IS NOT INCREMENTED FROM THE BINARY LOGS ON SLAVE, COM_BEGIN IS
 
10
#Testing command counters -BEFORE 
 
11
#Storing the before counts of Slave
 
12
connection slave;
 
13
let $slave_com_commit_before= query_get_value(SHOW GLOBAL STATUS LIKE 'com_commit', Value, 1);
 
14
let $slave_com_insert_before= query_get_value(SHOW GLOBAL STATUS LIKE 'com_insert', Value, 1);
 
15
let $slave_com_delete_before= query_get_value(SHOW GLOBAL STATUS LIKE 'com_delete', Value, 1);
 
16
let $slave_com_update_before= query_get_value(SHOW GLOBAL STATUS LIKE 'com_update', Value, 1);
 
17
 
 
18
connection master;
 
19
eval CREATE TABLE t1 (C1 CHAR(1), C2 CHAR(1), INDEX (C1)$extra_index_t1) ENGINE = $type ;
 
20
SELECT * FROM t1;
 
21
sync_slave_with_master;
 
22
SELECT * FROM t1;
 
23
 
 
24
# Testing insert
 
25
connection master;
 
26
INSERT INTO t1 VALUES ('A','B'), ('X','Y'), ('X','X');
 
27
INSERT INTO t1 VALUES ('A','C'), ('X','Z'), ('A','A');
 
28
SELECT * FROM t1 ORDER BY C1,C2;
 
29
sync_slave_with_master;
 
30
SELECT * FROM t1 ORDER BY C1,C2;
 
31
 
 
32
# Testing delete
 
33
# Observe that are several rows having the value for the index but only one
 
34
# should be deleted.
 
35
connection master;
 
36
DELETE FROM t1 WHERE C1 = C2;
 
37
SELECT * FROM t1 ORDER BY C1,C2;
 
38
sync_slave_with_master;
 
39
SELECT * FROM t1 ORDER BY C1,C2;
 
40
 
 
41
#
 
42
# Testing update.
 
43
# Note that we have a condition on a column that is not part of the index for
 
44
# the table. The right row should be updated nevertheless.
 
45
#
 
46
connection master;
 
47
UPDATE t1 SET C2 = 'I' WHERE C1 = 'A' AND C2 = 'C';
 
48
SELECT * FROM t1 ORDER BY C1,C2;
 
49
sync_slave_with_master;
 
50
SELECT * FROM t1 ORDER BY C1,C2;
 
51
 
 
52
#BUG#12662190 - COM_COMMIT IS NOT INCREMENTED FROM THE BINARY LOGS ON SLAVE, COM_BEGIN IS
 
53
#Testing command counters -AFTER 
 
54
#Storing the after counts of Slave
 
55
connection slave;
 
56
let $slave_com_commit_after= query_get_value(SHOW GLOBAL STATUS LIKE 'com_commit', Value, 1);
 
57
let $slave_com_insert_after= query_get_value(SHOW GLOBAL STATUS LIKE 'com_insert', Value, 1);
 
58
let $slave_com_delete_after= query_get_value(SHOW GLOBAL STATUS LIKE 'com_delete', Value, 1);
 
59
let $slave_com_update_after= query_get_value(SHOW GLOBAL STATUS LIKE 'com_update', Value, 1);
 
60
 
 
61
#Commit count check
 
62
--let $assert_text= Counter for COM_COMMIT is consistent with the number of actual commits
 
63
--let $assert_cond= $slave_com_commit_after - $slave_com_commit_before = 4
 
64
--source include/assert.inc
 
65
#Insert count check
 
66
--let $assert_text= Counter for COM_INSERT is consistent with the number of actual inserts
 
67
--let $assert_cond= $slave_com_insert_after - $slave_com_insert_before = 2
 
68
--source include/assert.inc
 
69
#Delete count check
 
70
--let $assert_text= Counter for COM_DELETE is consistent with the number of actual deletes
 
71
--let $assert_cond= $slave_com_delete_after - $slave_com_delete_before = 1
 
72
--source include/assert.inc
 
73
#Update count check
 
74
--let $assert_text= Counter for COM_UPDATE is consistent with the number of actual updates
 
75
--let $assert_cond= $slave_com_update_after - $slave_com_update_before = 1
 
76
--source include/assert.inc
 
77
 
 
78
# Testing update with a condition that does not match any rows, but
 
79
# which has a match for the index.
 
80
connection master;
 
81
UPDATE t1 SET c2 = 'Q' WHERE c1 = 'A' AND c2 = 'N';
 
82
SELECT * FROM t1 ORDER BY c1,c2;
 
83
sync_slave_with_master;
 
84
SELECT * FROM t1 ORDER BY c1,c2;
 
85
 
 
86
#
 
87
# Testing table with primary key
 
88
#
 
89
connection master;
 
90
eval CREATE TABLE t2 (c1 INT, c12 char(1), c2 INT, PRIMARY KEY (c1)) ENGINE = $type ;
 
91
INSERT INTO t2
 
92
  VALUES (1,'A',2),  (2,'A',4),  (3,'A',9),  (4,'A',15), (5,'A',25),
 
93
         (6,'A',35), (7,'A',50), (8,'A',64), (9,'A',81);
 
94
SELECT * FROM t2 ORDER BY c1,c2;
 
95
SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2;
 
96
sync_slave_with_master;
 
97
SELECT * FROM t2 ORDER BY c1,c2;
 
98
SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2;
 
99
 
 
100
connection master;
 
101
UPDATE t2 SET c2 = c1*c1 WHERE c2 != c1*c1;
 
102
SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2;
 
103
sync_slave_with_master;
 
104
SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2;
 
105
 
 
106
# Testing update with a condition that does not match any rows, but
 
107
# which has a match for the primary key.
 
108
connection master;
 
109
UPDATE t2 SET c12 = 'Q' WHERE c1 = 1 AND c2 = 999;
 
110
SELECT * FROM t2 ORDER BY c1,c2;
 
111
sync_slave_with_master;
 
112
SELECT * FROM t2 ORDER BY c1,c2;
 
113
 
 
114
connection master;
 
115
DELETE FROM t2 WHERE c1 % 4 = 0;
 
116
SELECT * FROM t2 ORDER BY c1,c2;
 
117
sync_slave_with_master;
 
118
SELECT * FROM t2 ORDER BY c1,c2;
 
119
 
 
120
connection master;
 
121
UPDATE t2 SET c12='X';
 
122
 
 
123
#
 
124
# Testing table with a multi-column primary key.
 
125
#
 
126
connection master;
 
127
eval CREATE TABLE t3 (C1 CHAR(1), C2 CHAR(1), pk1 INT, C3 CHAR(1), pk2 INT, PRIMARY KEY (pk1,pk2)) ENGINE = $type ;
 
128
 
 
129
INSERT INTO t3 VALUES ('A','B',1,'B',1), ('X','Y',2,'B',1), ('X','X',3,'B',1);
 
130
INSERT INTO t3 VALUES ('A','C',1,'B',2), ('X','Z',2,'B',2), ('A','A',3,'B',2);
 
131
SELECT * FROM t3 ORDER BY C1,C2;
 
132
sync_slave_with_master;
 
133
SELECT * FROM t3 ORDER BY C1,C2;
 
134
 
 
135
connection master;
 
136
DELETE FROM t3 WHERE C1 = C2;
 
137
SELECT * FROM t3 ORDER BY C1,C2;
 
138
sync_slave_with_master;
 
139
SELECT * FROM t3 ORDER BY C1,C2;
 
140
 
 
141
connection master;
 
142
UPDATE t3 SET C2 = 'I' WHERE C1 = 'A' AND C2 = 'C';
 
143
SELECT * FROM t3 ORDER BY C1,C2;
 
144
sync_slave_with_master;
 
145
SELECT * FROM t3 ORDER BY C1,C2;
 
146
 
 
147
#
 
148
# Testing table without index or primary key
 
149
#
 
150
connection master;
 
151
eval CREATE TABLE t6 (C1 CHAR(1), C2 CHAR(1), C3 INT$extra_index_t6) ENGINE = $type;
 
152
 
 
153
# Testing insert
 
154
INSERT INTO t6 VALUES ('A','B',1), ('X','Y',2), ('X','X',3);
 
155
INSERT INTO t6 VALUES ('A','C',4), ('X','Z',5), ('A','A',6);
 
156
SELECT * FROM t6 ORDER BY C3;
 
157
sync_slave_with_master;
 
158
SELECT * FROM t6 ORDER BY C3;
 
159
 
 
160
# Testing delete
 
161
# Observe that are several rows having the value for the index but only one
 
162
# should be deleted.
 
163
connection master;
 
164
DELETE FROM t6 WHERE C1 = C2;
 
165
SELECT * FROM t6 ORDER BY C3;
 
166
sync_slave_with_master;
 
167
SELECT * FROM t6 ORDER BY C3;
 
168
 
 
169
#
 
170
# Testing update.
 
171
# Note that we have a condition on a column that is not part of the index for
 
172
# the table. The right row should be updated nevertheless.
 
173
#
 
174
connection master;
 
175
UPDATE t6 SET C2 = 'I' WHERE C1 = 'A' AND C2 = 'C';
 
176
SELECT * FROM t6 ORDER BY C3;
 
177
sync_slave_with_master;
 
178
SELECT * FROM t6 ORDER BY C3;
 
179
 
 
180
# now mixing the 3 tables without begin/commit
 
181
connection master;
 
182
eval CREATE TABLE t5 (C1 CHAR(1), C2 CHAR(1), C3 INT PRIMARY KEY) ENGINE = $type ;
 
183
INSERT INTO t5 VALUES ('A','B',1), ('X','Y',2), ('X','X',3);
 
184
INSERT INTO t5 VALUES ('A','C',4), ('X','Z',5), ('A','A',6);
 
185
 
 
186
UPDATE t5,t2,t3 SET t5.C2='Q', t2.c12='R', t3.C3 ='S' WHERE t5.C1 = t2.c12 AND t5.C1 = t3.C1;
 
187
SELECT * FROM t5,t2,t3 WHERE t5.C2='Q' AND t2.c12='R' AND t3.C3 ='S' ORDER BY t5.C3,t2.c1,t3.pk1,t3.pk2;
 
188
sync_slave_with_master;
 
189
SELECT * FROM t5,t2,t3 WHERE t5.C2='Q' AND t2.c12='R' AND t3.C3 ='S' ORDER BY t5.C3,t2.c1,t3.pk1,t3.pk2;
 
190
 
 
191
#
 
192
# Testing special column types
 
193
#
 
194
 
 
195
if (`select char_length('$bit_field_special') > 0`) {
 
196
  connection slave;
 
197
  SET @saved_slave_type_conversions = @@SLAVE_TYPE_CONVERSIONS;
 
198
  eval SET GLOBAL SLAVE_TYPE_CONVERSIONS = '$bit_field_special';
 
199
}
 
200
 
 
201
connection master;
 
202
eval CREATE TABLE t4 (C1 CHAR(1) PRIMARY KEY, B1 BIT(1), B2 BIT(1) NOT NULL DEFAULT 0, C2 CHAR(1) NOT NULL DEFAULT 'A') ENGINE = $type ;
 
203
 
 
204
INSERT INTO t4 SET C1 = 1;
 
205
SELECT C1,HEX(B1),HEX(B2) FROM t4 ORDER BY C1;
 
206
sync_slave_with_master;
 
207
SELECT C1,HEX(B1),HEX(B2) FROM t4 ORDER BY C1;
 
208
 
 
209
if (`select char_length('$bit_field_special') > 0`) {
 
210
  SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
 
211
}
 
212
 
 
213
#
 
214
# Testing conflicting operations
 
215
#
 
216
connection master;
 
217
eval CREATE TABLE t7 (C1 INT PRIMARY KEY, C2 INT) ENGINE = $type ;
 
218
sync_slave_with_master;
 
219
--echo --- on slave: original values ---
 
220
INSERT INTO t7 VALUES (1,3), (2,6), (3,9);
 
221
SELECT * FROM t7 ORDER BY C1;
 
222
 
 
223
# since bug#31552/31609 idempotency is not default any longer. In order
 
224
# the preceeding test INSERT INTO t7 to pass the mode is switched
 
225
# temprorarily
 
226
set @@global.slave_exec_mode= 'IDEMPOTENT';
 
227
 
 
228
connection master;
 
229
--echo --- on master: new values inserted ---
 
230
INSERT INTO t7 VALUES (1,2), (2,4), (3,6);
 
231
SELECT * FROM t7 ORDER BY C1;
 
232
sync_slave_with_master;
 
233
 
 
234
set @@global.slave_exec_mode= default;
 
235
--echo --- on slave: old values should be overwritten by replicated values ---
 
236
SELECT * FROM t7 ORDER BY C1;
 
237
 
 
238
#
 
239
# A more complicated test where the table has several keys and we are
 
240
# causing a conflict for a key that is not "last".
 
241
#
 
242
connection master;
 
243
--echo --- on master ---
 
244
eval CREATE TABLE t8 (a INT PRIMARY KEY, b INT UNIQUE, c INT UNIQUE) ENGINE = $type ;
 
245
 
 
246
# First we make sure that the constraints are correctly set.
 
247
INSERT INTO t8 VALUES (99,99,99);
 
248
--error ER_DUP_ENTRY
 
249
INSERT INTO t8 VALUES (99,22,33);
 
250
--error ER_DUP_ENTRY
 
251
INSERT INTO t8 VALUES (11,99,33);
 
252
--error ER_DUP_ENTRY
 
253
INSERT INTO t8 VALUES (11,22,99);
 
254
SELECT * FROM t8 ORDER BY a;
 
255
 
 
256
sync_slave_with_master;
 
257
--echo --- on slave ---
 
258
SELECT * FROM t8 ORDER BY a;
 
259
INSERT INTO t8 VALUES (1,2,3), (2,4,6), (3,6,9);
 
260
SELECT * FROM t8 ORDER BY a;
 
261
 
 
262
# since bug#31552/31609 idempotency is not default any longer. In order
 
263
# the preceeding test INSERT INTO t8 to pass the mode is switched
 
264
# temprorarily
 
265
set @@global.slave_exec_mode= 'IDEMPOTENT';
 
266
 
 
267
connection master;
 
268
--echo --- on master ---
 
269
# We insert a row that will cause conflict on the primary key but not
 
270
# on the other keys.
 
271
INSERT INTO t8 VALUES (2,4,8);
 
272
sync_slave_with_master;
 
273
set @@global.slave_exec_mode= default;
 
274
 
 
275
--echo --- on slave ---
 
276
SELECT * FROM t8 ORDER BY a;
 
277
 
 
278
# BUG#31552: Replication breaks when deleting rows from out-of-sync
 
279
#            table without PK
 
280
 
 
281
--echo **** Test for BUG#31552 ****
 
282
 
 
283
--echo **** On Master ****
 
284
# Clean up t1 so that we can use it.
 
285
connection master;
 
286
DELETE FROM t1;
 
287
sync_slave_with_master;
 
288
 
 
289
# Just to get a clean binary log
 
290
--source include/rpl_reset.inc
 
291
 
 
292
--echo **** On Master ****
 
293
connection master;
 
294
INSERT INTO t1 VALUES ('K','K'), ('L','L'), ('M','M');
 
295
--echo **** On Master ****
 
296
sync_slave_with_master;
 
297
# since bug#31552/31609 idempotency is not default any longer. In order
 
298
# the following test DELETE FROM t1 to pass the mode is switched
 
299
# temprorarily
 
300
set @@global.slave_exec_mode= 'IDEMPOTENT';
 
301
DELETE FROM t1 WHERE C1 = 'L';
 
302
 
 
303
connection master;
 
304
DELETE FROM t1;
 
305
query_vertical SELECT COUNT(*) FROM t1 ORDER BY c1,c2;
 
306
sync_slave_with_master;
 
307
set @@global.slave_exec_mode= default;
 
308
source include/check_slave_is_running.inc;
 
309
query_vertical SELECT COUNT(*) FROM t1 ORDER BY c1,c2;
 
310
 
 
311
# BUG#37076: TIMESTAMP/DATETIME values are not replicated correctly
 
312
#            between machines with mixed endiannes
 
313
#            (regression test)
 
314
 
 
315
--echo **** Test for BUG#37076 ****
 
316
--echo **** On Master ****
 
317
connection master;
 
318
DROP TABLE IF EXISTS t1;
 
319
CREATE TABLE t1 (a TIMESTAMP, b DATETIME, c DATE);
 
320
INSERT INTO t1 VALUES(
 
321
  '2005-11-14 01:01:01', '2005-11-14 01:01:02', '2005-11-14');
 
322
 
 
323
--echo **** On Slave ****
 
324
sync_slave_with_master slave;
 
325
SELECT * FROM t1;
 
326
 
 
327
#
 
328
# cleanup
 
329
#
 
330
 
 
331
connection master;
 
332
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8;
 
333
sync_slave_with_master;
 
334
 
 
335
#
 
336
# BUG#37426: RBR breaks for CHAR() UTF8 fields > 85 chars
 
337
#
 
338
 
 
339
# We have 4 combinations to test with respect to the field length
 
340
# (i.e., the number of bytes) of the CHAR fields:
 
341
#
 
342
# 1. Replicating from CHAR<256 to CHAR<256 
 
343
# 2. Replicating from CHAR<256 to CHAR>255
 
344
# 3. Replicating from CHAR>255 to CHAR<256
 
345
# 4. Replicating from CHAR>255 to CHAR>255
 
346
 
 
347
# We also make a special case of using the max size of a field on the
 
348
# master, i.e. CHAR(255) in UTF-8, giving another three cases.
 
349
#
 
350
# 5. Replicating UTF-8 CHAR(255) to CHAR(<256)
 
351
# 6. Replicating UTF-8 CHAR(255) to CHAR(>255)
 
352
# 7. Replicating UTF-8 CHAR(255) to CHAR(255) UTF-8
 
353
 
 
354
connection master;
 
355
eval CREATE TABLE t1 (i INT NOT NULL,
 
356
                      c CHAR(16) CHARACTER SET utf8 NOT NULL,
 
357
                      j INT NOT NULL) ENGINE = $type ;
 
358
 
 
359
eval CREATE TABLE t2 (i INT NOT NULL,
 
360
                      c CHAR(16) CHARACTER SET utf8 NOT NULL,
 
361
                      j INT NOT NULL) ENGINE = $type ;
 
362
 
 
363
sync_slave_with_master;
 
364
ALTER TABLE t2 MODIFY c CHAR(128) CHARACTER SET utf8 NOT NULL;
 
365
 
 
366
connection master;
 
367
eval CREATE TABLE t3 (i INT NOT NULL,
 
368
                      c CHAR(128) CHARACTER SET utf8 NOT NULL,
 
369
                      j INT NOT NULL) ENGINE = $type ;
 
370
sync_slave_with_master;
 
371
ALTER TABLE t3 MODIFY c CHAR(16) CHARACTER SET utf8 NOT NULL;
 
372
 
 
373
connection master;
 
374
eval CREATE TABLE t4 (i INT NOT NULL,
 
375
                      c CHAR(128) CHARACTER SET utf8 NOT NULL,
 
376
                      j INT NOT NULL) ENGINE = $type ;
 
377
 
 
378
eval CREATE TABLE t5 (i INT NOT NULL,
 
379
                      c CHAR(255) CHARACTER SET utf8 NOT NULL,
 
380
                      j INT NOT NULL) ENGINE = $type ;
 
381
sync_slave_with_master;
 
382
ALTER TABLE t5 MODIFY c CHAR(16) CHARACTER SET utf8 NOT NULL;
 
383
 
 
384
connection master;
 
385
eval CREATE TABLE t6 (i INT NOT NULL,
 
386
                      c CHAR(255) CHARACTER SET utf8 NOT NULL,
 
387
                      j INT NOT NULL) ENGINE = $type ;
 
388
sync_slave_with_master;
 
389
ALTER TABLE t6 MODIFY c CHAR(128) CHARACTER SET utf8 NOT NULL;
 
390
 
 
391
connection master;
 
392
eval CREATE TABLE t7 (i INT NOT NULL,
 
393
                      c CHAR(255) CHARACTER SET utf8 NOT NULL,
 
394
                      j INT NOT NULL) ENGINE = $type ;
 
395
 
 
396
connection slave;
 
397
SET @saved_slave_type_conversions = @@slave_type_conversions;
 
398
SET GLOBAL SLAVE_TYPE_CONVERSIONS = 'ALL_NON_LOSSY';
 
399
 
 
400
--echo [expecting slave to replicate correctly]
 
401
connection master;
 
402
INSERT INTO t1 VALUES (1, "", 1);
 
403
INSERT INTO t1 VALUES (2, repeat(_utf8'a', 16), 2);
 
404
sync_slave_with_master;
 
405
 
 
406
let $diff_tables= master:t1, slave:t1;
 
407
source include/diff_tables.inc;
 
408
 
 
409
--echo [expecting slave to replicate correctly]
 
410
connection master;
 
411
INSERT INTO t2 VALUES (1, "", 1);
 
412
INSERT INTO t2 VALUES (2, repeat(_utf8'a', 16), 2);
 
413
sync_slave_with_master;
 
414
 
 
415
let $diff_tables= master:t2, slave:t2;
 
416
source include/diff_tables.inc;
 
417
 
 
418
connection slave;
 
419
SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
 
420
call mtr.add_suppression("Slave SQL.*Table definition on master and slave does not match: Column 1 size mismatch.* Error_code: 1535");
 
421
call mtr.add_suppression("Slave SQL.*Could not execute Delete_rows event on table test.t1.* Error_code: 1032");
 
422
call mtr.add_suppression("Slave SQL.*Column 1 of table .test.t.. cannot be converted from type.*, Error_code: 1677");
 
423
 
 
424
--let $rpl_only_running_threads= 1
 
425
--source include/rpl_reset.inc
 
426
 
 
427
--echo [expecting slave to replicate correctly]
 
428
connection master;
 
429
INSERT INTO t4 VALUES (1, "", 1);
 
430
INSERT INTO t4 VALUES (2, repeat(_utf8'a', 128), 2);
 
431
sync_slave_with_master;
 
432
 
 
433
let $diff_tables= master:t4, slave:t4;
 
434
source include/diff_tables.inc;
 
435
 
 
436
--echo [expecting slave to stop]
 
437
connection master;
 
438
INSERT INTO t5 VALUES (1, "", 1);
 
439
INSERT INTO t5 VALUES (2, repeat(_utf8'a', 255), 2);
 
440
 
 
441
connection slave;
 
442
# 1677 = ER_SLAVE_CONVERSION_FAILED 
 
443
--let $slave_sql_errno= 1677 
 
444
--let $show_slave_sql_error= 1
 
445
--source include/wait_for_slave_sql_error.inc
 
446
 
 
447
--source include/rpl_reset.inc
 
448
 
 
449
--echo [expecting slave to stop]
 
450
connection master;
 
451
INSERT INTO t6 VALUES (1, "", 1);
 
452
INSERT INTO t6 VALUES (2, repeat(_utf8'a', 255), 2);
 
453
 
 
454
connection slave;
 
455
# 1677 = ER_SLAVE_CONVERSION_FAILED 
 
456
--let $slave_sql_errno= 1677 
 
457
--let $show_slave_sql_error= 1
 
458
--source include/wait_for_slave_sql_error.inc
 
459
 
 
460
--source include/rpl_reset.inc
 
461
 
 
462
--echo [expecting slave to replicate correctly]
 
463
connection master;
 
464
INSERT INTO t7 VALUES (1, "", 1);
 
465
INSERT INTO t7 VALUES (2, repeat(_utf8'a', 255), 2);
 
466
sync_slave_with_master;
 
467
 
 
468
let $diff_tables= master:t7, slave:t7;
 
469
source include/diff_tables.inc;
 
470
 
 
471
connection master;
 
472
drop table t1, t2, t3, t4, t5, t6, t7;
 
473
sync_slave_with_master;
 
474
 
 
475
#
 
476
# BUG#32709: Assertion failed: trx_data->empty(), file .\log.cc, line 1293
 
477
#
 
478
 
 
479
connection master;
 
480
eval CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=$type;
 
481
 
 
482
INSERT INTO t1 VALUES (1), (2), (3);
 
483
--error ER_DUP_ENTRY
 
484
UPDATE t1 SET a = 10;
 
485
INSERT INTO t1 VALUES (4);
 
486
sync_slave_with_master;
 
487
 
 
488
let $diff_tables= master:t1, slave:t1;
 
489
source include/diff_tables.inc;
 
490
 
 
491
connection master;
 
492
drop table t1;
 
493
sync_slave_with_master;
 
494
 
 
495
#
 
496
# Bug #38230  Differences between master and slave after 
 
497
#             UPDATE or DELETE with LIMIT with pk
 
498
#
 
499
# the regression test verifies consistency via selecting
 
500
 
 
501
--disable_abort_on_error
 
502
 
 
503
--connection master
 
504
 
 
505
--disable_warnings
 
506
DROP TABLE IF EXISTS t1, t2;
 
507
--enable_warnings
 
508
 
 
509
eval CREATE TABLE t1 (
 
510
  `pk` int(11) NOT NULL AUTO_INCREMENT,
 
511
  `int_nokey` int(11) NOT NULL,
 
512
  `int_key` int(11) NOT NULL,
 
513
  `date_key` date NOT NULL,
 
514
  `date_nokey` date NOT NULL,
 
515
  `time_key` time NOT NULL,
 
516
  `time_nokey` time NOT NULL,
 
517
  `datetime_key` datetime NOT NULL,
 
518
  `datetime_nokey` datetime NOT NULL,
 
519
  `varchar_key` varchar(1) NOT NULL,
 
520
  `varchar_nokey` varchar(1) NOT NULL,
 
521
  PRIMARY KEY (`pk`),
 
522
  KEY `int_key` (`int_key`),
 
523
  KEY `date_key` (`date_key`),
 
524
  KEY `time_key` (`time_key`),
 
525
  KEY `datetime_key` (`datetime_key`),
 
526
  KEY `varchar_key` (`varchar_key`)
 
527
) ENGINE=$type;
 
528
 
 
529
INSERT INTO t1 VALUES (1,8,5,'0000-00-00','0000-00-00','10:37:38','10:37:38','0000-00-00 00:00:00','0000-00-00 00:00:00','p','p'),(2,0,9,'0000-00-00','0000-00-00','00:00:00','00:00:00','2007-10-14 00:00:00','2007-10-14 00:00:00','d','d');
 
530
 
 
531
eval CREATE TABLE t2 (
 
532
  `pk` int(11) NOT NULL AUTO_INCREMENT,
 
533
  `int_nokey` int(11) NOT NULL,
 
534
  `int_key` int(11) NOT NULL,
 
535
  `date_key` date NOT NULL,
 
536
  `date_nokey` date NOT NULL,
 
537
  `time_key` time NOT NULL,
 
538
  `time_nokey` time NOT NULL,
 
539
  `datetime_key` datetime NOT NULL,
 
540
  `datetime_nokey` datetime NOT NULL,
 
541
  `varchar_key` varchar(1) NOT NULL,
 
542
  `varchar_nokey` varchar(1) NOT NULL,
 
543
  PRIMARY KEY (`pk`),
 
544
  KEY `int_key` (`int_key`),
 
545
  KEY `date_key` (`date_key`),
 
546
  KEY `time_key` (`time_key`),
 
547
  KEY `datetime_key` (`datetime_key`),
 
548
  KEY `varchar_key` (`varchar_key`)
 
549
) ENGINE=$type;
 
550
 
 
551
INSERT INTO t2 VALUES (1,1,6,'2005-12-23','2005-12-23','02:24:28','02:24:28','0000-00-00 00:00:00','0000-00-00 00:00:00','g','g'),(2,0,3,'2009-09-14','2009-09-14','00:00:00','00:00:00','2000-01-30 16:39:40','2000-01-30 16:39:40','q','q'),(3,0,3,'0000-00-00','0000-00-00','00:00:00','00:00:00','0000-00-00 00:00:00','0000-00-00 00:00:00','c','c'),(4,1,6,'2007-03-29','2007-03-29','15:49:00','15:49:00','0000-00-00 00:00:00','0000-00-00 00:00:00','m','m'),(5,4,0,'2002-12-04','2002-12-04','00:00:00','00:00:00','0000-00-00 00:00:00','0000-00-00 00:00:00','o','o'),(6,9,0,'2005-01-28','2005-01-28','00:00:00','00:00:00','2001-05-18 00:00:00','2001-05-18 00:00:00','w','w'),(7,6,0,'0000-00-00','0000-00-00','06:57:25','06:57:25','0000-00-00 00:00:00','0000-00-00 00:00:00','m','m'),(8,0,0,'0000-00-00','0000-00-00','00:00:00','00:00:00','0000-00-00 00:00:00','0000-00-00 00:00:00','z','z'),(9,4,6,'2006-08-15','2006-08-15','00:00:00','00:00:00','2002-04-12 14:44:25','2002-04-12 14:44:25','j','j'),(10,0,5,'2006-12-20','2006-12-20','10:13:53','10:13:53','2008-07-22 00:00:00','2008-07-22 00:00:00','y','y'),(11,9,7,'0000-00-00','0000-00-00','00:00:00','00:00:00','2004-07-05 00:00:00','2004-07-05 00:00:00','{','{'),(12,4,3,'2007-01-26','2007-01-26','23:00:51','23:00:51','2001-05-16 00:00:00','2001-05-16 00:00:00','f','f'),(13,7,0,'2004-03-27','2004-03-27','00:00:00','00:00:00','2005-01-24 03:30:37','2005-01-24 03:30:37','',''),(14,6,0,'2006-07-26','2006-07-26','18:43:57','18:43:57','0000-00-00 00:00:00','0000-00-00 00:00:00','{','{'),(15,0,6,'2000-01-14','2000-01-14','00:00:00','00:00:00','2000-09-21 00:00:00','2000-09-21 00:00:00','o','o'),(16,9,8,'0000-00-00','0000-00-00','21:15:08','21:15:08','0000-00-00 00:00:00','0000-00-00 00:00:00','a','a'),(17,2,0,'2004-10-27','2004-10-27','00:00:00','00:00:00','2004-03-24 22:13:43','2004-03-24 22:13:43','',''),(18,7,4,'0000-00-00','0000-00-00','08:38:27','08:38:27','2002-03-18 19:51:44','2002-03-18 19:51:44','t','t'),(19,5,3,'2008-03-07','2008-03-07','03:29:07','03:29:07','2007-12-01 18:44:44','2007-12-01 18:44:44','t','t'),(20,0,0,'2002-04-09','2002-04-09','16:06:03','16:06:03','2009-04-22 00:00:00','2009-04-22 00:00:00','n','n');
 
552
 
 
553
DELETE FROM t2 WHERE `int_key` < 3 LIMIT 1;
 
554
UPDATE t1 SET `int_key` = 3 ORDER BY `pk` LIMIT 4;
 
555
DELETE FROM t2 WHERE `int_key` < 3 LIMIT 1;
 
556
DELETE FROM t2 WHERE `pk` < 6 LIMIT 1;
 
557
UPDATE t1 SET `int_key` = 6 ORDER BY `pk` LIMIT 3;
 
558
DELETE FROM t2 WHERE `pk` < 6 LIMIT 1;
 
559
UPDATE t1 SET `pk` = 6 ORDER BY `int_key` LIMIT 6;
 
560
DELETE FROM t2 WHERE `pk` < 7 LIMIT 1;
 
561
UPDATE t1 SET `int_key` = 4 ORDER BY `pk` LIMIT 6;
 
562
 
 
563
--sync_slave_with_master
 
564
--echo *** results: t2 must be consistent ****
 
565
 
 
566
let $diff_tables= master:t2, slave:t2;
 
567
source include/diff_tables.inc;
 
568
 
 
569
--connection master
 
570
DROP TABLE t1, t2;
 
571
 
 
572
--enable_abort_on_error
 
573
 
 
574
--echo EOF OF TESTS
 
575
 
 
576
#
 
577
# BUG#40004: Replication failure with no PK + no indexes
 
578
#
 
579
 
 
580
# The test cases are taken from the bug report. It is difficult to
 
581
# produce a test case that generates a HA_ERR_RECORD_DELETED, so we go
 
582
# with the test cases we have.
 
583
 
 
584
connection master;
 
585
 
 
586
eval CREATE TABLE t1 (a int) ENGINE=$type;
 
587
 
 
588
INSERT IGNORE INTO t1 VALUES (NULL);
 
589
INSERT INTO t1 ( a ) VALUES ( 0 );
 
590
INSERT INTO t1 ( a ) VALUES ( 9 );
 
591
INSERT INTO t1 ( a ) VALUES ( 2 );
 
592
INSERT INTO t1 ( a ) VALUES ( 9 );
 
593
INSERT INTO t1 ( a ) VALUES ( 5 );
 
594
 
 
595
UPDATE t1 SET a = 5 WHERE a = 9;
 
596
DELETE FROM t1 WHERE a < 6;
 
597
UPDATE t1 SET a = 9 WHERE a < 3;
 
598
INSERT INTO t1 ( a ) VALUES ( 3 );
 
599
UPDATE t1 SET a = 0 WHERE a < 4;
 
600
UPDATE t1 SET a = 8 WHERE a < 5;
 
601
 
 
602
sync_slave_with_master;
 
603
 
 
604
let $diff_tables= master:t1, slave:t1;
 
605
source include/diff_tables.inc;
 
606
 
 
607
connection master;
 
608
drop table t1;
 
609
sync_slave_with_master;
 
610
 
 
611
#
 
612
# Bug #39752: Replication failure on RBR + MyISAM + no PK
 
613
#
 
614
 
 
615
# The test cases are taken from the bug report. It is difficult to
 
616
# produce a test case that generates a HA_ERR_RECORD_DELETED, so we go
 
617
# with the test cases we have.
 
618
 
 
619
connection master;
 
620
 
 
621
# Since t1 contain a bit field, we have to do this trick to handle InnoDB
 
622
if (`select char_length('$bit_field_special') > 0`) {
 
623
  connection slave;
 
624
  SET @saved_slave_type_conversions = @@SLAVE_TYPE_CONVERSIONS;
 
625
  eval SET GLOBAL SLAVE_TYPE_CONVERSIONS = '$bit_field_special';
 
626
}
 
627
 
 
628
--disable_warnings
 
629
connection master;
 
630
eval CREATE TABLE t1 (a bit) ENGINE=$type;
 
631
INSERT IGNORE INTO t1 VALUES (NULL);
 
632
INSERT INTO t1 ( a ) VALUES ( 0 );
 
633
UPDATE t1 SET a = 0 WHERE a = 1 LIMIT 3;
 
634
INSERT INTO t1 ( a ) VALUES ( 5 );
 
635
DELETE FROM t1 WHERE a < 2 LIMIT 4;
 
636
DELETE FROM t1 WHERE a < 9 LIMIT 4;
 
637
INSERT INTO t1 ( a ) VALUES ( 9 );
 
638
UPDATE t1 SET a = 8 WHERE a = 0 LIMIT 6;
 
639
INSERT INTO t1 ( a ) VALUES ( 8 );
 
640
UPDATE t1 SET a = 0 WHERE a < 6 LIMIT 0;
 
641
INSERT INTO t1 ( a ) VALUES ( 4 );
 
642
INSERT INTO t1 ( a ) VALUES ( 3 );
 
643
UPDATE t1 SET a = 0 WHERE a = 7 LIMIT 6;
 
644
DELETE FROM t1 WHERE a = 4 LIMIT 7;
 
645
UPDATE t1 SET a = 9 WHERE a < 2 LIMIT 9;
 
646
UPDATE t1 SET a = 0 WHERE a < 9 LIMIT 2;
 
647
DELETE FROM t1 WHERE a < 0 LIMIT 5;
 
648
INSERT INTO t1 ( a ) VALUES ( 5 );
 
649
UPDATE t1 SET a = 4 WHERE a < 6 LIMIT 4;
 
650
INSERT INTO t1 ( a ) VALUES ( 5 );
 
651
UPDATE t1 SET a = 9 WHERE a < 5 LIMIT 8;
 
652
DELETE FROM t1 WHERE a < 8 LIMIT 8;
 
653
INSERT INTO t1 ( a ) VALUES ( 6 );
 
654
DELETE FROM t1 WHERE a < 6 LIMIT 7;
 
655
UPDATE t1 SET a = 7 WHERE a = 3 LIMIT 7;
 
656
UPDATE t1 SET a = 8 WHERE a = 0 LIMIT 6;
 
657
INSERT INTO t1 ( a ) VALUES ( 7 );
 
658
DELETE FROM t1 WHERE a < 9 LIMIT 4;
 
659
INSERT INTO t1 ( a ) VALUES ( 7 );
 
660
INSERT INTO t1 ( a ) VALUES ( 6 );
 
661
UPDATE t1 SET a = 8 WHERE a = 3 LIMIT 4;
 
662
DELETE FROM t1 WHERE a = 2 LIMIT 9;
 
663
DELETE FROM t1 WHERE a = 1 LIMIT 4;
 
664
UPDATE t1 SET a = 4 WHERE a = 2 LIMIT 7;
 
665
INSERT INTO t1 ( a ) VALUES ( 0 );
 
666
DELETE FROM t1 WHERE a < 3 LIMIT 0;
 
667
UPDATE t1 SET a = 8 WHERE a = 5 LIMIT 2;
 
668
INSERT INTO t1 ( a ) VALUES ( 1 );
 
669
UPDATE t1 SET a = 9 WHERE a < 5 LIMIT 3;
 
670
--enable_warnings
 
671
 
 
672
sync_slave_with_master;
 
673
 
 
674
if (`select char_length('$bit_field_special') > 0`) {
 
675
  SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
 
676
}
 
677
 
 
678
let $diff_tables= master:t1, slave:t1;
 
679
source include/diff_tables.inc;
 
680
 
 
681
connection master;
 
682
drop table t1;
 
683
sync_slave_with_master;