2
# Basic tests of row-level logging
6
# First we test tables with only an index.
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
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);
19
eval CREATE TABLE t1 (C1 CHAR(1), C2 CHAR(1), INDEX (C1)$extra_index_t1) ENGINE = $type ;
21
sync_slave_with_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;
33
# Observe that are several rows having the value for the index but only one
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;
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.
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;
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
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);
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
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
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
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
78
# Testing update with a condition that does not match any rows, but
79
# which has a match for the index.
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;
87
# Testing table with primary key
90
eval CREATE TABLE t2 (c1 INT, c12 char(1), c2 INT, PRIMARY KEY (c1)) ENGINE = $type ;
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;
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;
106
# Testing update with a condition that does not match any rows, but
107
# which has a match for the primary key.
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;
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;
121
UPDATE t2 SET c12='X';
124
# Testing table with a multi-column primary key.
127
eval CREATE TABLE t3 (C1 CHAR(1), C2 CHAR(1), pk1 INT, C3 CHAR(1), pk2 INT, PRIMARY KEY (pk1,pk2)) ENGINE = $type ;
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;
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;
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;
148
# Testing table without index or primary key
151
eval CREATE TABLE t6 (C1 CHAR(1), C2 CHAR(1), C3 INT$extra_index_t6) ENGINE = $type;
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;
161
# Observe that are several rows having the value for the index but only one
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;
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.
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;
180
# now mixing the 3 tables without begin/commit
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);
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;
192
# Testing special column types
195
if (`select char_length('$bit_field_special') > 0`) {
197
SET @saved_slave_type_conversions = @@SLAVE_TYPE_CONVERSIONS;
198
eval SET GLOBAL SLAVE_TYPE_CONVERSIONS = '$bit_field_special';
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 ;
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;
209
if (`select char_length('$bit_field_special') > 0`) {
210
SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
214
# Testing conflicting operations
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;
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
226
set @@global.slave_exec_mode= 'IDEMPOTENT';
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;
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;
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".
243
--echo --- on master ---
244
eval CREATE TABLE t8 (a INT PRIMARY KEY, b INT UNIQUE, c INT UNIQUE) ENGINE = $type ;
246
# First we make sure that the constraints are correctly set.
247
INSERT INTO t8 VALUES (99,99,99);
249
INSERT INTO t8 VALUES (99,22,33);
251
INSERT INTO t8 VALUES (11,99,33);
253
INSERT INTO t8 VALUES (11,22,99);
254
SELECT * FROM t8 ORDER BY a;
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;
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
265
set @@global.slave_exec_mode= 'IDEMPOTENT';
268
--echo --- on master ---
269
# We insert a row that will cause conflict on the primary key but not
271
INSERT INTO t8 VALUES (2,4,8);
272
sync_slave_with_master;
273
set @@global.slave_exec_mode= default;
275
--echo --- on slave ---
276
SELECT * FROM t8 ORDER BY a;
278
# BUG#31552: Replication breaks when deleting rows from out-of-sync
281
--echo **** Test for BUG#31552 ****
283
--echo **** On Master ****
284
# Clean up t1 so that we can use it.
287
sync_slave_with_master;
289
# Just to get a clean binary log
290
--source include/rpl_reset.inc
292
--echo **** On 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
300
set @@global.slave_exec_mode= 'IDEMPOTENT';
301
DELETE FROM t1 WHERE C1 = 'L';
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;
311
# BUG#37076: TIMESTAMP/DATETIME values are not replicated correctly
312
# between machines with mixed endiannes
315
--echo **** Test for BUG#37076 ****
316
--echo **** On 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');
323
--echo **** On Slave ****
324
sync_slave_with_master slave;
332
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8;
333
sync_slave_with_master;
336
# BUG#37426: RBR breaks for CHAR() UTF8 fields > 85 chars
339
# We have 4 combinations to test with respect to the field length
340
# (i.e., the number of bytes) of the CHAR fields:
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
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.
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
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 ;
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 ;
363
sync_slave_with_master;
364
ALTER TABLE t2 MODIFY c CHAR(128) CHARACTER SET utf8 NOT NULL;
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;
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 ;
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;
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;
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 ;
397
SET @saved_slave_type_conversions = @@slave_type_conversions;
398
SET GLOBAL SLAVE_TYPE_CONVERSIONS = 'ALL_NON_LOSSY';
400
--echo [expecting slave to replicate correctly]
402
INSERT INTO t1 VALUES (1, "", 1);
403
INSERT INTO t1 VALUES (2, repeat(_utf8'a', 16), 2);
404
sync_slave_with_master;
406
let $diff_tables= master:t1, slave:t1;
407
source include/diff_tables.inc;
409
--echo [expecting slave to replicate correctly]
411
INSERT INTO t2 VALUES (1, "", 1);
412
INSERT INTO t2 VALUES (2, repeat(_utf8'a', 16), 2);
413
sync_slave_with_master;
415
let $diff_tables= master:t2, slave:t2;
416
source include/diff_tables.inc;
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");
424
--let $rpl_only_running_threads= 1
425
--source include/rpl_reset.inc
427
--echo [expecting slave to replicate correctly]
429
INSERT INTO t4 VALUES (1, "", 1);
430
INSERT INTO t4 VALUES (2, repeat(_utf8'a', 128), 2);
431
sync_slave_with_master;
433
let $diff_tables= master:t4, slave:t4;
434
source include/diff_tables.inc;
436
--echo [expecting slave to stop]
438
INSERT INTO t5 VALUES (1, "", 1);
439
INSERT INTO t5 VALUES (2, repeat(_utf8'a', 255), 2);
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
447
--source include/rpl_reset.inc
449
--echo [expecting slave to stop]
451
INSERT INTO t6 VALUES (1, "", 1);
452
INSERT INTO t6 VALUES (2, repeat(_utf8'a', 255), 2);
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
460
--source include/rpl_reset.inc
462
--echo [expecting slave to replicate correctly]
464
INSERT INTO t7 VALUES (1, "", 1);
465
INSERT INTO t7 VALUES (2, repeat(_utf8'a', 255), 2);
466
sync_slave_with_master;
468
let $diff_tables= master:t7, slave:t7;
469
source include/diff_tables.inc;
472
drop table t1, t2, t3, t4, t5, t6, t7;
473
sync_slave_with_master;
476
# BUG#32709: Assertion failed: trx_data->empty(), file .\log.cc, line 1293
480
eval CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=$type;
482
INSERT INTO t1 VALUES (1), (2), (3);
484
UPDATE t1 SET a = 10;
485
INSERT INTO t1 VALUES (4);
486
sync_slave_with_master;
488
let $diff_tables= master:t1, slave:t1;
489
source include/diff_tables.inc;
493
sync_slave_with_master;
496
# Bug #38230 Differences between master and slave after
497
# UPDATE or DELETE with LIMIT with pk
499
# the regression test verifies consistency via selecting
501
--disable_abort_on_error
506
DROP TABLE IF EXISTS t1, t2;
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,
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`)
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');
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,
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`)
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');
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;
563
--sync_slave_with_master
564
--echo *** results: t2 must be consistent ****
566
let $diff_tables= master:t2, slave:t2;
567
source include/diff_tables.inc;
572
--enable_abort_on_error
577
# BUG#40004: Replication failure with no PK + no indexes
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.
586
eval CREATE TABLE t1 (a int) ENGINE=$type;
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 );
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;
602
sync_slave_with_master;
604
let $diff_tables= master:t1, slave:t1;
605
source include/diff_tables.inc;
609
sync_slave_with_master;
612
# Bug #39752: Replication failure on RBR + MyISAM + no PK
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.
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`) {
624
SET @saved_slave_type_conversions = @@SLAVE_TYPE_CONVERSIONS;
625
eval SET GLOBAL SLAVE_TYPE_CONVERSIONS = '$bit_field_special';
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;
672
sync_slave_with_master;
674
if (`select char_length('$bit_field_special') > 0`) {
675
SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
678
let $diff_tables= master:t1, slave:t1;
679
source include/diff_tables.inc;
683
sync_slave_with_master;