| 1 |
# ==== Purpose ==== |
| 2 |
# |
| 3 |
# Verify that --replica-skip-errors works correctly. The error messages |
| 4 |
# specified by --replica-skip-errors on slave should be ignored. If |
| 5 |
# such errors occur, they should not be reported and not cause the |
| 6 |
# slave to stop. |
| 7 |
# |
| 8 |
# ==== Method ==== |
| 9 |
# |
| 10 |
# We run the slave with --replica-skip-errors=1062 (the code for |
| 11 |
# duplicate key). Then we have two set of tests. In the first |
| 12 |
# set, we insert value 1 in a table on the slave, and then, on |
| 13 |
# master, we insert value 1 in the table. In the second set, we |
| 14 |
# insert several values on the master, disable the binlog and |
| 15 |
# delete one of the values and re-enable the binlog. Right after, |
| 16 |
# we perform an update on the set of values in order to generate |
| 17 |
# a duplicate key on the slave. The errors should be ignored on |
| 18 |
# the slave. |
| 19 |
# |
| 20 |
# ==== Related bugs ==== |
| 21 |
# |
| 22 |
# BUG#28839: Errors in strict mode silently stop SQL thread if --replica-skip-errors exists |
| 23 |
# bug in this test: BUG#30594: rpl.rpl_skip_error is nondeterministic: |
| 24 |
# BUG#39393: replica-skip-errors does not work when using ROW based replication |
| 25 |
|
| 26 |
--source include/not_group_replication_plugin.inc |
| 27 |
source include/force_myisam_default.inc; |
| 28 |
source include/have_myisam.inc; |
| 29 |
source include/master-slave.inc; |
| 30 |
|
| 31 |
--source include/sync_slave_sql_with_master.inc |
| 32 |
# End of 5.0 tests |
| 33 |
|
| 34 |
# |
| 35 |
# BUG#39393: replica-skip-errors does not work when using ROW based replication |
| 36 |
# |
| 37 |
|
| 38 |
--echo ==== Using MyIsam ==== |
| 39 |
|
| 40 |
connection master; |
| 41 |
|
| 42 |
SET SQL_LOG_BIN=0; |
| 43 |
CREATE TABLE t2(id INT NOT NULL PRIMARY KEY, data INT) Engine=MyIsam; |
| 44 |
SHOW CREATE TABLE t2; |
| 45 |
SET SQL_LOG_BIN=1; |
| 46 |
|
| 47 |
connection slave; |
| 48 |
|
| 49 |
CREATE TABLE t2(id INT NOT NULL PRIMARY KEY, data INT) Engine=MyIsam; |
| 50 |
SHOW CREATE TABLE t2; |
| 51 |
|
| 52 |
connection master; |
| 53 |
|
| 54 |
INSERT INTO t2 VALUES(1, 1); |
| 55 |
INSERT INTO t2 VALUES(2, 1); |
| 56 |
INSERT INTO t2 VALUES(3, 1); |
| 57 |
INSERT INTO t2 VALUES(5, 1); |
| 58 |
|
| 59 |
SET SQL_LOG_BIN=0; |
| 60 |
DELETE FROM t2 WHERE id = 5; |
| 61 |
SET SQL_LOG_BIN=1; |
| 62 |
UPDATE t2 SET id= id + 3, data = 2; |
| 63 |
|
| 64 |
--source include/sync_slave_sql_with_master.inc |
| 65 |
|
| 66 |
let $error= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1); |
| 67 |
echo $error; |
| 68 |
|
| 69 |
--echo **** We cannot execute a select as there are differences in the |
| 70 |
--echo **** behavior between STMT and RBR. |
| 71 |
|
| 72 |
--echo ==== Clean Up ==== |
| 73 |
|
| 74 |
connection master; |
| 75 |
|
| 76 |
DROP TABLE t2; |
| 77 |
|
| 78 |
--source include/sync_slave_sql_with_master.inc |
| 79 |
--source include/rpl_end.inc |