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>
  • Loading branch information
an3l committed Sep 20, 2023
1 parent 73ef86d commit 908589c
Show file tree
Hide file tree
Showing 43 changed files with 116 additions and 61 deletions.
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
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: 2 additions & 6 deletions mysql-test/suite/rpl/r/rpl_semi_sync_master_shutdown.result
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,11 @@ connection slave;
connection master;
# Shutdown master
include/rpl_stop_server.inc [server_number=1]
connection slave;
include/stop_slave.inc
# 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
1 change: 0 additions & 1 deletion mysql-test/suite/rpl/r/rpl_slave_status.result
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ connection slave;
include/stop_slave.inc
START SLAVE;
include/wait_for_slave_sql_to_start.inc
include/wait_for_slave_io_to_stop.inc
==== Verify that Slave IO thread stopped with error ====
include/wait_for_slave_io_error.inc [errno=1045]
==== Cleanup (Note that slave IO thread is not running) ====
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/suite/rpl/r/rpl_ssl1.result
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ connection slave;
select * from t1;
t
stop slave;
include/wait_for_slave_to_stop.inc
include/wait_for_slave_io_error.inc [errno=1045]
change master to master_ssl=1 , master_ssl_ca ='MYSQL_TEST_DIR/std_data/cacert.pem', master_ssl_cert='MYSQL_TEST_DIR/std_data/client-cert.pem', master_ssl_key='MYSQL_TEST_DIR/std_data/client-key.pem';
start slave;
include/wait_for_slave_to_start.inc
Expand Down
4 changes: 2 additions & 2 deletions mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Warnings:
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction
commit;
connection slave;
include/wait_for_slave_sql_to_stop.inc
include/wait_for_slave_sql_error.inc [errno=1593]
SELECT "Fatal error: ... Slave SQL Thread stopped with incomplete event group having non-transactional changes. If the group consists solely of row-based events, you can try to restart the slave with --slave-exec-mode=IDEMPOTENT, which ignores duplicate key, key not found, and similar errors (see documentation for details)." AS Last_SQL_Error, @check as `true`;
Last_SQL_Error true
Fatal error: ... Slave SQL Thread stopped with incomplete event group having non-transactional changes. If the group consists solely of row-based events, you can try to restart the slave with --slave-exec-mode=IDEMPOTENT, which ignores duplicate key, key not found, and similar errors (see documentation for details). 1
Expand All @@ -63,7 +63,7 @@ set @@global.debug_dbug="d,stop_slave_middle_group,incomplete_group_in_relay_log
connection master;
update tm as t1, ti as t2 set t1.a=t1.a * 2, t2.a=t2.a * 2;
connection slave;
include/wait_for_slave_sql_to_stop.inc
include/wait_for_slave_sql_error.inc [errno=1593]
SELECT "Fatal error: ... Slave SQL Thread stopped with incomplete event group having non-transactional changes. If the group consists solely of row-based events, you can try to restart the slave with --slave-exec-mode=IDEMPOTENT, which ignores duplicate key, key not found, and similar errors (see documentation for details)." AS Last_SQL_Error, @check as `true`;
Last_SQL_Error true
Fatal error: ... Slave SQL Thread stopped with incomplete event group having non-transactional changes. If the group consists solely of row-based events, you can try to restart the slave with --slave-exec-mode=IDEMPOTENT, which ignores duplicate key, key not found, and similar errors (see documentation for details). 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ DROP TABLE t1;
--connection slave
--echo #
--echo # Cleanup
--let $rpl_only_running_threads= 1
--source include/stop_slave.inc
eval set @@global.slave_parallel_threads= $save_slave_parallel_threads;
eval set @@global.slave_parallel_mode= $save_slave_parallel_mode;
Expand Down
Loading

0 comments on commit 908589c

Please sign in to comment.