mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
BUG#39393 slave-skip-errors does not work when using ROW based replication
RBR was not considering the option --slave-skip-errors.
To fix the problem, we are reporting the ignored ERROR(s) as warnings thus avoiding
stopping the SQL Thread. Besides, it fixes the output of "SHOW VARIABLES LIKE
'slave_skip_errors'" which was showing nothing when the value "all" was assigned
to --slave-skip-errors.
@sql/log_event.cc
skipped rbr errors when the option skip-slave-errors is set.
@sql/slave.cc
fixed the output of for SHOW VARIABLES LIKE 'slave_skip_errors'"
@test-cases
fixed the output of rpl.rpl_idempotency
updated the test case rpl_skip_error
This commit is contained in:
@@ -8,18 +8,23 @@
|
||||
# ==== Method ====
|
||||
#
|
||||
# We run the slave with --slave-skip-errors=1062 (the code for
|
||||
# duplicate key). On slave, we insert value 1 in a table, and then,
|
||||
# on master, we insert value 1 in the table. The error should be
|
||||
# ignored on slave.
|
||||
#
|
||||
# duplicate key). Then we have two set of tests. In the first
|
||||
# set, we insert value 1 in a table on the slave, and then, on
|
||||
# master, we insert value 1 in the table. In the second set, we
|
||||
# insert several values on the master, disable the binlog and
|
||||
# delete one of the values and re-enable the binlog. Right after,
|
||||
# we perform an update on the set of values in order to generate
|
||||
# a duplicate key on the slave. The errors should be ignored on
|
||||
# the slave.
|
||||
#
|
||||
# ==== Related bugs ====
|
||||
#
|
||||
# BUG#28839: Errors in strict mode silently stop SQL thread if --slave-skip-errors exists
|
||||
# bug in this test: BUG#30594: rpl.rpl_skip_error is nondeterministic
|
||||
# bug in this test: BUG#30594: rpl.rpl_skip_error is nondeterministic:
|
||||
# BUG#39393: slave-skip-errors does not work when using ROW based replication
|
||||
|
||||
source include/master-slave.inc;
|
||||
source include/have_binlog_format_statement.inc;
|
||||
|
||||
source include/have_innodb.inc;
|
||||
|
||||
--echo ==== Test Without sql_mode=strict_trans_tables ====
|
||||
|
||||
@@ -64,9 +69,11 @@ sync_slave_with_master;
|
||||
connection master;
|
||||
create table t1(a int primary key);
|
||||
insert into t1 values (1),(2);
|
||||
delete from t1 where @@server_id=1;
|
||||
SET SQL_LOG_BIN=0;
|
||||
delete from t1;
|
||||
SET SQL_LOG_BIN=1;
|
||||
set sql_mode=strict_trans_tables;
|
||||
insert into t1 values (7), (8), (9);
|
||||
insert into t1 values (1), (2), (3);
|
||||
|
||||
--echo [on slave]
|
||||
sync_slave_with_master;
|
||||
@@ -80,3 +87,93 @@ connection master;
|
||||
drop table t1;
|
||||
sync_slave_with_master;
|
||||
# End of 5.0 tests
|
||||
|
||||
#
|
||||
# BUG#39393: slave-skip-errors does not work when using ROW based replication
|
||||
#
|
||||
--echo ==== Using Innodb ====
|
||||
|
||||
connection master;
|
||||
|
||||
SET SQL_LOG_BIN=0;
|
||||
CREATE TABLE t1(id INT NOT NULL PRIMARY KEY, data INT) Engine=InnoDB;
|
||||
SHOW CREATE TABLE t1;
|
||||
SET SQL_LOG_BIN=1;
|
||||
|
||||
connection slave;
|
||||
|
||||
CREATE TABLE t1(id INT NOT NULL PRIMARY KEY, data INT) Engine=InnoDB;
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
connection master;
|
||||
|
||||
INSERT INTO t1 VALUES(1, 1);
|
||||
INSERT INTO t1 VALUES(2, 1);
|
||||
INSERT INTO t1 VALUES(3, 1);
|
||||
INSERT INTO t1 VALUES(4, 1);
|
||||
|
||||
SET SQL_LOG_BIN=0;
|
||||
DELETE FROM t1 WHERE id = 4;
|
||||
SET SQL_LOG_BIN=1;
|
||||
UPDATE t1 SET id= id + 3, data = 2;
|
||||
|
||||
sync_slave_with_master;
|
||||
|
||||
let $error= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
|
||||
echo $error;
|
||||
|
||||
connection slave;
|
||||
|
||||
SELECT *, "INNODB SET SLAVE DATA" FROM t1 ORDER BY id;
|
||||
|
||||
connection master;
|
||||
|
||||
SELECT *, "INNODB SET MASTER DATA" FROM t1 ORDER BY id;
|
||||
|
||||
--echo ==== Using MyIsam ====
|
||||
|
||||
connection master;
|
||||
|
||||
SET SQL_LOG_BIN=0;
|
||||
CREATE TABLE t2(id INT NOT NULL PRIMARY KEY, data INT) Engine=MyIsam;
|
||||
SHOW CREATE TABLE t2;
|
||||
SET SQL_LOG_BIN=1;
|
||||
|
||||
connection slave;
|
||||
|
||||
CREATE TABLE t2(id INT NOT NULL PRIMARY KEY, data INT) Engine=MyIsam;
|
||||
SHOW CREATE TABLE t2;
|
||||
|
||||
connection master;
|
||||
|
||||
INSERT INTO t2 VALUES(1, 1);
|
||||
INSERT INTO t2 VALUES(2, 1);
|
||||
INSERT INTO t2 VALUES(3, 1);
|
||||
INSERT INTO t2 VALUES(5, 1);
|
||||
|
||||
SET SQL_LOG_BIN=0;
|
||||
DELETE FROM t2 WHERE id = 5;
|
||||
SET SQL_LOG_BIN=1;
|
||||
UPDATE t2 SET id= id + 3, data = 2;
|
||||
|
||||
sync_slave_with_master;
|
||||
|
||||
let $error= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
|
||||
echo $error;
|
||||
|
||||
connection slave;
|
||||
|
||||
SELECT *, "MYISAM SET SLAVE DATA" FROM t2 ORDER BY id;
|
||||
|
||||
connection master;
|
||||
|
||||
SELECT *, "MYISAM SET MASTER DATA" FROM t2 ORDER BY id;
|
||||
|
||||
--echo ==== Clean Up ====
|
||||
|
||||
connection master;
|
||||
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
|
||||
sync_slave_with_master;
|
||||
|
||||
Reference in New Issue
Block a user