2008-03-07 13:59:36 +01:00
|
|
|
# ==== Purpose ====
|
|
|
|
#
|
|
|
|
# Verify that --slave-skip-errors works correctly. The error messages
|
|
|
|
# specified by --slave-skip-errors on slave should be ignored. If
|
|
|
|
# such errors occur, they should not be reported and not cause the
|
|
|
|
# slave to stop.
|
|
|
|
#
|
|
|
|
# ==== 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.
|
|
|
|
#
|
|
|
|
# ==== 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
|
|
|
|
|
2001-12-12 18:55:33 -07:00
|
|
|
source include/master-slave.inc;
|
2008-03-14 17:52:57 +01:00
|
|
|
source include/have_binlog_format_statement.inc;
|
2007-10-22 21:45:21 +03:00
|
|
|
|
2002-08-08 03:12:02 +03:00
|
|
|
|
2008-03-07 13:59:36 +01:00
|
|
|
--echo ==== Test Without sql_mode=strict_trans_tables ====
|
|
|
|
|
|
|
|
--echo [on master]
|
2001-12-12 18:55:33 -07:00
|
|
|
create table t1 (n int not null primary key);
|
2008-03-07 13:59:36 +01:00
|
|
|
|
|
|
|
--echo [on slave]
|
|
|
|
sync_slave_with_master;
|
2001-12-12 18:55:33 -07:00
|
|
|
insert into t1 values (1);
|
2008-03-07 13:59:36 +01:00
|
|
|
|
|
|
|
--echo [on master]
|
2001-12-12 18:55:33 -07:00
|
|
|
connection master;
|
2006-02-13 19:03:12 +01:00
|
|
|
# Here we expect (ignored) error, since 1 is already in slave table
|
2001-12-12 18:55:33 -07:00
|
|
|
insert into t1 values (1);
|
2006-02-13 19:03:12 +01:00
|
|
|
# These should work fine
|
2001-12-12 18:55:33 -07:00
|
|
|
insert into t1 values (2),(3);
|
2006-02-13 19:03:12 +01:00
|
|
|
|
2008-03-14 17:52:57 +01:00
|
|
|
sync_slave_with_master;
|
|
|
|
--echo [on slave]
|
|
|
|
select * from t1 order by n;
|
|
|
|
|
|
|
|
--echo ==== Test With sql_mode=strict_trans_tables ====
|
|
|
|
insert into t1 values (7),(8);
|
|
|
|
--echo [on master]
|
|
|
|
connection master;
|
|
|
|
set sql_mode=strict_trans_tables;
|
|
|
|
insert into t1 values (7), (8), (9);
|
|
|
|
--echo [on slave]
|
|
|
|
sync_slave_with_master;
|
|
|
|
select * from t1 order by n;
|
|
|
|
source include/show_slave_status2.inc;
|
2007-06-20 14:05:49 +05:00
|
|
|
|
2008-03-14 17:52:57 +01:00
|
|
|
--echo ==== Clean Up ====
|
2008-03-12 13:07:35 +01:00
|
|
|
connection master;
|
|
|
|
drop table t1;
|
|
|
|
sync_slave_with_master;
|
|
|
|
# End of 4.1 tests
|
2008-03-07 13:59:36 +01:00
|
|
|
|
2008-03-12 13:07:35 +01:00
|
|
|
#
|
|
|
|
# #28839 Errors in strict mode silently stop SQL thread if --slave-skip-errors exists
|
|
|
|
#
|
2007-06-21 11:48:01 +05:00
|
|
|
connection master;
|
2008-03-12 13:07:35 +01:00
|
|
|
create table t1(a int primary key);
|
|
|
|
insert into t1 values (1),(2);
|
|
|
|
delete from t1 where @@server_id=1;
|
2007-06-20 14:05:49 +05:00
|
|
|
set sql_mode=strict_trans_tables;
|
2008-03-07 13:59:36 +01:00
|
|
|
insert into t1 values (7), (8), (9);
|
|
|
|
|
|
|
|
--echo [on slave]
|
2007-06-20 14:05:49 +05:00
|
|
|
sync_slave_with_master;
|
|
|
|
select * from t1;
|
2008-01-14 15:38:02 +08:00
|
|
|
source include/show_slave_status2.inc;
|
2008-03-07 13:59:36 +01:00
|
|
|
|
|
|
|
|
|
|
|
--echo ==== Clean Up ====
|
|
|
|
|
2007-06-20 14:05:49 +05:00
|
|
|
connection master;
|
|
|
|
drop table t1;
|
2008-03-07 13:59:36 +01:00
|
|
|
sync_slave_with_master;
|
2007-06-20 14:05:49 +05:00
|
|
|
# End of 5.0 tests
|