Skip to content

Commit

Permalink
MDEV-32168: slave_error_param condition is never checked from the wai…
Browse files Browse the repository at this point in the history
…t_for_slave_param.inc

- Reviewer: <knielsen@knielsen-hq.org>
            <brandon.nesterenko@mariadb.com>
            <andrei.elkin@mariadb.com>
  • Loading branch information
an3l committed Nov 16, 2023
1 parent d4be70a commit a7d186a
Show file tree
Hide file tree
Showing 50 changed files with 142 additions and 71 deletions.
2 changes: 1 addition & 1 deletion mysql-test/include/wait_for_slave_io_error.inc
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ let $_wfsie_errno= query_get_value(SHOW SLAVE STATUS, Last_IO_Errno, 1);

if ($slave_io_errno == '') {
--echo !!!ERROR IN TEST: you must set \$slave_io_errno before you source
--echo !!!wait_for_slave_sql_error.inc. The error we got this time was '$_wfsie_errno',
--echo !!!wait_for_slave_io_error.inc. The error we got this time was '$_wfsie_errno',
--echo !!!so you probably want to add the following line to your test case:
--echo !!! --let \$slave_io_errno= $_wfsie_errno
--die !!!ERROR IN TEST: you must set \$slave_io_errno before sourcing wait_for_slave_io_error.inc
Expand Down
7 changes: 1 addition & 6 deletions mysql-test/include/wait_for_slave_param.inc
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,6 @@ if (!$_slave_timeout)
}
}

if ($slave_error_param == '')
{
--let $slave_error_param= 1
}

