Skip to content
/ server Public
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions mysql-test/suite/rpl/include/check_slave_skip_errors.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# ==== Purpose ====
#
# MDEV-38624: Verify that ER_CONNECTION_KILLED (1927) cannot be added to
# --slave-skip-errors, even when explicitly specified or when using "all".
#
# Called from tests that configure --slave-skip-errors with 1927 or "all".
# Checks that 1927 is absent from slave_skip_errors and that the expected
# warning appears in the slave error log.

--connection slave
call mtr.add_suppression("Slave: ER_CONNECTION_KILLED .* is not allowed in --slave-skip-errors");

--let $skip_errors= query_get_value(SHOW VARIABLES LIKE 'slave_skip_errors', Value, 1)
if (`SELECT '$skip_errors' LIKE '%1927%'`)
{
--die MDEV-38624: Error 1927 must not be added to slave_skip_errors
}

--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.2.err
--let $assert_select= ER_CONNECTION_KILLED .* is not allowed in --slave-skip-errors
--let $assert_count= 1
--let $assert_text= Warning about ER_CONNECTION_KILLED should appear in error log
--source include/assert_grep.inc
3 changes: 3 additions & 0 deletions mysql-test/suite/rpl/r/rpl_skip_error.result
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
include/master-slave.inc
[connection master]
connection slave;
call mtr.add_suppression("Slave: ER_CONNECTION_KILLED .* is not allowed in --slave-skip-errors");
include/assert_grep.inc [Warning about ER_CONNECTION_KILLED should appear in error log]
connection slave;
connection master;
==== Test Without sql_mode=strict_trans_tables ====
create table t1 (n int not null primary key);
Expand Down
3 changes: 3 additions & 0 deletions mysql-test/suite/rpl/r/rpl_temporary_error2_skip_all.result
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
include/master-slave.inc
[connection master]
connection slave;
call mtr.add_suppression("Slave: ER_CONNECTION_KILLED .* is not allowed in --slave-skip-errors");
include/assert_grep.inc [Warning about ER_CONNECTION_KILLED should appear in error log]
call mtr.add_suppression("Deadlock found when trying to get lock; try restarting transaction");
*** Provoke a deadlock on the slave, check that transaction retry succeeds. ***
connection master;
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/suite/rpl/t/rpl_skip_error-slave.opt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
--slave-skip-errors=1062
--slave-skip-errors=1062,1927
2 changes: 2 additions & 0 deletions mysql-test/suite/rpl/t/rpl_skip_error.test
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@
# 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#39393: slave-skip-errors does not work when using ROW based replication
# BUG#38624: ER_CONNECTION_KILLED must not be skippable via --slave-skip-errors

source include/have_innodb.inc;
source include/master-slave.inc;
--source include/check_slave_skip_errors.inc

--connection slave
let $initial_skipped_error= query_get_value(show global status like "Slave_skipped_errors", Value, 1);
Expand Down
5 changes: 5 additions & 0 deletions mysql-test/suite/rpl/t/rpl_temporary_error2.test
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
--source include/have_innodb.inc
--source include/master-slave.inc

if ($check_mdev_38624)
{
--source include/check_slave_skip_errors.inc
}

call mtr.add_suppression("Deadlock found when trying to get lock; try restarting transaction");
--disable_query_log
call mtr.add_suppression("InnoDB: Transaction was aborted due to ");
Expand Down
1 change: 1 addition & 0 deletions mysql-test/suite/rpl/t/rpl_temporary_error2_skip_all.test
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
--source include/have_binlog_format_row.inc
--let $ignored_db_deadlock= 1
--let $check_mdev_38624= 1
--source rpl_temporary_error2.test
17 changes: 16 additions & 1 deletion sql/slave.cc
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,10 @@ bool init_slave_skip_errors(const char* arg)
if (!system_charset_info->strnncoll((uchar*)arg,4,(const uchar*)"all",4))
{
bitmap_set_all(&slave_error_mask);
bitmap_clear_bit(&slave_error_mask,ER_CONNECTION_KILLED);
sql_print_warning("Slave: ER_CONNECTION_KILLED (%d) is not allowed in "
"--slave-skip-errors=all. This error will never be skipped "
"by the slave.", ER_CONNECTION_KILLED);
goto end;
}
for (p= arg ; *p; )
Expand All @@ -803,7 +807,18 @@ bool init_slave_skip_errors(const char* arg)
if (!(p= str2int(p, 10, 0, LONG_MAX, &err_code)))
break;
if (err_code < MAX_SLAVE_ERROR)
bitmap_set_bit(&slave_error_mask,(uint)err_code);
{
if (err_code == ER_CONNECTION_KILLED)
{
sql_print_warning("Slave: ER_CONNECTION_KILLED (%d) is not allowed in "
"--slave-skip-errors. This error will never be skipped "
"by the slave.", ER_CONNECTION_KILLED);
}
else
{
bitmap_set_bit(&slave_error_mask,(uint)err_code);
}
}
while (!my_isdigit(system_charset_info,*p) && *p)
p++;
}
Expand Down