let $_slave_param_comparison= $slave_param_comparison;
if (!$_slave_param_comparison)
{
Expand Down Expand Up @@ -90,7 +85,7 @@ while ($_slave_continue)
--let $_show_slave_status_value= query_get_value("SHOW SLAVE STATUS", $slave_param, 1)

# Check if an error condition is reached.
if (!$slave_error_param)
if ($slave_error_param)
{
--let $_show_slave_status_error_value= query_get_value("SHOW SLAVE STATUS", $slave_error_param, 1)
if ($_show_slave_status_error_value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ start slave;
SHOW TABLES;

--disable_connect_log
# IO thread is stopped, stop SQL thread only
--let $rpl_only_running_threads= 1
--source include/stop_slave.inc
--enable_connect_log
reset slave;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ if (`SELECT strcmp("$gsp","")`)
SHOW TABLES;

--disable_connect_log
# IO thread is stopped, wait for SQL thread to be stopped
--let $rpl_only_running_threads= 1
--source include/stop_slave.inc
--enable_connect_log
reset slave;
Expand Down
1 change: 0 additions & 1 deletion mysql-test/suite/binlog_encryption/rpl_parallel.result
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,6 @@ connection con2;
SET debug_sync='RESET';
connection server_2;
include/wait_for_slave_sql_error.inc [errno=1062]
include/wait_for_slave_sql_to_stop.inc
SELECT * FROM t3 WHERE a >= 110 ORDER BY a;
a b
110 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ connection server_2;
connection con_temp2;
COMMIT;
connection server_2;
include/wait_for_slave_sql_error.inc [errno=1062]
include/stop_slave.inc
include/assert.inc [table t1 should have zero rows where a>32]
SELECT * FROM t1 WHERE a>32;
Expand Down
3 changes: 2 additions & 1 deletion mysql-test/suite/multi_source/gtid_slave_pos.result
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,9 @@ set default_master_connection = 'slave1';
STOP SLAVE;
include/wait_for_slave_to_stop.inc
set default_master_connection = 'slave2';
include/wait_for_slave_sql_error.inc [errno=1942]
STOP SLAVE;
include/wait_for_slave_to_stop.inc
include/stop_slave.inc
set default_master_connection = 'slave1';
START SLAVE;
include/wait_for_slave_to_start.inc
Expand Down
5 changes: 4 additions & 1 deletion mysql-test/suite/multi_source/gtid_slave_pos.test
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,11 @@ set default_master_connection = 'slave1';
STOP SLAVE;
--source include/wait_for_slave_to_stop.inc
set default_master_connection = 'slave2';
--let $slave_sql_errno= 1942
--source include/wait_for_slave_sql_error.inc
STOP SLAVE;
--source include/wait_for_slave_to_stop.inc
--let $rpl_only_running_threads= 1
--source include/stop_slave.inc
set default_master_connection = 'slave1';
START SLAVE;
--source include/wait_for_slave_to_start.inc
Expand Down
4 changes: 2 additions & 2 deletions mysql-test/suite/rpl/include/mdev-31448_conservative.inc
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ insert into t1 values (3);
commit;

--connection slave
--let $slave_timeout=1032
--source include/wait_for_slave_sql_to_stop.inc
--let $slave_sql_errno=1032
--source include/wait_for_slave_sql_error.inc

update t1 set a=1 where a=2;
set @@global.slave_parallel_threads = @save.slave_parallel_threads;
Expand Down
4 changes: 2 additions & 2 deletions mysql-test/suite/rpl/include/mdev-31448_optimistic.inc
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ drop table t2;
commit;

--connection slave
--let $slave_timeout=1032
--source include/wait_for_slave_sql_to_stop.inc
--let $slave_sql_errno=1032
--source include/wait_for_slave_sql_error.inc

update t1 set a=1 where a=2;
set @@global.slave_parallel_threads = @save.slave_parallel_threads;
Expand Down
4 changes: 4 additions & 0 deletions mysql-test/suite/rpl/include/rpl_binlog_max_cache_size.test
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,8 @@ while ($n)
COMMIT;

--connection slave
# Multi-statement transaction raised ER_TRANS_CACHE_FULL (4096=128x32)
# that will stop SQL slave thread
--let $slave_sql_errno= 1197
if (`SELECT @@binlog_format = 'ROW'`)
{
Expand All @@ -430,6 +432,8 @@ source include/show_binlog_events.inc;
--replace_result $old_binlog_stmt_cache_size ORIGINAL_VALUE
--eval SET GLOBAL binlog_stmt_cache_size= $old_binlog_stmt_cache_size

# SQL slave is stopped, stop only IO thread
--let $rpl_only_running_threads= 1
source include/stop_slave.inc;
source include/start_slave.inc;

Expand Down
9 changes: 9 additions & 0 deletions mysql-test/suite/rpl/include/rpl_shutdown_wait_slaves.inc
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,26 @@ EOF
--connection server_1
DROP TABLE t1;

# Slaves IO thread will receive the disconnect error when master was shutdown
# so we are allowing error on start.
--connection server_2
--disable_warnings
--let rpl_allow_error=1
--source include/wait_for_slave_io_to_start.inc

--source include/start_slave.inc
--enable_warnings

--connection server_3
--disable_warnings
--let rpl_allow_error=1
--source include/wait_for_slave_io_to_start.inc
--source include/start_slave.inc
--enable_warnings

--connection server_4
--disable_warnings
--let rpl_allow_error=1
--source include/wait_for_slave_io_to_start.inc
--source include/start_slave.inc
--enable_warnings
1 change: 1 addition & 0 deletions mysql-test/suite/rpl/include/rpl_start_stop_slave.test
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ START SLAVE;
--let $status_items= Last_IO_Errno, Last_IO_Error
--source include/show_slave_status.inc

--let $rpl_only_running_threads= 1
--source include/stop_slave.inc
RESET SLAVE;

Expand Down
7 changes: 5 additions & 2 deletions mysql-test/suite/rpl/include/rpl_stop_middle_group.test
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ connection slave;
# slave will catch the killed status, won't shut down immediately
# but does it eventually having the whole group unfinished (not committed)

source include/wait_for_slave_sql_to_stop.inc;
# ER_SLAVE_FATAL_ERROR
--let slave_sql_errno= 1593
source include/wait_for_slave_sql_error.inc;

# checking: the error and group unfinished

Expand Down Expand Up @@ -120,7 +122,8 @@ connection slave;
# but does it eventually having the whole group unfinished (not committed)
#

source include/wait_for_slave_sql_to_stop.inc;
--let slave_sql_errno= 1593
source include/wait_for_slave_sql_error.inc;

# checking: the error and group unfinished

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ connection master;
include/rpl_start_server.inc [server_number=1]
# Master has restarted successfully
connection slave;
include/stop_slave.inc
include/start_slave.inc
include/wait_for_slave_io_to_start.inc
include/wait_for_slave_sql_to_start.inc
select * from ti;
a
1
Expand Down
5 changes: 3 additions & 2 deletions mysql-test/suite/rpl/r/rpl_fail_register.result
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
include/master-slave.inc
[connection master]
connection slave;
CALL mtr.add_suppression("Slave I/O: Master command COM_REGISTER_SLAVE failed: Debug Induced Error");
set @old_dbug=@@global.debug_dbug;
set global debug_dbug='d,fail_com_register_slave';
stop slave;
reset slave;
include/wait_for_slave_to_stop.inc
start slave;
stop slave;
include/wait_for_slave_to_stop.inc
include/wait_for_slave_io_error.inc [errno=1597]
include/stop_slave_sql.inc
set global debug_dbug=@old_dbug;
connection master;
kill DUMP_THREAD;
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/suite/rpl/r/rpl_gtid_delete_domain.result
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Waiting until 'Slave_IO_Running' = 'Yes' [$slave_error_param='Last_IO_Errno']
.. con='slave' warn='1' qlog='1' rlog='1' aborterr='1'
...==== BEGIN include/wait_for_slave_param.inc [Slave_SQL_Running] ====
... con='slave' warn='1' qlog='1' rlog='1' aborterr='1'
Waiting until 'Slave_SQL_Running' = 'Yes' [$slave_error_param='1']
Waiting until 'Slave_SQL_Running' = 'Yes' [$slave_error_param='']
[connection slave]
...==== END include/wait_for_slave_param.inc [Slave_SQL_Running] ====
... con='slave' warn='1' qlog='1' rlog='1' aborterr='1'
Expand Down
4 changes: 2 additions & 2 deletions mysql-test/suite/rpl/r/rpl_mdev_17614.result
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ a b c
1 1 1
2 2 3
stop slave;
include/wait_for_slave_to_stop.inc
include/stop_slave.inc
reset slave;
connection master;
reset master;
Expand Down Expand Up @@ -190,7 +190,7 @@ a b c
1 1 1
2 2 3
stop slave;
include/wait_for_slave_to_stop.inc
include/stop_slave.inc
reset slave;
connection master;
reset master;
Expand Down
1 change: 0 additions & 1 deletion mysql-test/suite/rpl/r/rpl_parallel.result
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,6 @@ connection con2;
SET debug_sync='RESET';
connection server_2;
include/wait_for_slave_sql_error.inc [errno=1062]
include/wait_for_slave_sql_to_stop.inc
SELECT * FROM t3 WHERE a >= 110 ORDER BY a;
a b
110 1
Expand Down
1 change: 1 addition & 0 deletions mysql-test/suite/rpl/r/rpl_parallel_ignored_errors.result
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ connection server_2;
connection con_temp2;
COMMIT;
connection server_2;
include/wait_for_slave_sql_error.inc [errno=1062]
include/stop_slave.inc
include/assert.inc [table t1 should have zero rows where a>32]
SELECT * FROM t1 WHERE a>32;
Expand Down
6 changes: 3 additions & 3 deletions mysql-test/suite/rpl/r/rpl_parallel_kill.result
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ kill $t3_tid;
connection slave1;
commit;
connection slave;
include/wait_for_slave_sql_to_stop.inc
include/wait_for_slave_sql_error.inc [errno=1032]
update t1 set a=1 where a=2;
set @@global.slave_parallel_threads = @save.slave_parallel_threads;
set @@global.slave_parallel_mode = @save.slave_parallel_mode;
Expand Down Expand Up @@ -78,7 +78,7 @@ include/wait_for_slave_param.inc [Last_Errno]
connection slave1;
commit;
connection slave;
include/wait_for_slave_sql_to_stop.inc
include/wait_for_slave_sql_error.inc [errno=1032]
update t1 set a=1 where a=2;
set @@global.slave_parallel_threads = @save.slave_parallel_threads;
set @@global.slave_parallel_mode = @save.slave_parallel_mode;
Expand Down Expand Up @@ -127,7 +127,7 @@ include/wait_for_slave_param.inc [Last_Errno]
connection slave1;
commit;
connection slave;
include/wait_for_slave_sql_to_stop.inc
include/wait_for_slave_sql_error.inc [errno=1032]
update t1 set a=1 where a=2;
set @@global.slave_parallel_threads = @save.slave_parallel_threads;
set @@global.slave_parallel_mode = @save.slave_parallel_mode;
Expand Down
16 changes: 8 additions & 8 deletions mysql-test/suite/rpl/r/rpl_row_idempotency.result
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ b
3
*** slave must stop (Trying to delete a referenced foreing key)
connection slave;
include/wait_for_slave_sql_to_stop.inc
include/wait_for_slave_sql_error.inc [errno=1451]
Last_SQL_Error
1451
select * from ti1 order by b /* must be (1),(2),(3) - not deleted */;
Expand All @@ -114,7 +114,7 @@ connection master;
insert into ti2 set a=3, b=3 /* offending write event */;
*** slave must stop (Trying to insert an invalid foreign key)
connection slave;
include/wait_for_slave_sql_to_stop.inc
include/wait_for_slave_sql_error.inc [errno=1452]
Last_SQL_Error
1452
select * from ti2 order by b /* must be (2,2) */;
Expand All @@ -139,9 +139,9 @@ a b
insert into ti1 set b=1;
connection master;
insert into ti1 set b=1 /* offending write event */;
*** slave must stop (Trying to insert a dupliacte key)
*** slave must stop (Trying to insert a duplicate key)
connection slave;
include/wait_for_slave_sql_to_stop.inc
include/wait_for_slave_sql_error.inc [errno=1062]
Last_SQL_Error
1062
set foreign_key_checks= 0;
Expand All @@ -164,7 +164,7 @@ connection master;
DELETE FROM t1 WHERE a = -2;
*** slave must stop (Key was not found)
connection slave;
include/wait_for_slave_sql_to_stop.inc
include/wait_for_slave_sql_error.inc [errno=1032]
Last_SQL_Error
1032
set global slave_exec_mode='IDEMPOTENT';
Expand All @@ -176,7 +176,7 @@ connection master;
DELETE FROM t2 WHERE a = -2;
*** slave must stop (Key was not found)
connection slave;
include/wait_for_slave_sql_to_stop.inc
include/wait_for_slave_sql_error.inc [errno=1032]
Last_SQL_Error
1032
set global slave_exec_mode='IDEMPOTENT';
Expand All @@ -190,7 +190,7 @@ connection master;
UPDATE t1 SET a = 1 WHERE a = -1;
*** slave must stop (Key was not found)
connection slave;
include/wait_for_slave_sql_to_stop.inc
include/wait_for_slave_sql_error.inc [errno=1032]
Last_SQL_Error
1032
set global slave_exec_mode='IDEMPOTENT';
Expand All @@ -202,7 +202,7 @@ connection master;
UPDATE t2 SET a = 1 WHERE a = -1;
*** slave must stop (Key was not found)
connection slave;
include/wait_for_slave_sql_to_stop.inc
include/wait_for_slave_sql_error.inc [errno=1032]
Last_SQL_Error
1032
set global slave_exec_mode='IDEMPOTENT';
Expand Down
8 changes: 3 additions & 5 deletions mysql-test/suite/rpl/r/rpl_semi_sync_master_shutdown.result
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,12 @@ connection master;
# Shutdown master
include/rpl_stop_server.inc [server_number=1]
connection slave;
include/stop_slave.inc
include/wait_for_slave_io_error.inc [errno=2003]
# Restart master
include/rpl_start_server.inc [server_number=1]
connection slave;
include/stop_slave.inc
Warnings:
Note 1255 Slave already has been stopped
include/start_slave.inc
include/wait_for_slave_sql_to_start.inc
include/wait_for_slave_io_to_start.inc
connection master;
SET @@GLOBAL.debug_dbug="";
SET @@GLOBAL. rpl_semi_sync_master_enabled = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,13 @@ connection server_1;
connection server_1;
DROP TABLE t1;
connection server_2;
include/wait_for_slave_io_to_start.inc
include/start_slave.inc
connection server_3;
include/wait_for_slave_io_to_start.inc
include/start_slave.inc
connection server_4;
include/wait_for_slave_io_to_start.inc
include/start_slave.inc
connection server_2;
include/stop_slave.inc
Expand Down
3 changes: 3 additions & 0 deletions mysql-test/suite/rpl/r/rpl_shutdown_wait_slaves.result
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@ connection server_1;
connection server_1;
DROP TABLE t1;
connection server_2;
include/wait_for_slave_io_to_start.inc
include/start_slave.inc
connection server_3;
include/wait_for_slave_io_to_start.inc
include/start_slave.inc
connection server_4;
include/wait_for_slave_io_to_start.inc
include/start_slave.inc
include/rpl_end.inc
Loading

0 comments on commit a7d186a

Please sign in to comment.