summaryrefslogtreecommitdiffstats
path: root/mysql-test/suite/rpl
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 12:33:02 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 12:33:02 +0000
commit4fa488fb0159c629483b7994aa84e73926b132b9 (patch)
tree182a19db69cdcb92be54cc6a5b0b9bfab28f80fd /mysql-test/suite/rpl
parentAdding debian version 1:10.11.6-2. (diff)
downloadmariadb-4fa488fb0159c629483b7994aa84e73926b132b9.tar.xz
mariadb-4fa488fb0159c629483b7994aa84e73926b132b9.zip
Merging upstream version 1:10.11.7.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mysql-test/suite/rpl')
-rw-r--r--mysql-test/suite/rpl/include/mdev-31448_conservative.inc7
-rw-r--r--mysql-test/suite/rpl/include/mdev-31448_optimistic.inc7
-rw-r--r--mysql-test/suite/rpl/include/mysqlbinlog_slave_consistency.inc1
-rw-r--r--mysql-test/suite/rpl/include/rpl_binlog_max_cache_size.test5
-rw-r--r--mysql-test/suite/rpl/include/rpl_change_master_demote.inc11
-rw-r--r--mysql-test/suite/rpl/include/rpl_parallel_29322.inc11
-rw-r--r--mysql-test/suite/rpl/include/rpl_shutdown_wait_slaves.inc5
-rw-r--r--mysql-test/suite/rpl/include/rpl_start_stop_slave.test2
-rw-r--r--mysql-test/suite/rpl/include/rpl_stop_middle_group.test7
-rw-r--r--mysql-test/suite/rpl/r/mdev-31448_kill_ooo_finish_optimistic.result3
-rw-r--r--mysql-test/suite/rpl/r/parallel_backup.result4
-rw-r--r--mysql-test/suite/rpl/r/parallel_backup_lsu_off.result4
-rw-r--r--mysql-test/suite/rpl/r/parallel_backup_slave_binlog_off.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_binlog_cache_disk_full_loaddata.result38
-rw-r--r--mysql-test/suite/rpl/r/rpl_binlog_cache_disk_full_row.result51
-rw-r--r--mysql-test/suite/rpl/r/rpl_binlog_dump_slave_gtid_state_info.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_change_master_demote.result9
-rw-r--r--mysql-test/suite/rpl/r/rpl_circular_semi_sync.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_connection.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_deadlock_show_slave_status.result66
-rw-r--r--mysql-test/suite/rpl/r/rpl_delayed_slave.result3
-rw-r--r--mysql-test/suite/rpl/r/rpl_domain_id_filter_io_crash.result8
-rw-r--r--mysql-test/suite/rpl/r/rpl_domain_id_filter_master_crash.result3
-rw-r--r--mysql-test/suite/rpl/r/rpl_fail_register.result5
-rw-r--r--mysql-test/suite/rpl/r/rpl_gis_user_var.result21
-rw-r--r--mysql-test/suite/rpl/r/rpl_gtid_basic.result7
-rw-r--r--mysql-test/suite/rpl/r/rpl_gtid_delete_domain.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_gtid_errorlog.result5
-rw-r--r--mysql-test/suite/rpl/r/rpl_gtid_slave_filtering.result78
-rw-r--r--mysql-test/suite/rpl/r/rpl_gtid_startpos.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_heartbeat_basic.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_invoked_features.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_mariadb_slave_capability.result5
-rw-r--r--mysql-test/suite/rpl/r/rpl_mdev_17614.result6
-rw-r--r--mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_parallel_ignored_errors.result3
-rw-r--r--mysql-test/suite/rpl/r/rpl_parallel_kill.result6
-rw-r--r--mysql-test/suite/rpl/r/rpl_parallel_missed_error_handling.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_big_table_id.result12
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_binlog_max_cache_size.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_corruption.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_idempotency.result16
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_until.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_seconds_behind_master_spike.result8
-rw-r--r--mysql-test/suite/rpl/r/rpl_semi_sync.result13
-rw-r--r--mysql-test/suite/rpl/r/rpl_semi_sync_after_sync.result13
-rw-r--r--mysql-test/suite/rpl/r/rpl_semi_sync_after_sync_row.result13
-rw-r--r--mysql-test/suite/rpl/r/rpl_semi_sync_event.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_semi_sync_event_after_sync.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_semi_sync_fail_over.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_semi_sync_master_shutdown.result8
-rw-r--r--mysql-test/suite/rpl/r/rpl_semi_sync_no_missed_ack_after_add_slave.result48
-rw-r--r--mysql-test/suite/rpl/r/rpl_semi_sync_slave_enabled_consistent.result35
-rw-r--r--mysql-test/suite/rpl/r/rpl_semi_sync_slave_reply_fail.result7
-rw-r--r--mysql-test/suite/rpl/r/rpl_semisync_ali_issues.result11
-rw-r--r--mysql-test/suite/rpl/r/rpl_session_var.result11
-rw-r--r--mysql-test/suite/rpl/r/rpl_session_var2.result69
-rw-r--r--mysql-test/suite/rpl/r/rpl_set_statement_default_master.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_slave_load_tmpdir_not_exist.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_slave_status.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_sql_thd_start_errno_cleared.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_ssl1.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_start_alter_1.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_start_alter_2.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_start_alter_3.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_start_alter_4.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_start_alter_5.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_start_alter_6.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_start_alter_7.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_start_alter_8.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_start_alter_mysqlbinlog_1.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_start_alter_mysqlbinlog_2.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_start_alter_restart_slave.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_start_stop_slave.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_using_gtid_default.result3
-rw-r--r--mysql-test/suite/rpl/r/semisync_future-7591.result2
-rw-r--r--mysql-test/suite/rpl/t/create_or_replace.inc7
-rw-r--r--mysql-test/suite/rpl/t/mdev-31448_kill_ooo_finish_optimistic.test7
-rw-r--r--mysql-test/suite/rpl/t/parallel_backup_xa.inc2
-rw-r--r--mysql-test/suite/rpl/t/rpl_binlog_cache_disk_full_loaddata.test47
-rw-r--r--mysql-test/suite/rpl/t/rpl_binlog_cache_disk_full_row.test61
-rw-r--r--mysql-test/suite/rpl/t/rpl_binlog_dump_slave_gtid_state_info.test8
-rw-r--r--mysql-test/suite/rpl/t/rpl_checksum.test3
-rw-r--r--mysql-test/suite/rpl/t/rpl_circular_semi_sync.test11
-rw-r--r--mysql-test/suite/rpl/t/rpl_connection.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_deadlock_show_slave_status.test121
-rw-r--r--mysql-test/suite/rpl/t/rpl_delayed_slave.test6
-rw-r--r--mysql-test/suite/rpl/t/rpl_domain_id_filter_io_crash.test9
-rw-r--r--mysql-test/suite/rpl/t/rpl_domain_id_filter_master_crash.test20
-rw-r--r--mysql-test/suite/rpl/t/rpl_fail_register.test9
-rw-r--r--mysql-test/suite/rpl/t/rpl_gis_user_var.test18
-rw-r--r--mysql-test/suite/rpl/t/rpl_gtid_basic.test7
-rw-r--r--mysql-test/suite/rpl/t/rpl_gtid_errorhandling.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_gtid_errorlog.test6
-rw-r--r--mysql-test/suite/rpl/t/rpl_gtid_slave_filtering.cnf28
-rw-r--r--mysql-test/suite/rpl/t/rpl_gtid_slave_filtering.test109
-rw-r--r--mysql-test/suite/rpl/t/rpl_gtid_startpos.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_gtid_stop_start.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_heartbeat_basic.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_invoked_features.test9
-rw-r--r--mysql-test/suite/rpl/t/rpl_mariadb_slave_capability.test15
-rw-r--r--mysql-test/suite/rpl/t/rpl_mdev_17614.test6
-rw-r--r--mysql-test/suite/rpl/t/rpl_parallel_ignored_errors.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_parallel_missed_error_handling.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_parallel_retry.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_perfschema_applier_status_by_coordinator.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_perfschema_applier_status_by_worker.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_rewrite_db_sys_vars.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_corruption.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_idempotency.test31
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_until.test7
-rw-r--r--mysql-test/suite/rpl/t/rpl_seconds_behind_master_spike.test10
-rw-r--r--mysql-test/suite/rpl/t/rpl_semi_sync.test20
-rw-r--r--mysql-test/suite/rpl/t/rpl_semi_sync_event.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_semi_sync_fail_over.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_semi_sync_master_shutdown.test12
-rw-r--r--mysql-test/suite/rpl/t/rpl_semi_sync_no_missed_ack_after_add_slave.cnf12
-rw-r--r--mysql-test/suite/rpl/t/rpl_semi_sync_no_missed_ack_after_add_slave.test122
-rw-r--r--mysql-test/suite/rpl/t/rpl_semi_sync_shutdown_await_ack.inc2
-rw-r--r--mysql-test/suite/rpl/t/rpl_semi_sync_slave_compressed_protocol.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_semi_sync_slave_enabled_consistent.test73
-rw-r--r--mysql-test/suite/rpl/t/rpl_semi_sync_slave_reply_fail.test7
-rw-r--r--mysql-test/suite/rpl/t/rpl_semisync_ali_issues.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_session_var.test6
-rw-r--r--mysql-test/suite/rpl/t/rpl_session_var2-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_session_var2-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_session_var2.test3
-rw-r--r--mysql-test/suite/rpl/t/rpl_set_statement_default_master.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_shutdown_wait_semisync_slaves.test3
-rw-r--r--mysql-test/suite/rpl/t/rpl_slave_load_tmpdir_not_exist.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_slave_status.test3
-rw-r--r--mysql-test/suite/rpl/t/rpl_sql_thd_start_errno_cleared.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_ssl1.test6
-rw-r--r--mysql-test/suite/rpl/t/rpl_start_alter_1.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_start_alter_2.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_start_alter_3.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_start_alter_4.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_start_alter_5.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_start_alter_6.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_start_alter_7.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_start_alter_8.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_start_alter_mysqlbinlog_1.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_start_alter_mysqlbinlog_2.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_start_alter_restart_slave.test6
-rw-r--r--mysql-test/suite/rpl/t/rpl_temporary_errors.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_using_gtid_default.test3
-rw-r--r--mysql-test/suite/rpl/t/semisync_future-7591.test2
-rw-r--r--mysql-test/suite/rpl/t/show_status_stop_slave_race-7126.test3
150 files changed, 1447 insertions, 181 deletions
diff --git a/mysql-test/suite/rpl/include/mdev-31448_conservative.inc b/mysql-test/suite/rpl/include/mdev-31448_conservative.inc
index 3db5a000..e479901f 100644
--- a/mysql-test/suite/rpl/include/mdev-31448_conservative.inc
+++ b/mysql-test/suite/rpl/include/mdev-31448_conservative.inc
@@ -36,7 +36,8 @@ insert into t1 values (3);
--connection slave
--source include/start_slave.inc
---let $wait_condition= SELECT count(*)=1 FROM information_schema.processlist WHERE state LIKE 'Update_rows_log_event::find_row(-1)%' and command LIKE 'Slave_worker';
+# Wildcard for `state` as it depends on whether WSREP is compiled in or not.
+--let $wait_condition= SELECT count(*)=1 FROM information_schema.processlist WHERE state LIKE 'Update_rows_log_event::find_row(%' and command LIKE 'Slave_worker';
--source include/wait_condition.inc
--let $wait_condition= SELECT count(*)=1 FROM information_schema.processlist WHERE state LIKE 'Waiting for prior transaction to commit%' and command LIKE 'Slave_worker';
--source include/wait_condition.inc
@@ -50,8 +51,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;
diff --git a/mysql-test/suite/rpl/include/mdev-31448_optimistic.inc b/mysql-test/suite/rpl/include/mdev-31448_optimistic.inc
index 22cee6b3..c561e298 100644
--- a/mysql-test/suite/rpl/include/mdev-31448_optimistic.inc
+++ b/mysql-test/suite/rpl/include/mdev-31448_optimistic.inc
@@ -55,7 +55,8 @@ drop table t2;
--source include/start_slave.inc
--echo # wait for T1
---let $wait_condition= SELECT count(*)=1 FROM information_schema.processlist WHERE state LIKE 'Update_rows_log_event::find_row(-1)%' and command LIKE 'Slave_worker';
+# Wildcard for `state` as it depends on whether WSREP is compiled in or not.
+--let $wait_condition= SELECT count(*)=1 FROM information_schema.processlist WHERE state LIKE 'Update_rows_log_event::find_row(%' and command LIKE 'Slave_worker';
--source include/wait_condition.inc
--echo # wait for T2
@@ -75,8 +76,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;
diff --git a/mysql-test/suite/rpl/include/mysqlbinlog_slave_consistency.inc b/mysql-test/suite/rpl/include/mysqlbinlog_slave_consistency.inc
index 48e4399d..b571c24e 100644
--- a/mysql-test/suite/rpl/include/mysqlbinlog_slave_consistency.inc
+++ b/mysql-test/suite/rpl/include/mysqlbinlog_slave_consistency.inc
@@ -128,6 +128,7 @@ if (!$slave_sql_errno)
}
--echo # Stop $con2 so it stops receiving $con1 events.
+--let $rpl_allow_error= 1
--source include/stop_slave.inc
--connection $con1
diff --git a/mysql-test/suite/rpl/include/rpl_binlog_max_cache_size.test b/mysql-test/suite/rpl/include/rpl_binlog_max_cache_size.test
index 2634a602..77b969fc 100644
--- a/mysql-test/suite/rpl/include/rpl_binlog_max_cache_size.test
+++ b/mysql-test/suite/rpl/include/rpl_binlog_max_cache_size.test
@@ -418,6 +418,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'`)
{
@@ -437,7 +439,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
-source include/stop_slave.inc;
+# SQL slave is stopped, stop only IO thread
+source include/stop_slave_io.inc;
source include/start_slave.inc;
connection master;
diff --git a/mysql-test/suite/rpl/include/rpl_change_master_demote.inc b/mysql-test/suite/rpl/include/rpl_change_master_demote.inc
index 4c563454..932a2b87 100644
--- a/mysql-test/suite/rpl/include/rpl_change_master_demote.inc
+++ b/mysql-test/suite/rpl/include/rpl_change_master_demote.inc
@@ -85,5 +85,16 @@ SELECT VARIABLE_NAME, GLOBAL_VALUE FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHER
--eval CHANGE MASTER TO master_host='127.0.0.1', master_port=$MASTER_MYPORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1
--source include/start_slave.inc
+# Ensure master is ready to start sending new transactions. That is, because
+# the master does not have log_slave_updates, the slave's transactions of
+# repl_t are not binlogged, and its state is behind. If the master binlogs
+# any new transactions before the slaves connection is matured,
+# ER_GTID_POSITION_NOT_FOUND_IN_BINLOG2 can be reported to the slave
+# FIXME: We shouldn't need to do this, rather, the master should use
+# log-slave-updates and gtid-strict-mode
+--connection master
+--let $wait_condition= SELECT COUNT(*) > 0 FROM information_schema.processlist WHERE State like '%Master has sent all binlog to slave%'
+--source include/wait_condition.inc
+
--let $include_filename= rpl_change_master_demote.inc
--source include/end_include_file.inc
diff --git a/mysql-test/suite/rpl/include/rpl_parallel_29322.inc b/mysql-test/suite/rpl/include/rpl_parallel_29322.inc
index 96d75f33..a8b729d0 100644
--- a/mysql-test/suite/rpl/include/rpl_parallel_29322.inc
+++ b/mysql-test/suite/rpl/include/rpl_parallel_29322.inc
@@ -67,6 +67,17 @@ if ($same_version_binlogs)
if (!$same_version_binlogs)
{
+ # Make sure the dump thread is gone before moving around binlog files. Else
+ # it might see an empty file and give error (MDEV-29816).
+ --let $dump_thrid= `Select id FROM information_schema.processlist WHERE Command='Binlog Dump'`
+ if ($dump_thrid) {
+ --disable_query_log
+ --error 0,ER_NO_SUCH_THREAD
+ eval KILL CONNECTION $dump_thrid;
+ --enable_query_log
+ --let $wait_condition= SELECT COUNT(*)=0 FROM information_schema.processlist WHERE Command='Binlog Dump'
+ --source include/wait_condition.inc
+ }
--move_file $datadir/master-bin.000002 $datadir/master-bin.000002.sav
--copy_file $MYSQL_TEST_DIR/std_data/mdev29078-mysql-bin.000001 $datadir/master-bin.000002
--exec $MYSQL_BINLOG --short-form $datadir/master-bin.000002
diff --git a/mysql-test/suite/rpl/include/rpl_shutdown_wait_slaves.inc b/mysql-test/suite/rpl/include/rpl_shutdown_wait_slaves.inc
index 4726bbe1..f9c007b4 100644
--- a/mysql-test/suite/rpl/include/rpl_shutdown_wait_slaves.inc
+++ b/mysql-test/suite/rpl/include/rpl_shutdown_wait_slaves.inc
@@ -75,17 +75,22 @@ 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/start_slave.inc
--enable_warnings
--connection server_3
--disable_warnings
+--let rpl_allow_error=1
--source include/start_slave.inc
--enable_warnings
--connection server_4
--disable_warnings
+--let rpl_allow_error=1
--source include/start_slave.inc
--enable_warnings
diff --git a/mysql-test/suite/rpl/include/rpl_start_stop_slave.test b/mysql-test/suite/rpl/include/rpl_start_stop_slave.test
index ae5f8361..56b04494 100644
--- a/mysql-test/suite/rpl/include/rpl_start_stop_slave.test
+++ b/mysql-test/suite/rpl/include/rpl_start_stop_slave.test
@@ -207,7 +207,7 @@ START SLAVE;
--let $status_items= Last_IO_Errno, Last_IO_Error
--source include/show_slave_status.inc
---source include/stop_slave.inc
+--source include/stop_slave_sql.inc
RESET SLAVE;
--connection master
diff --git a/mysql-test/suite/rpl/include/rpl_stop_middle_group.test b/mysql-test/suite/rpl/include/rpl_stop_middle_group.test
index ac01fb04..6bc872ca 100644
--- a/mysql-test/suite/rpl/include/rpl_stop_middle_group.test
+++ b/mysql-test/suite/rpl/include/rpl_stop_middle_group.test
@@ -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
@@ -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
diff --git a/mysql-test/suite/rpl/r/mdev-31448_kill_ooo_finish_optimistic.result b/mysql-test/suite/rpl/r/mdev-31448_kill_ooo_finish_optimistic.result
index 23a16e01..7fa1a831 100644
--- a/mysql-test/suite/rpl/r/mdev-31448_kill_ooo_finish_optimistic.result
+++ b/mysql-test/suite/rpl/r/mdev-31448_kill_ooo_finish_optimistic.result
@@ -42,7 +42,8 @@ include/save_master_gtid.inc
connection slave;
#
# Cleanup
-include/stop_slave.inc
+include/wait_for_slave_sql_to_stop.inc
+include/stop_slave_io.inc
set @@global.slave_parallel_threads= 0;
set @@global.slave_parallel_mode= optimistic;
set @@global.innodb_lock_wait_timeout= 50;
diff --git a/mysql-test/suite/rpl/r/parallel_backup.result b/mysql-test/suite/rpl/r/parallel_backup.result
index 7cf72ed1..83c7a916 100644
--- a/mysql-test/suite/rpl/r/parallel_backup.result
+++ b/mysql-test/suite/rpl/r/parallel_backup.result
@@ -73,8 +73,6 @@ include/stop_slave.inc
# Normal XA ROLLBACK
connection slave;
include/stop_slave.inc
-Warnings:
-Note 1255 Slave already has been stopped
connection master;
connection aux_slave;
BEGIN;
@@ -110,8 +108,6 @@ include/stop_slave.inc
# Errored out XA COMMIT
connection slave;
include/stop_slave.inc
-Warnings:
-Note 1255 Slave already has been stopped
connection master;
connection aux_slave;
BEGIN;
diff --git a/mysql-test/suite/rpl/r/parallel_backup_lsu_off.result b/mysql-test/suite/rpl/r/parallel_backup_lsu_off.result
index b89cb154..e1fd7701 100644
--- a/mysql-test/suite/rpl/r/parallel_backup_lsu_off.result
+++ b/mysql-test/suite/rpl/r/parallel_backup_lsu_off.result
@@ -76,8 +76,6 @@ include/stop_slave.inc
# Normal XA ROLLBACK
connection slave;
include/stop_slave.inc
-Warnings:
-Note 1255 Slave already has been stopped
connection master;
connection aux_slave;
BEGIN;
@@ -113,8 +111,6 @@ include/stop_slave.inc
# Errored out XA COMMIT
connection slave;
include/stop_slave.inc
-Warnings:
-Note 1255 Slave already has been stopped
connection master;
connection aux_slave;
BEGIN;
diff --git a/mysql-test/suite/rpl/r/parallel_backup_slave_binlog_off.result b/mysql-test/suite/rpl/r/parallel_backup_slave_binlog_off.result
index 111bc7fb..9e29e5a3 100644
--- a/mysql-test/suite/rpl/r/parallel_backup_slave_binlog_off.result
+++ b/mysql-test/suite/rpl/r/parallel_backup_slave_binlog_off.result
@@ -76,8 +76,6 @@ include/stop_slave.inc
# Normal XA ROLLBACK
connection slave;
include/stop_slave.inc
-Warnings:
-Note 1255 Slave already has been stopped
connection master;
connection aux_slave;
BEGIN;
@@ -113,8 +111,6 @@ include/stop_slave.inc
# Errored out XA COMMIT
connection slave;
include/stop_slave.inc
-Warnings:
-Note 1255 Slave already has been stopped
connection master;
connection aux_slave;
BEGIN;
diff --git a/mysql-test/suite/rpl/r/rpl_binlog_cache_disk_full_loaddata.result b/mysql-test/suite/rpl/r/rpl_binlog_cache_disk_full_loaddata.result
new file mode 100644
index 00000000..a876a597
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_binlog_cache_disk_full_loaddata.result
@@ -0,0 +1,38 @@
+include/master-slave.inc
+[connection master]
+connection master;
+SET @save_binlog_stmt_cache_size= @@GLOBAL.binlog_stmt_cache_size;
+SET GLOBAL binlog_stmt_cache_size= 4096;
+CALL mtr.add_suppression('"No space left on device".*An incident event is written to binary log');
+CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=MyISAM;
+FLUSH STATUS;
+SHOW STATUS LIKE "binlog_stmt_cache%";
+Variable_name Value
+Binlog_stmt_cache_disk_use 0
+Binlog_stmt_cache_use 0
+SET @old_dbug= @@SESSION.debug_dbug;
+SET SESSION debug_dbug="+d,load_data_binlog_cache_error";
+LOAD DATA CONCURRENT LOCAL INFILE 'std_data/bug30435_5k.txt'
+ REPLACE INTO TABLE t1 (a);
+ERROR HY000: Error writing file '<FILENAME>' (Errcode: 28 "No space left on device")
+SET SESSION debug_dbug= @old_dbug;
+SHOW STATUS LIKE "binlog_stmt_cache%";
+Variable_name Value
+Binlog_stmt_cache_disk_use 1
+Binlog_stmt_cache_use 1
+SELECT IF(COUNT(*) > 0 AND COUNT(*) < 5000,
+"ok",
+CONCAT("ERROR! Row count ", COUNT(*), " not as expected for partially executed query"))
+AS check_result
+FROM t1;
+check_result
+ok
+connection slave;
+include/wait_for_slave_sql_error_and_skip.inc [errno=1590]
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+0
+connection master;
+SET GLOBAL binlog_stmt_cache_size= @save_binlog_stmt_cache_size;
+DROP TABLE t1;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_binlog_cache_disk_full_row.result b/mysql-test/suite/rpl/r/rpl_binlog_cache_disk_full_row.result
new file mode 100644
index 00000000..753fdaa4
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_binlog_cache_disk_full_row.result
@@ -0,0 +1,51 @@
+include/master-slave.inc
+[connection master]
+connection master;
+SET @save_binlog_stmt_cache_size= @@GLOBAL.binlog_stmt_cache_size;
+SET GLOBAL binlog_stmt_cache_size= 4096;
+CALL mtr.add_suppression('"No space left on device".*An incident event is written to binary log');
+CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(255)) ENGINE=MyISAM;
+FLUSH STATUS;
+SHOW STATUS LIKE "binlog_stmt_cache%";
+Variable_name Value
+Binlog_stmt_cache_disk_use 0
+Binlog_stmt_cache_use 0
+INSERT INTO t1 VALUES (0, CONCAT("?", "-", REPEAT("x", 200)));
+INSERT INTO t1 SELECT a+1, CONCAT(a, "-", REPEAT("x", 200)) FROM t1;
+INSERT INTO t1 SELECT a+2, CONCAT(a, "-", REPEAT("x", 200)) FROM t1;
+INSERT INTO t1 SELECT a+4, CONCAT(a, "-", REPEAT("x", 200)) FROM t1;
+INSERT INTO t1 SELECT a+8, CONCAT(a, "-", REPEAT("x", 200)) FROM t1;
+INSERT INTO t1 SELECT a+16, CONCAT(a, "-", REPEAT("x", 200)) FROM t1;
+INSERT INTO t1 SELECT a+32, CONCAT(a, "-", REPEAT("x", 200)) FROM t1;
+INSERT INTO t1 SELECT a+64, CONCAT(a, "-", REPEAT("x", 200)) FROM t1;
+INSERT INTO t1 SELECT a+128, CONCAT(a, "-", REPEAT("x", 200)) FROM t1;
+SHOW STATUS LIKE "binlog_stmt_cache%";
+Variable_name Value
+Binlog_stmt_cache_disk_use 2
+Binlog_stmt_cache_use 9
+SET @old_dbug= @@SESSION.debug_dbug;
+SET SESSION debug_dbug="+d,simulate_disk_full_at_flush_pending";
+INSERT INTO t1 SELECT a+256, CONCAT(a, "-", REPEAT("x", 200)) FROM t1;
+ERROR HY000: Error writing file '<FILENAME>' (Errcode: 28 "No space left on device")
+SET SESSION debug_dbug= @old_dbug;
+SHOW STATUS LIKE "binlog_stmt_cache%";
+Variable_name Value
+Binlog_stmt_cache_disk_use 3
+Binlog_stmt_cache_use 10
+SELECT IF(COUNT(*) > 256 AND COUNT(*) < 512,
+"ok",
+CONCAT("ERROR! Row count ", COUNT(*), " not as expected for partially executed query"))
+AS check_result
+FROM t1;
+check_result
+ok
+ALTER TABLE t1 COMMENT '<mumble>';
+connection slave;
+include/wait_for_slave_sql_error_and_skip.inc [errno=1590]
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+256
+connection master;
+SET GLOBAL binlog_stmt_cache_size= @save_binlog_stmt_cache_size;
+DROP TABLE t1;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_binlog_dump_slave_gtid_state_info.result b/mysql-test/suite/rpl/r/rpl_binlog_dump_slave_gtid_state_info.result
index b913a49b..af79b482 100644
--- a/mysql-test/suite/rpl/r/rpl_binlog_dump_slave_gtid_state_info.result
+++ b/mysql-test/suite/rpl/r/rpl_binlog_dump_slave_gtid_state_info.result
@@ -8,6 +8,7 @@ CHANGE MASTER TO MASTER_USE_GTID=slave_pos;
include/start_slave.inc
connection master;
"Test Case 1: Start binlog_dump to slave_server(#), pos(master-bin.000001, ###), using_gtid(1), gtid('')"
+include/wait_for_pattern_in_file.inc
FOUND 1 /using_gtid\(1\), gtid\(\'\'\).*/ in mysqld.1.err
connection slave;
include/stop_slave.inc
@@ -15,6 +16,7 @@ CHANGE MASTER TO MASTER_USE_GTID=no;
include/start_slave.inc
connection master;
"Test Case 2: Start binlog_dump to slave_server(#), pos(master-bin.000001, ###), using_gtid(0), gtid('')"
+include/wait_for_pattern_in_file.inc
FOUND 1 /using_gtid\(0\), gtid\(\'\'\).*/ in mysqld.1.err
CREATE TABLE t (f INT) ENGINE=INNODB;
INSERT INTO t VALUES(10);
@@ -25,6 +27,7 @@ CHANGE MASTER TO MASTER_USE_GTID=slave_pos;
include/start_slave.inc
connection master;
"Test Case 3: Start binlog_dump to slave_server(#), pos(master-bin.000001, ###), using_gtid(1), gtid('0-1-2')"
+include/wait_for_pattern_in_file.inc
FOUND 1 /using_gtid\(1\), gtid\(\'0-1-2\'\).*/ in mysqld.1.err
SET @@SESSION.gtid_domain_id=10;
INSERT INTO t VALUES(20);
@@ -35,6 +38,7 @@ CHANGE MASTER TO MASTER_USE_GTID=slave_pos;
include/start_slave.inc
connection master;
"Test Case 4: Start binlog_dump to slave_server(#), pos(master-bin.000001, ###), using_gtid(1), gtid('0-1-2,10-1-1')"
+include/wait_for_pattern_in_file.inc
FOUND 1 /using_gtid\(1\), gtid\(\'0-1-2,10-1-1\'\).*/ in mysqld.1.err
"===== Clean up ====="
connection slave;
diff --git a/mysql-test/suite/rpl/r/rpl_change_master_demote.result b/mysql-test/suite/rpl/r/rpl_change_master_demote.result
index 38cff838..70d141ef 100644
--- a/mysql-test/suite/rpl/r/rpl_change_master_demote.result
+++ b/mysql-test/suite/rpl/r/rpl_change_master_demote.result
@@ -58,6 +58,7 @@ GTID_SLAVE_POS 0-2-3
connection master;
connection slave;
CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1;
+connection master;
#
# Test Case 2: If gtid_slave_pos is empty, gtid_binlog_pos will
# completely overwrite it with MASTER_DEMOTE_TO_SLAVE=1.
@@ -124,6 +125,7 @@ GTID_SLAVE_POS 0-2-5
connection master;
connection slave;
CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1;
+connection master;
#
# Test Case 3: Using a single domain id, if neither gtid_slave_pos nor
# gtid_binlog_pos are empty, and gtid_binlog_pos is more recent, then
@@ -183,6 +185,7 @@ GTID_SLAVE_POS 0-2-9
connection master;
connection slave;
CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1;
+connection master;
#
# Test Case 4: If gtid_slave_pos and gtid_binlog_pos are equivalent,
# MASTER_DEMOTE_TO_SLAVE=1 will not change gtid_slave_pos.
@@ -244,6 +247,7 @@ GTID_SLAVE_POS 0-2-13
connection master;
connection slave;
CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1;
+connection master;
#
# Test Case 5: If a new domain id is added into gtid_binlog_pos while
# gtid_slave_pos already has a state, MASTER_DEMOTE_TO_SLAVE=1 will
@@ -308,6 +312,7 @@ GTID_SLAVE_POS 0-2-17,1-1-2
connection master;
connection slave;
CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1;
+connection master;
#
# Test Case 6: If gtid_slave_pos has multiple GTID positions and
# gtid_binlog_pos contains updates on existing domain ids, new
@@ -390,6 +395,7 @@ GTID_SLAVE_POS 0-2-21,1-3-4,2-1-2,4-3-2
connection master;
connection slave;
CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1;
+connection master;
#
# Test Case 7: If MASTER_DEMOTE_TO_SLAVE=1 is combined with
# IGNORE_DOMAIN_IDS such that gtid_binlog_pos has more recent GTIDs
@@ -455,6 +461,7 @@ GTID_SLAVE_POS 0-2-24,1-3-4,2-1-3,3-1-2,4-3-2
connection master;
connection slave;
CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1;
+connection master;
#
# Test Case 8: If gtid_binlog_pos is more recent than gtid_slave_pos,
# and MASTER_DEMOTE_TO_SLAVE=1 is combined with a later call to
@@ -556,6 +563,7 @@ GTID_SLAVE_POS 0-2-29,1-3-4,2-1-3,3-1-2,4-3-2
connection master;
connection slave;
CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1;
+connection master;
# Demote master to slave with the more recent gtid_slave_pos
connection master;
CHANGE MASTER TO master_host='127.0.0.1', master_port=SLAVE_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1;
@@ -619,6 +627,7 @@ GTID_SLAVE_POS 0-2-32,1-3-4,2-1-3,3-1-2,4-3-2
connection master;
connection slave;
CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1;
+connection master;
# Tag gtid_slave_pos now (before binlog updates) for later comparison
connection master;
# In domain 1, make gtid_slave_pos < gtid_binlog_pos
diff --git a/mysql-test/suite/rpl/r/rpl_circular_semi_sync.result b/mysql-test/suite/rpl/r/rpl_circular_semi_sync.result
index 5664b791..2596d346 100644
--- a/mysql-test/suite/rpl/r/rpl_circular_semi_sync.result
+++ b/mysql-test/suite/rpl/r/rpl_circular_semi_sync.result
@@ -1,5 +1,7 @@
include/master-slave.inc
[connection master]
+connection server_2;
+call mtr.add_suppression("Timeout waiting for reply of binlog");
# Master server_1 and Slave server_2 initialization ...
connection server_2;
include/stop_slave.inc
@@ -40,6 +42,8 @@ set @@global.rpl_semi_sync_master_enabled = 1;
INSERT INTO t1(a) VALUES (2);
include/save_master_gtid.inc
connection server_1;
+include/stop_slave.inc
+include/start_slave.inc
#
# the successful sync is a required proof
#
diff --git a/mysql-test/suite/rpl/r/rpl_connection.result b/mysql-test/suite/rpl/r/rpl_connection.result
index b5ce7f4e..9fb17b5f 100644
--- a/mysql-test/suite/rpl/r/rpl_connection.result
+++ b/mysql-test/suite/rpl/r/rpl_connection.result
@@ -6,7 +6,7 @@ include/stop_slave.inc
CHANGE MASTER TO MASTER_USER= '', MASTER_PASSWORD= '';
START SLAVE;
include/wait_for_slave_io_error.inc [errno=1045, 1593]
-include/stop_slave.inc
+include/stop_slave_sql.inc
CHANGE MASTER TO MASTER_USER= 'root', MASTER_PASSWORD= '';
START SLAVE;
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_deadlock_show_slave_status.result b/mysql-test/suite/rpl/r/rpl_deadlock_show_slave_status.result
new file mode 100644
index 00000000..12ad5870
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_deadlock_show_slave_status.result
@@ -0,0 +1,66 @@
+include/master-slave.inc
+[connection master]
+#
+# Initialize test data
+connection master;
+create table t1 (a int) engine=innodb;
+insert into t1 values (1);
+include/save_master_gtid.inc
+connection slave;
+include/sync_with_master_gtid.inc
+include/stop_slave.inc
+call mtr.add_suppression("Connection was killed");
+call mtr.add_suppression("Commit failed due to failure of an earlier commit on which this one depends");
+set @save_parallel_threads= @@global.slave_parallel_threads;
+set @save_parallel_mode= @@global.slave_parallel_mode;
+set @save_transaction_retries= @@global.slave_transaction_retries;
+set @save_innodb_lock_wait_timeout= @@global.innodb_lock_wait_timeout;
+set @@global.slave_parallel_threads= 2;
+set @@global.slave_parallel_mode= CONSERVATIVE;
+set @@global.slave_transaction_retries= 0;
+set @@global.innodb_lock_wait_timeout= 10;
+# Grabbing lock on innodb row to force future replication transaction to wait (and eventually timeout)
+BEGIN;
+select * from t1 where a=1 for update;
+a
+1
+connection master;
+set @old_dbug= @@session.debug_dbug;
+set @@session.debug_dbug="+d,binlog_force_commit_id";
+SET @commit_id= 10000;
+update t1 set a=2 where a=1;
+SET @commit_id= 10001;
+insert into t1 values (3);
+set @@session.debug_dbug= @old_dbug;
+connection slave;
+start slave;
+# Waiting for first transaction to start (and be held at innodb row lock)..
+# Waiting for next transaction to start and hold at do_gco_wait()..
+connection slave1;
+set @@session.debug_dbug="+d,hold_sss_with_err_lock";
+show slave status;
+connection slave;
+set debug_sync="now wait_for sss_got_err_lock";
+kill <TID of worker in do_gco_wait>;
+set debug_sync="now signal sss_continue";
+connection slave1;
+# Waiting for SHOW SLAVE STATUS to complete..
+# ..done
+connection slave;
+ROLLBACK;
+include/wait_for_slave_sql_error.inc [errno=1927]
+#
+# Cleanup
+connection master;
+drop table t1;
+include/save_master_gtid.inc
+connection slave;
+set debug_sync= "RESET";
+set @@global.slave_parallel_threads= @save_parallel_threads;
+set @@global.slave_parallel_mode= @save_parallel_mode;
+set @@global.slave_transaction_retries= @save_transaction_retries;
+set @@global.innodb_lock_wait_timeout= @save_innodb_lock_wait_timeout;
+start slave sql_thread;
+include/sync_with_master_gtid.inc
+include/rpl_end.inc
+# End of rpl_deadlock_show_slave_status.test
diff --git a/mysql-test/suite/rpl/r/rpl_delayed_slave.result b/mysql-test/suite/rpl/r/rpl_delayed_slave.result
index c8c3bc36..7ac68e25 100644
--- a/mysql-test/suite/rpl/r/rpl_delayed_slave.result
+++ b/mysql-test/suite/rpl/r/rpl_delayed_slave.result
@@ -70,6 +70,9 @@ include/stop_slave.inc
# CHANGE MASTER TO MASTER_DELAY = 2*T
include/start_slave.inc
connection master;
+INSERT INTO t1 VALUES ('Syncing slave', 5);
+connection slave;
+connection master;
INSERT INTO t1 VALUES (delay_on_slave(1), 6);
Warnings:
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave
diff --git a/mysql-test/suite/rpl/r/rpl_domain_id_filter_io_crash.result b/mysql-test/suite/rpl/r/rpl_domain_id_filter_io_crash.result
index feef82a5..5250c4bb 100644
--- a/mysql-test/suite/rpl/r/rpl_domain_id_filter_io_crash.result
+++ b/mysql-test/suite/rpl/r/rpl_domain_id_filter_io_crash.result
@@ -135,7 +135,7 @@ i
2
3
SET @@global.debug_dbug=@saved_dbug;
-include/stop_slave.inc
+include/stop_slave_sql.inc
DO_DOMAIN_IDS (BEFORE) :
IGNORE_DOMAIN_IDS (BEFORE) :
CHANGE MASTER TO IGNORE_DOMAIN_IDS=(1), MASTER_USE_GTID=slave_pos;
@@ -204,7 +204,7 @@ i
10
11
SET @@global.debug_dbug=@saved_dbug;
-include/stop_slave.inc
+include/stop_slave_sql.inc
DO_DOMAIN_IDS (BEFORE) :
IGNORE_DOMAIN_IDS (BEFORE) : 1
CHANGE MASTER TO IGNORE_DOMAIN_IDS=(), MASTER_USE_GTID=slave_pos;
@@ -287,7 +287,7 @@ i
16
17
SET @@global.debug_dbug=@saved_dbug;
-include/stop_slave.inc
+include/stop_slave_sql.inc
DO_DOMAIN_IDS (BEFORE) :
IGNORE_DOMAIN_IDS (BEFORE) : 1
CHANGE MASTER TO IGNORE_DOMAIN_IDS=(), MASTER_USE_GTID=slave_pos;
@@ -384,7 +384,7 @@ i
22
23
SET @@global.debug_dbug=@saved_dbug;
-include/stop_slave.inc
+include/stop_slave_sql.inc
DO_DOMAIN_IDS (BEFORE) :
IGNORE_DOMAIN_IDS (BEFORE) :
CHANGE MASTER TO IGNORE_DOMAIN_IDS=(1), MASTER_USE_GTID=slave_pos;
diff --git a/mysql-test/suite/rpl/r/rpl_domain_id_filter_master_crash.result b/mysql-test/suite/rpl/r/rpl_domain_id_filter_master_crash.result
index 0a414cb3..a54ff99b 100644
--- a/mysql-test/suite/rpl/r/rpl_domain_id_filter_master_crash.result
+++ b/mysql-test/suite/rpl/r/rpl_domain_id_filter_master_crash.result
@@ -38,7 +38,8 @@ connection master;
include/rpl_start_server.inc [server_number=1]
# Master has restarted successfully
connection slave;
-include/stop_slave.inc
+include/stop_slave_sql.inc
+include/stop_slave_io.inc
include/start_slave.inc
select * from ti;
a
diff --git a/mysql-test/suite/rpl/r/rpl_fail_register.result b/mysql-test/suite/rpl/r/rpl_fail_register.result
index 2cddc796..0398220c 100644
--- a/mysql-test/suite/rpl/r/rpl_fail_register.result
+++ b/mysql-test/suite/rpl/r/rpl_fail_register.result
@@ -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;
diff --git a/mysql-test/suite/rpl/r/rpl_gis_user_var.result b/mysql-test/suite/rpl/r/rpl_gis_user_var.result
new file mode 100644
index 00000000..c6aab9e0
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_gis_user_var.result
@@ -0,0 +1,21 @@
+include/master-slave.inc
+[connection master]
+#
+#
+#
+connection master;
+SET @p=POINT(1,1);
+CREATE TABLE t1 AS SELECT @p AS p;
+connection slave;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `p` point DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT ST_AsWKT(p) FROM t1;
+ST_AsWKT(p)
+POINT(1 1)
+connection master;
+DROP TABLE t1;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_gtid_basic.result b/mysql-test/suite/rpl/r/rpl_gtid_basic.result
index 584499a9..a7da7010 100644
--- a/mysql-test/suite/rpl/r/rpl_gtid_basic.result
+++ b/mysql-test/suite/rpl/r/rpl_gtid_basic.result
@@ -188,6 +188,13 @@ BINLOG_GTID_POS('master-bin.000001',18446744073709551616)
NULL
Warnings:
Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated
+SET sql_log_bin= 0;
+CREATE TABLE t1 AS SELECT MASTER_POS_WAIT(@binlog_file, 4, 0);
+SELECT BINLOG_GTID_POS(@binlog_file, 4);
+BINLOG_GTID_POS(@binlog_file, 4)
+NULL
+DROP TABLE t1;
+SET sql_log_bin= 1;
*** Some tests of @@GLOBAL.gtid_binlog_state ***
connection server_2;
include/sync_with_master_gtid.inc
diff --git a/mysql-test/suite/rpl/r/rpl_gtid_delete_domain.result b/mysql-test/suite/rpl/r/rpl_gtid_delete_domain.result
index 9c369734..9e788e8f 100644
--- a/mysql-test/suite/rpl/r/rpl_gtid_delete_domain.result
+++ b/mysql-test/suite/rpl/r/rpl_gtid_delete_domain.result
@@ -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'
diff --git a/mysql-test/suite/rpl/r/rpl_gtid_errorlog.result b/mysql-test/suite/rpl/r/rpl_gtid_errorlog.result
index 593f83a7..229ac02b 100644
--- a/mysql-test/suite/rpl/r/rpl_gtid_errorlog.result
+++ b/mysql-test/suite/rpl/r/rpl_gtid_errorlog.result
@@ -23,7 +23,8 @@ INSERT INTO t1 VALUES (2);
SET sql_log_bin=1;
START SLAVE;
include/wait_for_slave_sql_error.inc [errno=1062]
-include/stop_slave.inc
+include/wait_for_slave_io_to_start.inc
+include/stop_slave_io.inc
SET GLOBAL gtid_slave_pos= "0-1-100";
include/start_slave.inc
SELECT * FROM t1 ORDER BY a;
@@ -39,7 +40,7 @@ REPLACE INTO t1 VALUES (5);
SET debug_dbug= @dbug_save;
connection slave;
include/wait_for_slave_sql_error.inc [errno=1590]
-include/stop_slave.inc
+include/stop_slave_io.inc
SET sql_slave_skip_counter=1;
include/start_slave.inc
SELECT * FROM t1 ORDER BY a;
diff --git a/mysql-test/suite/rpl/r/rpl_gtid_slave_filtering.result b/mysql-test/suite/rpl/r/rpl_gtid_slave_filtering.result
new file mode 100644
index 00000000..84080b94
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_gtid_slave_filtering.result
@@ -0,0 +1,78 @@
+include/rpl_init.inc [topology=1->2->3]
+*** Test GTID master switch in a topology with filtered events.
+*** With --gtid-ignore-duplicate and --gtid-strict-mode, should allow
+*** GTID connect at a GTID position that is filtered on the new master.
+connection server_1;
+ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
+CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,1);
+CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
+INSERT INTO t3 VALUES (1,1);
+INSERT INTO t1 VALUES (2,1);
+INSERT INTO t3 VALUES (2,1);
+include/save_master_gtid.inc
+connection server_2;
+CREATE TABLE t2 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1,2);
+include/sync_with_master_gtid.inc
+include/save_master_gtid.inc
+connection server_3;
+include/sync_with_master_gtid.inc
+*** Promote 3 as new master, demote 2 as slave of 3.
+*** GTID position of 2 in domain 0 is filtered on 3.
+connection server_2;
+include/stop_slave.inc
+connection server_3;
+include/stop_slave.inc
+CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_1,
+MASTER_USE_GTID=SLAVE_POS;
+connection server_2;
+CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_3,
+MASTER_USE_GTID=SLAVE_POS;
+include/start_slave.inc
+connection server_3;
+include/start_slave.inc
+connection server_1;
+INSERT INTO t1 VALUES (3,1);
+INSERT INTO t3 VALUES (3,1);
+include/save_master_gtid.inc
+connection server_3;
+INSERT INTO t2 VALUES (2,2);
+include/sync_with_master_gtid.inc
+include/save_master_gtid.inc
+connection server_2;
+include/sync_with_master_gtid.inc
+SELECT * FROM t1 ORDER BY a;
+a b
+1 1
+2 1
+3 1
+SELECT * FROM t3 ORDER BY a;
+ERROR 42S02: Table 'test.t3' doesn't exist
+SELECT * FROM t2 ORDER BY a;
+a b
+1 2
+2 2
+*** Restore original topology.
+connection server_3;
+include/stop_slave.inc
+connection server_2;
+include/stop_slave.inc
+CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_1,
+MASTER_USE_GTID=SLAVE_POS;
+include/start_slave.inc
+connection server_3;
+CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_2,
+MASTER_USE_GTID=SLAVE_POS;
+include/start_slave.inc
+connection server_1;
+DROP TABLE t1;
+DROP TABLE t3;
+include/save_master_gtid.inc
+connection server_2;
+DROP TABLE t2;
+include/sync_with_master_gtid.inc
+include/save_master_gtid.inc
+connection server_3;
+include/sync_with_master_gtid.inc
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_gtid_startpos.result b/mysql-test/suite/rpl/r/rpl_gtid_startpos.result
index e38eddcc..f271e730 100644
--- a/mysql-test/suite/rpl/r/rpl_gtid_startpos.result
+++ b/mysql-test/suite/rpl/r/rpl_gtid_startpos.result
@@ -36,7 +36,7 @@ CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_PORT,
MASTER_USE_GTID=SLAVE_POS;
START SLAVE;
include/wait_for_slave_io_error.inc [errno=1236]
-include/stop_slave.inc
+include/stop_slave_sql.inc
CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_PORT,
MASTER_LOG_FILE="master-bin.000003", MASTER_LOG_POS=4, MASTER_USE_GTID=NO;
include/start_slave.inc
diff --git a/mysql-test/suite/rpl/r/rpl_heartbeat_basic.result b/mysql-test/suite/rpl/r/rpl_heartbeat_basic.result
index 88e02141..a9bd16cc 100644
--- a/mysql-test/suite/rpl/r/rpl_heartbeat_basic.result
+++ b/mysql-test/suite/rpl/r/rpl_heartbeat_basic.result
@@ -228,7 +228,7 @@ call mtr.add_suppression("Slave SQL.*Duplicate entry .1. for key .PRIMARY.. on q
call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
set sql_log_bin= 1;
Heartbeat events are received while sql thread stopped (1 means 'yes'): 1
-include/stop_slave.inc
+include/stop_slave_io.inc
set sql_log_bin= 0;
DROP TABLE t1;
set sql_log_bin= 1;
diff --git a/mysql-test/suite/rpl/r/rpl_invoked_features.result b/mysql-test/suite/rpl/r/rpl_invoked_features.result
index 43a8e862..3cfd40d5 100644
--- a/mysql-test/suite/rpl/r/rpl_invoked_features.result
+++ b/mysql-test/suite/rpl/r/rpl_invoked_features.result
@@ -45,14 +45,14 @@ BEGIN
UPDATE t12 SET c = '';
UPDATE t13 SET c = '';
END|
-CREATE EVENT e1 ON SCHEDULE EVERY 1 SECOND DISABLE DO
+CREATE EVENT e1 ON SCHEDULE EVERY 10 SECOND DISABLE DO
BEGIN
ALTER EVENT e1 DISABLE;
CALL p1(10, '');
END|
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
-CREATE EVENT e11 ON SCHEDULE EVERY 1 SECOND DISABLE DO
+CREATE EVENT e11 ON SCHEDULE EVERY 10 SECOND DISABLE DO
BEGIN
ALTER EVENT e11 DISABLE;
CALL p11(10, '');
diff --git a/mysql-test/suite/rpl/r/rpl_mariadb_slave_capability.result b/mysql-test/suite/rpl/r/rpl_mariadb_slave_capability.result
index 68e8b22d..fddb07c9 100644
--- a/mysql-test/suite/rpl/r/rpl_mariadb_slave_capability.result
+++ b/mysql-test/suite/rpl/r/rpl_mariadb_slave_capability.result
@@ -6,6 +6,11 @@ connection slave;
include/stop_slave.inc
CHANGE MASTER TO MASTER_USE_GTID=NO;
include/start_slave.inc
+connection master;
+# Ensure only the new binlog dump thread is alive (wait for the old one
+# to complete its kill)
+# And that it has already sent its fake rotate
+connection slave;
include/stop_slave.inc
# Test slave with no capability gets dummy event, which is ignored.
set @old_dbug= @@global.debug_dbug;
diff --git a/mysql-test/suite/rpl/r/rpl_mdev_17614.result b/mysql-test/suite/rpl/r/rpl_mdev_17614.result
index 0cc92474..7e2e8727 100644
--- a/mysql-test/suite/rpl/r/rpl_mdev_17614.result
+++ b/mysql-test/suite/rpl/r/rpl_mdev_17614.result
@@ -29,8 +29,7 @@ SELECT * FROM t1;
a b c
1 1 1
2 2 3
-stop slave;
-include/wait_for_slave_to_stop.inc
+include/stop_slave_io.inc
include/reset_slave.inc
connection master;
reset master;
@@ -189,8 +188,7 @@ SELECT * FROM t1;
a b c
1 1 1
2 2 3
-stop slave;
-include/wait_for_slave_to_stop.inc
+include/stop_slave_io.inc
include/reset_slave.inc
connection master;
reset master;
diff --git a/mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result b/mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result
index e94e097f..dbaceb65 100644
--- a/mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result
+++ b/mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result
@@ -197,7 +197,7 @@ SET GLOBAL max_binlog_cache_size= ORIGINAL_VALUE;
SET GLOBAL binlog_cache_size= ORIGINAL_VALUE;
SET GLOBAL max_binlog_stmt_cache_size= ORIGINAL_VALUE;
SET GLOBAL binlog_stmt_cache_size= ORIGINAL_VALUE;
-include/stop_slave.inc
+include/stop_slave_io.inc
include/start_slave.inc
connection master;
connection slave;
diff --git a/mysql-test/suite/rpl/r/rpl_parallel_ignored_errors.result b/mysql-test/suite/rpl/r/rpl_parallel_ignored_errors.result
index ce11b814..57654d15 100644
--- a/mysql-test/suite/rpl/r/rpl_parallel_ignored_errors.result
+++ b/mysql-test/suite/rpl/r/rpl_parallel_ignored_errors.result
@@ -36,7 +36,8 @@ connection server_2;
connection con_temp2;
COMMIT;
connection server_2;
-include/stop_slave.inc
+include/wait_for_slave_sql_error.inc [errno=1062]
+include/stop_slave_io.inc
include/assert.inc [table t1 should have zero rows where a>32]
SELECT * FROM t1 WHERE a>32;
a
diff --git a/mysql-test/suite/rpl/r/rpl_parallel_kill.result b/mysql-test/suite/rpl/r/rpl_parallel_kill.result
index 7e6b0657..8772ac99 100644
--- a/mysql-test/suite/rpl/r/rpl_parallel_kill.result
+++ b/mysql-test/suite/rpl/r/rpl_parallel_kill.result
@@ -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;
@@ -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;
@@ -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;
diff --git a/mysql-test/suite/rpl/r/rpl_parallel_missed_error_handling.result b/mysql-test/suite/rpl/r/rpl_parallel_missed_error_handling.result
index e9d04c02..c9094c8b 100644
--- a/mysql-test/suite/rpl/r/rpl_parallel_missed_error_handling.result
+++ b/mysql-test/suite/rpl/r/rpl_parallel_missed_error_handling.result
@@ -38,7 +38,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
diff --git a/mysql-test/suite/rpl/r/rpl_row_big_table_id.result b/mysql-test/suite/rpl/r/rpl_row_big_table_id.result
index 694a6132..0c51e58f 100644
--- a/mysql-test/suite/rpl/r/rpl_row_big_table_id.result
+++ b/mysql-test/suite/rpl/r/rpl_row_big_table_id.result
@@ -21,22 +21,22 @@ master-bin.000001 # Gtid 1 # GTID #-#-#
master-bin.000001 # Query 1 # use `test`; ALTER TABLE t comment ''
master-bin.000001 # Gtid 1 # BEGIN GTID #-#-#
master-bin.000001 # Annotate_rows 1 # INSERT INTO t SET a= 1
-master-bin.000001 # Table_map 1 # table_id: 4294967295 (test.t)
-master-bin.000001 # Write_rows_v1 1 # table_id: 4294967295 flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: 4294967296 (test.t)
+master-bin.000001 # Write_rows_v1 1 # table_id: 4294967296 flags: STMT_END_F
master-bin.000001 # Query 1 # COMMIT
master-bin.000001 # Gtid 1 # GTID #-#-#
master-bin.000001 # Query 1 # use `test`; ALTER TABLE t comment ''
master-bin.000001 # Gtid 1 # BEGIN GTID #-#-#
master-bin.000001 # Annotate_rows 1 # INSERT INTO t SET a= 2
-master-bin.000001 # Table_map 1 # table_id: 4294967296 (test.t)
-master-bin.000001 # Write_rows_v1 1 # table_id: 4294967296 flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: 4294967297 (test.t)
+master-bin.000001 # Write_rows_v1 1 # table_id: 4294967297 flags: STMT_END_F
master-bin.000001 # Query 1 # COMMIT
master-bin.000001 # Gtid 1 # GTID #-#-#
master-bin.000001 # Query 1 # use `test`; ALTER TABLE t comment ''
master-bin.000001 # Gtid 1 # BEGIN GTID #-#-#
master-bin.000001 # Annotate_rows 1 # INSERT INTO t SET a= 3
-master-bin.000001 # Table_map 1 # table_id: 4294967297 (test.t)
-master-bin.000001 # Write_rows_v1 1 # table_id: 4294967297 flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: 4294967298 (test.t)
+master-bin.000001 # Write_rows_v1 1 # table_id: 4294967298 flags: STMT_END_F
master-bin.000001 # Query 1 # COMMIT
connection slave;
connection master;
diff --git a/mysql-test/suite/rpl/r/rpl_row_binlog_max_cache_size.result b/mysql-test/suite/rpl/r/rpl_row_binlog_max_cache_size.result
index a8e569aa..e1000835 100644
--- a/mysql-test/suite/rpl/r/rpl_row_binlog_max_cache_size.result
+++ b/mysql-test/suite/rpl/r/rpl_row_binlog_max_cache_size.result
@@ -191,7 +191,7 @@ SET GLOBAL max_binlog_cache_size= ORIGINAL_VALUE;
SET GLOBAL binlog_cache_size= ORIGINAL_VALUE;
SET GLOBAL max_binlog_stmt_cache_size= ORIGINAL_VALUE;
SET GLOBAL binlog_stmt_cache_size= ORIGINAL_VALUE;
-include/stop_slave.inc
+include/stop_slave_io.inc
include/start_slave.inc
connection master;
connection slave;
diff --git a/mysql-test/suite/rpl/r/rpl_row_corruption.result b/mysql-test/suite/rpl/r/rpl_row_corruption.result
index 24535460..1950617a 100644
--- a/mysql-test/suite/rpl/r/rpl_row_corruption.result
+++ b/mysql-test/suite/rpl/r/rpl_row_corruption.result
@@ -14,7 +14,7 @@ connection master;
UPDATE t1_11753004, t2_11753004 SET t1_11753004.c1=3, t2_11753004.c1=4 WHERE t1_11753004.c1=1 OR t2_11753004.c1=2;
connection slave;
include/wait_for_slave_sql_error.inc [errno=1593 ]
-include/stop_slave.inc
+include/stop_slave_io.inc
SET @@global.debug_dbug=@saved_debug;
include/start_slave.inc
connection master;
diff --git a/mysql-test/suite/rpl/r/rpl_row_idempotency.result b/mysql-test/suite/rpl/r/rpl_row_idempotency.result
index c655ae67..061cc836 100644
--- a/mysql-test/suite/rpl/r/rpl_row_idempotency.result
+++ b/mysql-test/suite/rpl/r/rpl_row_idempotency.result
@@ -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 */;
@@ -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) */;
@@ -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;
@@ -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';
@@ -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';
@@ -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';
@@ -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';
diff --git a/mysql-test/suite/rpl/r/rpl_row_until.result b/mysql-test/suite/rpl/r/rpl_row_until.result
index 8ef10bf4..b4e3704c 100644
--- a/mysql-test/suite/rpl/r/rpl_row_until.result
+++ b/mysql-test/suite/rpl/r/rpl_row_until.result
@@ -51,7 +51,9 @@ ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UN
START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', MASTER_LOG_POS=MASTER_LOG_POS;
ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=MASTER_LOG_POS;
-include/stop_slave.inc
+include/wait_for_slave_io_to_start.inc
+include/wait_for_slave_sql_to_stop.inc
+include/stop_slave_io.inc
include/reset_slave.inc
include/start_slave.inc
include/rpl_reset.inc
diff --git a/mysql-test/suite/rpl/r/rpl_seconds_behind_master_spike.result b/mysql-test/suite/rpl/r/rpl_seconds_behind_master_spike.result
index 9c7a257c..c208ee2e 100644
--- a/mysql-test/suite/rpl/r/rpl_seconds_behind_master_spike.result
+++ b/mysql-test/suite/rpl/r/rpl_seconds_behind_master_spike.result
@@ -6,7 +6,8 @@ CHANGE MASTER TO MASTER_USE_GTID=NO;
include/start_slave.inc
include/stop_slave.inc
SET @save_dbug= @@GLOBAL.debug_dbug;
-SET @@global.debug_dbug="+d,pause_sql_thread_on_fde,negate_clock_diff_with_master";
+SET @@global.debug_dbug="+d,pause_sql_thread_on_relay_fde_after_trans";
+SET @@global.debug_dbug="+d,negate_clock_diff_with_master";
include/start_slave.inc
# Future events must be logged at least 2 seconds after
# the slave starts
@@ -18,11 +19,6 @@ insert into t1 values (1);
# event in its relay log
flush logs;
connection slave;
-# Ignore FDEs that happen before the CREATE/INSERT commands
-SET DEBUG_SYNC='now WAIT_FOR paused_on_fde';
-SET DEBUG_SYNC='now SIGNAL sql_thread_continue';
-SET DEBUG_SYNC='now WAIT_FOR paused_on_fde';
-SET DEBUG_SYNC='now SIGNAL sql_thread_continue';
# On the next FDE, the slave should have the master CREATE/INSERT events
SET DEBUG_SYNC='now WAIT_FOR paused_on_fde';
select count(*)=1 from t1;
diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync.result b/mysql-test/suite/rpl/r/rpl_semi_sync.result
index edd5e774..03e3443b 100644
--- a/mysql-test/suite/rpl/r/rpl_semi_sync.result
+++ b/mysql-test/suite/rpl/r/rpl_semi_sync.result
@@ -7,7 +7,6 @@ call mtr.add_suppression("Unsafe statement written to the binary log using state
call mtr.add_suppression("mysqld: Got an error reading communication packets");
connection slave;
set sql_log_bin=0;
-call mtr.add_suppression("Master server does not support semi-sync");
call mtr.add_suppression("Semi-sync slave .* reply");
call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
set sql_log_bin=1;
@@ -28,7 +27,7 @@ set global rpl_semi_sync_slave_enabled= 0;
# Main test of semi-sync replication start here
#
connection master;
-set global rpl_semi_sync_master_timeout= 60000;
+set global rpl_semi_sync_master_timeout= 2000;
[ default state of semi-sync on master should be OFF ]
show variables like 'rpl_semi_sync_master_enabled';
Variable_name Value
@@ -163,11 +162,15 @@ connection slave;
# Test semi-sync master will switch OFF after one transaction
# timeout waiting for slave reply.
#
+connection master;
+show status like "Rpl_semi_sync_master_status";
+Variable_name Value
+Rpl_semi_sync_master_status ON
connection slave;
include/stop_slave.inc
connection master;
include/kill_binlog_dump_threads.inc
-set global rpl_semi_sync_master_timeout= 5000;
+set global rpl_semi_sync_master_timeout= 2000;
[ master status should be ON ]
show status like 'Rpl_semi_sync_master_no_tx';
Variable_name Value
@@ -317,6 +320,8 @@ include/kill_binlog_dump_threads.inc
connection slave;
include/start_slave.inc
connection master;
+connection slave;
+connection master;
create table t1 (a int) engine = ENGINE_TYPE;
insert into t1 values (1);
insert into t1 values (2), (3);
@@ -359,6 +364,8 @@ show status like 'Rpl_semi_sync_slave_status';
Variable_name Value
Rpl_semi_sync_slave_status ON
connection master;
+connection slave;
+connection master;
[ master semi-sync should be ON ]
show status like 'Rpl_semi_sync_master_clients';
Variable_name Value
diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync_after_sync.result b/mysql-test/suite/rpl/r/rpl_semi_sync_after_sync.result
index 7341eb54..a79b372f 100644
--- a/mysql-test/suite/rpl/r/rpl_semi_sync_after_sync.result
+++ b/mysql-test/suite/rpl/r/rpl_semi_sync_after_sync.result
@@ -8,7 +8,6 @@ call mtr.add_suppression("Unsafe statement written to the binary log using state
call mtr.add_suppression("mysqld: Got an error reading communication packets");
connection slave;
set sql_log_bin=0;
-call mtr.add_suppression("Master server does not support semi-sync");
call mtr.add_suppression("Semi-sync slave .* reply");
call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
set sql_log_bin=1;
@@ -29,7 +28,7 @@ set global rpl_semi_sync_slave_enabled= 0;
# Main test of semi-sync replication start here
#
connection master;
-set global rpl_semi_sync_master_timeout= 60000;
+set global rpl_semi_sync_master_timeout= 2000;
[ default state of semi-sync on master should be OFF ]
show variables like 'rpl_semi_sync_master_enabled';
Variable_name Value
@@ -164,11 +163,15 @@ connection slave;
# Test semi-sync master will switch OFF after one transaction
# timeout waiting for slave reply.
#
+connection master;
+show status like "Rpl_semi_sync_master_status";
+Variable_name Value
+Rpl_semi_sync_master_status ON
connection slave;
include/stop_slave.inc
connection master;
include/kill_binlog_dump_threads.inc
-set global rpl_semi_sync_master_timeout= 5000;
+set global rpl_semi_sync_master_timeout= 2000;
[ master status should be ON ]
show status like 'Rpl_semi_sync_master_no_tx';
Variable_name Value
@@ -318,6 +321,8 @@ include/kill_binlog_dump_threads.inc
connection slave;
include/start_slave.inc
connection master;
+connection slave;
+connection master;
create table t1 (a int) engine = ENGINE_TYPE;
insert into t1 values (1);
insert into t1 values (2), (3);
@@ -360,6 +365,8 @@ show status like 'Rpl_semi_sync_slave_status';
Variable_name Value
Rpl_semi_sync_slave_status ON
connection master;
+connection slave;
+connection master;
[ master semi-sync should be ON ]
show status like 'Rpl_semi_sync_master_clients';
Variable_name Value
diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync_after_sync_row.result b/mysql-test/suite/rpl/r/rpl_semi_sync_after_sync_row.result
index d75a3a2c..393c9c55 100644
--- a/mysql-test/suite/rpl/r/rpl_semi_sync_after_sync_row.result
+++ b/mysql-test/suite/rpl/r/rpl_semi_sync_after_sync_row.result
@@ -8,7 +8,6 @@ call mtr.add_suppression("Unsafe statement written to the binary log using state
call mtr.add_suppression("mysqld: Got an error reading communication packets");
connection slave;
set sql_log_bin=0;
-call mtr.add_suppression("Master server does not support semi-sync");
call mtr.add_suppression("Semi-sync slave .* reply");
call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
set sql_log_bin=1;
@@ -29,7 +28,7 @@ set global rpl_semi_sync_slave_enabled= 0;
# Main test of semi-sync replication start here
#
connection master;
-set global rpl_semi_sync_master_timeout= 60000;
+set global rpl_semi_sync_master_timeout= 2000;
[ default state of semi-sync on master should be OFF ]
show variables like 'rpl_semi_sync_master_enabled';
Variable_name Value
@@ -164,11 +163,15 @@ connection slave;
# Test semi-sync master will switch OFF after one transaction
# timeout waiting for slave reply.
#
+connection master;
+show status like "Rpl_semi_sync_master_status";
+Variable_name Value
+Rpl_semi_sync_master_status ON
connection slave;
include/stop_slave.inc
connection master;
include/kill_binlog_dump_threads.inc
-set global rpl_semi_sync_master_timeout= 5000;
+set global rpl_semi_sync_master_timeout= 2000;
[ master status should be ON ]
show status like 'Rpl_semi_sync_master_no_tx';
Variable_name Value
@@ -318,6 +321,8 @@ include/kill_binlog_dump_threads.inc
connection slave;
include/start_slave.inc
connection master;
+connection slave;
+connection master;
create table t1 (a int) engine = ENGINE_TYPE;
insert into t1 values (1);
insert into t1 values (2), (3);
@@ -360,6 +365,8 @@ show status like 'Rpl_semi_sync_slave_status';
Variable_name Value
Rpl_semi_sync_slave_status ON
connection master;
+connection slave;
+connection master;
[ master semi-sync should be ON ]
show status like 'Rpl_semi_sync_master_clients';
Variable_name Value
diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync_event.result b/mysql-test/suite/rpl/r/rpl_semi_sync_event.result
index 917e7c2b..b1eb623c 100644
--- a/mysql-test/suite/rpl/r/rpl_semi_sync_event.result
+++ b/mysql-test/suite/rpl/r/rpl_semi_sync_event.result
@@ -7,7 +7,6 @@ call mtr.add_suppression("Read semi-sync reply");
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.");
call mtr.add_suppression("mysqld: Got an error reading communication packets");
connection slave;
-call mtr.add_suppression("Master server does not support semi-sync");
call mtr.add_suppression("Semi-sync slave .* reply");
call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
connection master;
diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync_event_after_sync.result b/mysql-test/suite/rpl/r/rpl_semi_sync_event_after_sync.result
index 24daf0d7..34af8d31 100644
--- a/mysql-test/suite/rpl/r/rpl_semi_sync_event_after_sync.result
+++ b/mysql-test/suite/rpl/r/rpl_semi_sync_event_after_sync.result
@@ -8,7 +8,6 @@ call mtr.add_suppression("Read semi-sync reply");
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.");
call mtr.add_suppression("mysqld: Got an error reading communication packets");
connection slave;
-call mtr.add_suppression("Master server does not support semi-sync");
call mtr.add_suppression("Semi-sync slave .* reply");
call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
connection master;
diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync_fail_over.result b/mysql-test/suite/rpl/r/rpl_semi_sync_fail_over.result
index 8956eee2..1c94c239 100644
--- a/mysql-test/suite/rpl/r/rpl_semi_sync_fail_over.result
+++ b/mysql-test/suite/rpl/r/rpl_semi_sync_fail_over.result
@@ -5,6 +5,7 @@ include/stop_slave.inc
connection server_1;
RESET MASTER;
SET @@global.max_binlog_size= 4096;
+set @@global.rpl_semi_sync_master_enabled = 1;
connection server_2;
RESET MASTER;
SET @@global.max_binlog_size= 4096;
@@ -14,7 +15,6 @@ CHANGE MASTER TO master_use_gtid= slave_pos;
include/start_slave.inc
connection server_1;
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
-set @@global.rpl_semi_sync_master_enabled = 1;
set @@global.rpl_semi_sync_master_wait_point=AFTER_SYNC;
CREATE TABLE t1 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Innodb;
INSERT INTO t1 VALUES (1, 'dummy1');
diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync_master_shutdown.result b/mysql-test/suite/rpl/r/rpl_semi_sync_master_shutdown.result
index 786e1682..6124ba01 100644
--- a/mysql-test/suite/rpl/r/rpl_semi_sync_master_shutdown.result
+++ b/mysql-test/suite/rpl/r/rpl_semi_sync_master_shutdown.result
@@ -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;
diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync_no_missed_ack_after_add_slave.result b/mysql-test/suite/rpl/r/rpl_semi_sync_no_missed_ack_after_add_slave.result
new file mode 100644
index 00000000..19fed30f
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_semi_sync_no_missed_ack_after_add_slave.result
@@ -0,0 +1,48 @@
+include/rpl_init.inc [topology=1->2,1->3]
+connection server_1;
+set @old_enabled= @@global.rpl_semi_sync_master_enabled;
+set @old_timeout= @@global.rpl_semi_sync_master_timeout;
+set global rpl_semi_sync_master_enabled= 1;
+set global rpl_semi_sync_master_timeout= 500;
+connection server_2;
+include/stop_slave.inc
+set @old_enabled= @@global.rpl_semi_sync_slave_enabled;
+set @old_dbug= @@global.debug_dbug;
+set global rpl_semi_sync_slave_enabled= 1;
+set global debug_dbug="+d,simulate_delay_semisync_slave_reply";
+include/start_slave.inc
+connection server_3;
+include/stop_slave.inc
+set @old_enabled= @@global.rpl_semi_sync_slave_enabled;
+set global rpl_semi_sync_slave_enabled= 1;
+include/start_slave.inc
+# Ensure primary recognizes both replicas are semi-sync
+connection server_1;
+connection server_1;
+create table t1 (a int);
+connection server_2;
+# Verifying server_2 did not send ACK
+connection server_3;
+# Verifying server_3 did send ACK
+connection server_1;
+# Verifying master's semi-sync status is still ON (This failed pre-MDEV-32960 fixes)
+# Verifying rpl_semi_sync_master_yes_tx incremented
+#
+# Cleanup
+connection server_2;
+set global rpl_semi_sync_slave_enabled= @old_enabled;
+set global debug_dbug= @old_dbug;
+include/stop_slave.inc
+connection server_3;
+set global rpl_semi_sync_slave_enabled= @old_enabled;
+include/stop_slave.inc
+connection server_1;
+set global rpl_semi_sync_master_enabled= @old_enabled;
+set global rpl_semi_sync_master_timeout= @old_timeout;
+drop table t1;
+connection server_2;
+include/start_slave.inc
+connection server_3;
+include/start_slave.inc
+include/rpl_end.inc
+# End of rpl_semi_sync_no_missed_ack_after_add_slave.test
diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync_slave_enabled_consistent.result b/mysql-test/suite/rpl/r/rpl_semi_sync_slave_enabled_consistent.result
new file mode 100644
index 00000000..99c31249
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_semi_sync_slave_enabled_consistent.result
@@ -0,0 +1,35 @@
+include/master-slave.inc
+[connection master]
+call mtr.add_suppression("Replication event checksum verification failed");
+call mtr.add_suppression("could not queue event from master");
+#
+# Set up a semisync connection
+connection master;
+set @@global.rpl_semi_sync_master_enabled= ON;
+connection slave;
+stop slave io_thread;
+set @@global.rpl_semi_sync_slave_enabled= ON;
+set @old_dbug= @@global.debug_dbug;
+set @@global.debug_dbug= "+d,corrupt_queue_event";
+set @@global.debug_dbug= "+d,pause_before_io_read_event";
+set @@global.debug_dbug= "+d,placeholder";
+start slave io_thread;
+# Disable semi-sync on the slave while the IO thread is active
+set debug_sync='now wait_for io_thread_at_read_event';
+set @@global.rpl_semi_sync_slave_enabled= OFF;
+set debug_sync='now signal io_thread_continue_read_event';
+# Waiting for the slave to stop with the error from corrupt_queue_event
+connection slave;
+include/wait_for_slave_io_error.inc [errno=1595,1743]
+# Sleep 1 to give time for Ack_receiver to receive COM_QUIT
+include/assert_grep.inc [Check that there is no 'Read semi-sync reply magic number error' in error log.]
+#
+# Cleanup
+connection slave;
+include/stop_slave.inc
+set @@global.debug_dbug= @old_dbug;
+include/start_slave.inc
+connection master;
+set @@global.rpl_semi_sync_master_enabled= default;
+include/rpl_end.inc
+# End of rpl_semi_sync_slave_enabled_consistent.test
diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync_slave_reply_fail.result b/mysql-test/suite/rpl/r/rpl_semi_sync_slave_reply_fail.result
index f026a1c9..3c9cf71a 100644
--- a/mysql-test/suite/rpl/r/rpl_semi_sync_slave_reply_fail.result
+++ b/mysql-test/suite/rpl/r/rpl_semi_sync_slave_reply_fail.result
@@ -4,6 +4,7 @@ connection slave;
include/stop_slave.inc
connection master;
call mtr.add_suppression("Timeout waiting for reply of binlog*");
+call mtr.add_suppression("Master server does not read semi-sync messages*");
set global rpl_semi_sync_master_enabled = ON;
SET @@GLOBAL.rpl_semi_sync_master_timeout=100;
create table t1 (i int);
@@ -15,8 +16,8 @@ SET GLOBAL debug_dbug="+d,semislave_failed_net_flush";
include/start_slave.inc
connection master;
connection slave;
-"Assert that the net_fulsh() reply failed is present in slave error log.
-FOUND 1 /Semi-sync slave net_flush\(\) reply failed/ in mysqld.2.err
+"Assert that Master server does not read semi-sync messages" is present in slave error log.
+FOUND 1 /Master server does not read semi-sync messages/ in mysqld.2.err
"Assert that Slave IO thread is up and running."
SHOW STATUS LIKE 'Slave_running';
Variable_name Value
@@ -32,7 +33,7 @@ connection slave;
include/diff_tables.inc [master:t1, slave:t1]
connection master;
set statement sql_log_bin=0 for call mtr.add_suppression("Read semi-sync reply magic number error");
-SET @save_debug_master= @@global.debug;
+SET @save_debug_master= @@global.debug_dbug;
SET GLOBAL debug_dbug="+d,semisync_corrupt_magic";
insert into t1 values (11);
connection slave;
diff --git a/mysql-test/suite/rpl/r/rpl_semisync_ali_issues.result b/mysql-test/suite/rpl/r/rpl_semisync_ali_issues.result
index 36a2bac5..d7f87ae5 100644
--- a/mysql-test/suite/rpl/r/rpl_semisync_ali_issues.result
+++ b/mysql-test/suite/rpl/r/rpl_semisync_ali_issues.result
@@ -14,7 +14,6 @@ CALL mtr.add_suppression("Failed on request_dump()*");
CALL mtr.add_suppression("Semi-sync master failed on*");
CALL mtr.add_suppression("Master command COM_BINLOG_DUMP failed*");
CALL mtr.add_suppression("on master failed*");
-CALL mtr.add_suppression("Master server does not support semi-sync*");
CALL mtr.add_suppression("Semi-sync slave net_flush*");
CALL mtr.add_suppression("Failed to flush master info*");
CALL mtr.add_suppression("Request to stop slave SQL Thread received while apply*");
@@ -196,7 +195,7 @@ Variable_name Value
Rpl_semi_sync_master_clients 0
show status like 'Rpl_semi_sync_master_status';
Variable_name Value
-Rpl_semi_sync_master_status OFF
+Rpl_semi_sync_master_status ON
connection slave;
START SLAVE IO_THREAD;
include/wait_for_slave_io_to_start.inc
@@ -270,16 +269,12 @@ Variable_name Value
Rpl_semi_sync_master_clients 1
# Test failure of select error .
SET GLOBAL debug = 'd,rpl_semisync_simulate_select_error';
-Warnings:
-Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
INSERT INTO t1 VALUES(3);
connection slave;
connection con1;
# Test failure of pthread_create
SET GLOBAL rpl_semi_sync_master_enabled = 0;
SET GLOBAL debug = 'd,rpl_semisync_simulate_create_thread_failure';
-Warnings:
-Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
SET GLOBAL rpl_semi_sync_master_enabled= ON;
# Test failure of pthread_join
SET GLOBAL rpl_semi_sync_master_enabled= OFF;
@@ -287,8 +282,6 @@ SET GLOBAL rpl_semi_sync_master_enabled= OFF;
# Failure on registering semisync slave
#
SET GLOBAL debug= 'd,rpl_semisync_simulate_add_slave_failure';
-Warnings:
-Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
SET GLOBAL rpl_semi_sync_master_enabled= ON;
connection slave;
STOP SLAVE IO_THREAD;
@@ -297,8 +290,6 @@ START SLAVE IO_THREAD;
include/wait_for_slave_io_to_start.inc
connection con1;
SET GLOBAL debug='';
-Warnings:
-Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
connection slave;
START SLAVE IO_THREAD;
include/wait_for_slave_io_to_start.inc
diff --git a/mysql-test/suite/rpl/r/rpl_session_var.result b/mysql-test/suite/rpl/r/rpl_session_var.result
index 67863583..f9794df3 100644
--- a/mysql-test/suite/rpl/r/rpl_session_var.result
+++ b/mysql-test/suite/rpl/r/rpl_session_var.result
@@ -1,5 +1,16 @@
include/master-slave.inc
[connection master]
+select @@rpl_semi_sync_master_enabled;
+@@rpl_semi_sync_master_enabled
+0
+connection slave;
+select @@rpl_semi_sync_slave_enabled;
+@@rpl_semi_sync_slave_enabled
+0
+show status like "rpl_semi_sync_slave_status";
+Variable_name Value
+Rpl_semi_sync_slave_status OFF
+connection master;
drop table if exists t1;
Warnings:
Note 1051 Unknown table 'test.t1'
diff --git a/mysql-test/suite/rpl/r/rpl_session_var2.result b/mysql-test/suite/rpl/r/rpl_session_var2.result
new file mode 100644
index 00000000..645eca02
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_session_var2.result
@@ -0,0 +1,69 @@
+include/master-slave.inc
+[connection master]
+select @@rpl_semi_sync_master_enabled;
+@@rpl_semi_sync_master_enabled
+1
+connection slave;
+select @@rpl_semi_sync_slave_enabled;
+@@rpl_semi_sync_slave_enabled
+1
+show status like "rpl_semi_sync_slave_status";
+Variable_name Value
+Rpl_semi_sync_slave_status ON
+connection master;
+drop table if exists t1;
+Warnings:
+Note 1051 Unknown table 'test.t1'
+create table t1(a varchar(100),b int);
+set @@session.sql_mode=pipes_as_concat;
+insert into t1 values('My'||'SQL', 1);
+set @@session.sql_mode=default;
+insert into t1 values('1'||'2', 2);
+select * from t1 where b<3 order by a;
+a b
+1 2
+MySQL 1
+connection slave;
+select * from t1 where b<3 order by a;
+a b
+1 2
+MySQL 1
+connection master;
+set @@session.sql_mode=ignore_space;
+insert into t1 values(password ('MySQL'), 3);
+set @@session.sql_mode=ansi_quotes;
+create table "t2" ("a" int);
+drop table t1, t2;
+set @@session.sql_mode=default;
+create table t1(a int auto_increment primary key);
+create table t2(b int, a int);
+set @@session.sql_auto_is_null=1;
+insert into t1 values(null);
+insert into t2 select 1,a from t1 where a is null;
+set @@session.sql_auto_is_null=0;
+insert into t1 values(null);
+insert into t2 select 2,a from t1 where a is null;
+select * from t2 order by b;
+b a
+1 1
+connection slave;
+select * from t2 order by b;
+b a
+1 1
+connection master;
+drop table t1,t2;
+connection slave;
+connection master;
+CREATE TABLE t1 (
+`id` int(11) NOT NULL auto_increment,
+`data` varchar(100),
+PRIMARY KEY (`id`)
+) ENGINE=MyISAM;
+INSERT INTO t1(data) VALUES(SESSION_USER());
+connection slave;
+SELECT length(data) < 100 FROM t1;
+length(data) < 100
+1
+connection master;
+drop table t1;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_set_statement_default_master.result b/mysql-test/suite/rpl/r/rpl_set_statement_default_master.result
index 828e1715..46f5a7c9 100644
--- a/mysql-test/suite/rpl/r/rpl_set_statement_default_master.result
+++ b/mysql-test/suite/rpl/r/rpl_set_statement_default_master.result
@@ -14,6 +14,7 @@ RESET SLAVE ALL;
CHANGE MASTER 'm1' TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_MYPORT, MASTER_USER='root';
SET STATEMENT default_master_connection = 'm1' FOR START SLAVE;
set default_master_connection = 'm1';
+include/wait_for_slave_to_start.inc
stop slave;
include/wait_for_slave_to_stop.inc
reset slave all;
diff --git a/mysql-test/suite/rpl/r/rpl_slave_load_tmpdir_not_exist.result b/mysql-test/suite/rpl/r/rpl_slave_load_tmpdir_not_exist.result
index 249f3514..e9a96fc4 100644
--- a/mysql-test/suite/rpl/r/rpl_slave_load_tmpdir_not_exist.result
+++ b/mysql-test/suite/rpl/r/rpl_slave_load_tmpdir_not_exist.result
@@ -4,6 +4,7 @@ connection slave;
START SLAVE;
call mtr.add_suppression("Slave SQL.*Unable to use slave.s temporary directory");
include/wait_for_slave_sql_error.inc [errno=12]
+include/wait_for_slave_io_to_start.inc
include/stop_slave_io.inc
RESET SLAVE;
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_slave_status.result b/mysql-test/suite/rpl/r/rpl_slave_status.result
index 1c81cec2..ef122b9c 100644
--- a/mysql-test/suite/rpl/r/rpl_slave_status.result
+++ b/mysql-test/suite/rpl/r/rpl_slave_status.result
@@ -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) ====
diff --git a/mysql-test/suite/rpl/r/rpl_sql_thd_start_errno_cleared.result b/mysql-test/suite/rpl/r/rpl_sql_thd_start_errno_cleared.result
index b14f7b01..a3e98afa 100644
--- a/mysql-test/suite/rpl/r/rpl_sql_thd_start_errno_cleared.result
+++ b/mysql-test/suite/rpl/r/rpl_sql_thd_start_errno_cleared.result
@@ -34,6 +34,7 @@ set debug_sync= "now wait_for sql_thread_run_lock_released";
# Validating that Last_SQL_Errno is cleared..
# ..success
set debug_sync= "now signal sql_thread_continue";
+# Wait for debug_sync signal to have been received before issuing RESET
set @@global.debug_dbug= @saved_dbug;
set debug_sync= "RESET";
# Cleanup
diff --git a/mysql-test/suite/rpl/r/rpl_ssl1.result b/mysql-test/suite/rpl/r/rpl_ssl1.result
index 1d55fe12..0cb21716 100644
--- a/mysql-test/suite/rpl/r/rpl_ssl1.result
+++ b/mysql-test/suite/rpl/r/rpl_ssl1.result
@@ -14,8 +14,8 @@ insert into t1 values (1);
connection slave;
select * from t1;
t
-stop slave;
-include/wait_for_slave_to_stop.inc
+include/wait_for_slave_io_error.inc [errno=1045]
+include/stop_slave_sql.inc
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
diff --git a/mysql-test/suite/rpl/r/rpl_start_alter_1.result b/mysql-test/suite/rpl/r/rpl_start_alter_1.result
index 9edb2321..de7c0875 100644
--- a/mysql-test/suite/rpl/r/rpl_start_alter_1.result
+++ b/mysql-test/suite/rpl/r/rpl_start_alter_1.result
@@ -1,6 +1,7 @@
include/master-slave.inc
[connection master]
connection master;
+ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
set global binlog_alter_two_phase = ON;
set binlog_alter_two_phase = ON;
connection slave;
diff --git a/mysql-test/suite/rpl/r/rpl_start_alter_2.result b/mysql-test/suite/rpl/r/rpl_start_alter_2.result
index a862fc55..49af973f 100644
--- a/mysql-test/suite/rpl/r/rpl_start_alter_2.result
+++ b/mysql-test/suite/rpl/r/rpl_start_alter_2.result
@@ -1,6 +1,7 @@
include/master-slave.inc
[connection master]
connection master;
+ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
set global binlog_alter_two_phase = ON;
set binlog_alter_two_phase = ON;
connection slave;
diff --git a/mysql-test/suite/rpl/r/rpl_start_alter_3.result b/mysql-test/suite/rpl/r/rpl_start_alter_3.result
index 97754401..31d0023b 100644
--- a/mysql-test/suite/rpl/r/rpl_start_alter_3.result
+++ b/mysql-test/suite/rpl/r/rpl_start_alter_3.result
@@ -1,6 +1,7 @@
include/master-slave.inc
[connection master]
connection master;
+ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
set global binlog_alter_two_phase = ON;
set binlog_alter_two_phase = ON;
connection slave;
diff --git a/mysql-test/suite/rpl/r/rpl_start_alter_4.result b/mysql-test/suite/rpl/r/rpl_start_alter_4.result
index 9d7d6376..819bcda0 100644
--- a/mysql-test/suite/rpl/r/rpl_start_alter_4.result
+++ b/mysql-test/suite/rpl/r/rpl_start_alter_4.result
@@ -1,6 +1,7 @@
include/master-slave.inc
[connection master]
connection master;
+ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
set global binlog_alter_two_phase = ON;
set binlog_alter_two_phase = ON;
connection slave;
diff --git a/mysql-test/suite/rpl/r/rpl_start_alter_5.result b/mysql-test/suite/rpl/r/rpl_start_alter_5.result
index 4e592c19..ef19cd8f 100644
--- a/mysql-test/suite/rpl/r/rpl_start_alter_5.result
+++ b/mysql-test/suite/rpl/r/rpl_start_alter_5.result
@@ -1,6 +1,7 @@
include/master-slave.inc
[connection master]
connection master;
+ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
set global binlog_alter_two_phase = ON;
set binlog_alter_two_phase = ON;
connection slave;
diff --git a/mysql-test/suite/rpl/r/rpl_start_alter_6.result b/mysql-test/suite/rpl/r/rpl_start_alter_6.result
index 6c26d511..59a83631 100644
--- a/mysql-test/suite/rpl/r/rpl_start_alter_6.result
+++ b/mysql-test/suite/rpl/r/rpl_start_alter_6.result
@@ -1,6 +1,7 @@
include/master-slave.inc
[connection master]
connection master;
+ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
set global binlog_alter_two_phase = ON;
set binlog_alter_two_phase = ON;
connection slave;
diff --git a/mysql-test/suite/rpl/r/rpl_start_alter_7.result b/mysql-test/suite/rpl/r/rpl_start_alter_7.result
index cfe31497..df7664d4 100644
--- a/mysql-test/suite/rpl/r/rpl_start_alter_7.result
+++ b/mysql-test/suite/rpl/r/rpl_start_alter_7.result
@@ -10,6 +10,10 @@ Warnings:
Note 1255 Slave already has been stopped
set global binlog_alter_two_phase=true;
connection server_3;
+SET STATEMENT sql_log_bin=0 FOR
+CALL mtr.add_suppression("The table mysql.gtid_slave_pos was removed. This change will not take full effect until all SQL threads have been restarted");
+SET STATEMENT sql_log_bin=0 FOR
+ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
SET GLOBAL slave_parallel_threads=8;
set global slave_parallel_mode=optimistic;
set global gtid_strict_mode=1;
diff --git a/mysql-test/suite/rpl/r/rpl_start_alter_8.result b/mysql-test/suite/rpl/r/rpl_start_alter_8.result
index 8002f295..406f2d1f 100644
--- a/mysql-test/suite/rpl/r/rpl_start_alter_8.result
+++ b/mysql-test/suite/rpl/r/rpl_start_alter_8.result
@@ -10,6 +10,10 @@ Warnings:
Note 1255 Slave already has been stopped
set global binlog_alter_two_phase=true;
connection server_3;
+SET STATEMENT sql_log_bin=0 FOR
+CALL mtr.add_suppression("The table mysql.gtid_slave_pos was removed. This change will not take full effect until all SQL threads have been restarted");
+SET STATEMENT sql_log_bin=0 FOR
+ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
SET GLOBAL slave_parallel_threads=20;
set global slave_parallel_mode=optimistic;
set global gtid_strict_mode=1;
diff --git a/mysql-test/suite/rpl/r/rpl_start_alter_mysqlbinlog_1.result b/mysql-test/suite/rpl/r/rpl_start_alter_mysqlbinlog_1.result
index bf9d9be0..b11804ed 100644
--- a/mysql-test/suite/rpl/r/rpl_start_alter_mysqlbinlog_1.result
+++ b/mysql-test/suite/rpl/r/rpl_start_alter_mysqlbinlog_1.result
@@ -4,6 +4,8 @@ connection master;
set global binlog_alter_two_phase=true;
connection slave;
include/stop_slave.inc
+SET STATEMENT sql_log_bin=0 FOR
+ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
set global gtid_strict_mode=1;
# Legacy Master Slave
connect master_node,127.0.0.1,root,,$db_name, $M_port;
diff --git a/mysql-test/suite/rpl/r/rpl_start_alter_mysqlbinlog_2.result b/mysql-test/suite/rpl/r/rpl_start_alter_mysqlbinlog_2.result
index 2c1ae667..55bec7d3 100644
--- a/mysql-test/suite/rpl/r/rpl_start_alter_mysqlbinlog_2.result
+++ b/mysql-test/suite/rpl/r/rpl_start_alter_mysqlbinlog_2.result
@@ -49,6 +49,10 @@ connection server_2;
SET @save_binlog_alter_two_phase= @@GLOBAL.binlog_alter_two_phase;
SET GLOBAL binlog_alter_two_phase = ON;
connection server_3;
+SET STATEMENT sql_log_bin=0 FOR
+CALL mtr.add_suppression("The table mysql.gtid_slave_pos was removed. This change will not take full effect until all SQL threads have been restarted");
+SET STATEMENT sql_log_bin=0 FOR
+ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
SET @save_gtid_strict_mode= @@GLOBAL.gtid_strict_mode;
SET @slave_parallel_threads= @@GLOBAL.slave_parallel_threads;
SET @slave_parallel_mode= @@GLOBAL.slave_parallel_mode;
diff --git a/mysql-test/suite/rpl/r/rpl_start_alter_restart_slave.result b/mysql-test/suite/rpl/r/rpl_start_alter_restart_slave.result
index 0a1c1f79..76f9cbcd 100644
--- a/mysql-test/suite/rpl/r/rpl_start_alter_restart_slave.result
+++ b/mysql-test/suite/rpl/r/rpl_start_alter_restart_slave.result
@@ -79,7 +79,9 @@ domain_id seq_no
0 5
include/start_slave.inc
connection master;
+include/save_master_gtid.inc
connection slave;
+include/sync_with_master_gtid.inc
# Everything from the master binlog must have been applied now:
select domain_id, seq_no from mysql.gtid_slave_pos order by seq_no desc limit 1;
domain_id seq_no
diff --git a/mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result b/mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result
index e94e097f..dbaceb65 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result
@@ -197,7 +197,7 @@ SET GLOBAL max_binlog_cache_size= ORIGINAL_VALUE;
SET GLOBAL binlog_cache_size= ORIGINAL_VALUE;
SET GLOBAL max_binlog_stmt_cache_size= ORIGINAL_VALUE;
SET GLOBAL binlog_stmt_cache_size= ORIGINAL_VALUE;
-include/stop_slave.inc
+include/stop_slave_io.inc
include/start_slave.inc
connection master;
connection slave;
diff --git a/mysql-test/suite/rpl/r/rpl_stm_start_stop_slave.result b/mysql-test/suite/rpl/r/rpl_stm_start_stop_slave.result
index 40910b8c..9575ea89 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_start_stop_slave.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_start_stop_slave.result
@@ -109,7 +109,7 @@ START SLAVE;
include/wait_for_slave_param.inc [Last_IO_Errno]
Last_IO_Errno = '1236'
Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'Client requested master to start replication from impossible position; the first event 'master-bin.000001' at XXX, the last event read from 'master-bin.000001' at XXX, the last byte read from 'master-bin.000001' at XXX.''
-include/stop_slave.inc
+include/stop_slave_sql.inc
RESET SLAVE;
Warnings:
Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos'
diff --git a/mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result b/mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result
index 0afe1992..86c90ff3 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result
@@ -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
@@ -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
diff --git a/mysql-test/suite/rpl/r/rpl_using_gtid_default.result b/mysql-test/suite/rpl/r/rpl_using_gtid_default.result
index e077bcd9..3bdc9d47 100644
--- a/mysql-test/suite/rpl/r/rpl_using_gtid_default.result
+++ b/mysql-test/suite/rpl/r/rpl_using_gtid_default.result
@@ -117,7 +117,10 @@ include/start_slave.inc
# not master_use_gtid=no should warn the user that Using_Gtid is being
# changed to No.
#
+connection master;
+include/save_master_pos.inc
connection slave;
+include/sync_io_with_master.inc
include/stop_slave.inc
CHANGE MASTER TO master_log_pos=io_log_pos, master_log_file='io_log_file';
Warnings:
diff --git a/mysql-test/suite/rpl/r/semisync_future-7591.result b/mysql-test/suite/rpl/r/semisync_future-7591.result
index 80414ac1..8287b8fe 100644
--- a/mysql-test/suite/rpl/r/semisync_future-7591.result
+++ b/mysql-test/suite/rpl/r/semisync_future-7591.result
@@ -13,7 +13,7 @@ connection master;
insert into t1 values (1);
reset master;
connection slave;
-include/stop_slave.inc
+include/stop_slave_sql.inc
include/reset_slave.inc
Warnings:
Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos'
diff --git a/mysql-test/suite/rpl/t/create_or_replace.inc b/mysql-test/suite/rpl/t/create_or_replace.inc
index df46cc36..e8fa95cb 100644
--- a/mysql-test/suite/rpl/t/create_or_replace.inc
+++ b/mysql-test/suite/rpl/t/create_or_replace.inc
@@ -213,12 +213,19 @@ set @@session.binlog_format=default;
drop temporary table if exists t9;
--connect(con1,localhost,root,,)
+--let $conid = `SELECT CONNECTION_ID()`
set session binlog_format=default;
create temporary table t9 (i int);
--echo *** Must be no DROP logged for t9 when there was no CREATE, at disconnect too ***
--disconnect con1
--connection server_1
+# The disconnect runs asynchroneously. Wait for it to complete, otherwise the
+# DROP TEMPORARY TABLE may not have been binlogged yet when SHOW BINLOG EVENTS
+# is run.
+--let $wait_condition= SELECT COUNT(*)=0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE ID=$conid
+--source include/wait_condition.inc
+
--source include/show_binlog_events.inc
# Clean up
diff --git a/mysql-test/suite/rpl/t/mdev-31448_kill_ooo_finish_optimistic.test b/mysql-test/suite/rpl/t/mdev-31448_kill_ooo_finish_optimistic.test
index 1297fcda..aa777d40 100644
--- a/mysql-test/suite/rpl/t/mdev-31448_kill_ooo_finish_optimistic.test
+++ b/mysql-test/suite/rpl/t/mdev-31448_kill_ooo_finish_optimistic.test
@@ -54,7 +54,8 @@ drop table t2;
--source include/start_slave.inc
--echo # wait for T1
---let $wait_condition= SELECT count(*)=1 FROM information_schema.processlist WHERE state LIKE 'Update_rows_log_event::find_row(-1)%' and command LIKE 'Slave_worker';
+# Wildcard for `state` as it depends on whether WSREP is compiled in or not.
+--let $wait_condition= SELECT count(*)=1 FROM information_schema.processlist WHERE state LIKE 'Update_rows_log_event::find_row(%' and command LIKE 'Slave_worker';
--source include/wait_condition.inc
--echo # wait for T2
@@ -81,7 +82,9 @@ DROP TABLE t1;
--connection slave
--echo #
--echo # Cleanup
---source include/stop_slave.inc
+--let $rpl_allow_error= 1
+--source include/wait_for_slave_sql_to_stop.inc
+--source include/stop_slave_io.inc
eval set @@global.slave_parallel_threads= $save_slave_parallel_threads;
eval set @@global.slave_parallel_mode= $save_slave_parallel_mode;
eval set @@global.innodb_lock_wait_timeout= $save_innodb_lock_wait_timeout;
diff --git a/mysql-test/suite/rpl/t/parallel_backup_xa.inc b/mysql-test/suite/rpl/t/parallel_backup_xa.inc
index 2d831199..83a6fb79 100644
--- a/mysql-test/suite/rpl/t/parallel_backup_xa.inc
+++ b/mysql-test/suite/rpl/t/parallel_backup_xa.inc
@@ -59,6 +59,7 @@ XA RECOVER;
{
--let $wait_condition= SELECT COUNT(*) = 0 FROM information_schema.processlist WHERE state = "Waiting for prior transaction to commit"
--source include/wait_condition.inc
+ --let $rpl_allow_error=1
}
ROLLBACK;
--let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist WHERE state = "Waiting for backup lock"
@@ -71,6 +72,7 @@ if (!$slave_ooo_error)
{
--source include/sync_with_master_gtid.inc
}
+--let $rpl_only_running_threads= 1
--source include/stop_slave.inc
if ($slave_ooo_error)
{
diff --git a/mysql-test/suite/rpl/t/rpl_binlog_cache_disk_full_loaddata.test b/mysql-test/suite/rpl/t/rpl_binlog_cache_disk_full_loaddata.test
new file mode 100644
index 00000000..50a67532
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_binlog_cache_disk_full_loaddata.test
@@ -0,0 +1,47 @@
+--source include/have_binlog_format_statement.inc
+--source include/have_debug.inc
+--source include/master-slave.inc
+
+--connection master
+# Set minimal cache size so smaller transaction can trigger spill to disk.
+SET @save_binlog_stmt_cache_size= @@GLOBAL.binlog_stmt_cache_size;
+SET GLOBAL binlog_stmt_cache_size= 4096;
+
+CALL mtr.add_suppression('"No space left on device".*An incident event is written to binary log');
+CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=MyISAM;
+
+FLUSH STATUS;
+SHOW STATUS LIKE "binlog_stmt_cache%";
+SET @old_dbug= @@SESSION.debug_dbug;
+SET SESSION debug_dbug="+d,load_data_binlog_cache_error";
+--replace_regex /Error writing file '[^']+'/Error writing file '<FILENAME>'/
+--error 3
+LOAD DATA CONCURRENT LOCAL INFILE 'std_data/bug30435_5k.txt'
+ REPLACE INTO TABLE t1 (a);
+SET SESSION debug_dbug= @old_dbug;
+SHOW STATUS LIKE "binlog_stmt_cache%";
+# The actual number of rows left after the disk full error may change as
+# binlog event sizes are modified. So here we just test that we get partial
+# update from the last INSERT..SELECT that gets disk full error.
+SELECT IF(COUNT(*) > 0 AND COUNT(*) < 5000,
+ "ok",
+ CONCAT("ERROR! Row count ", COUNT(*), " not as expected for partially executed query"))
+ AS check_result
+ FROM t1;
+
+--save_master_pos
+
+--connection slave
+--let $slave_sql_errno= 1590
+--source include/wait_for_slave_sql_error_and_skip.inc
+
+--sync_with_master
+SELECT COUNT(*) FROM t1;
+
+# Cleanup
+
+--connection master
+SET GLOBAL binlog_stmt_cache_size= @save_binlog_stmt_cache_size;
+DROP TABLE t1;
+
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_binlog_cache_disk_full_row.test b/mysql-test/suite/rpl/t/rpl_binlog_cache_disk_full_row.test
new file mode 100644
index 00000000..2c5813bb
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_binlog_cache_disk_full_row.test
@@ -0,0 +1,61 @@
+--source include/have_binlog_format_row.inc
+--source include/have_debug.inc
+--source include/master-slave.inc
+
+--connection master
+# Set minimal cache size so smaller transaction can trigger spill to disk.
+SET @save_binlog_stmt_cache_size= @@GLOBAL.binlog_stmt_cache_size;
+SET GLOBAL binlog_stmt_cache_size= 4096;
+
+CALL mtr.add_suppression('"No space left on device".*An incident event is written to binary log');
+CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(255)) ENGINE=MyISAM;
+
+FLUSH STATUS;
+SHOW STATUS LIKE "binlog_stmt_cache%";
+INSERT INTO t1 VALUES (0, CONCAT("?", "-", REPEAT("x", 200)));
+INSERT INTO t1 SELECT a+1, CONCAT(a, "-", REPEAT("x", 200)) FROM t1;
+INSERT INTO t1 SELECT a+2, CONCAT(a, "-", REPEAT("x", 200)) FROM t1;
+INSERT INTO t1 SELECT a+4, CONCAT(a, "-", REPEAT("x", 200)) FROM t1;
+INSERT INTO t1 SELECT a+8, CONCAT(a, "-", REPEAT("x", 200)) FROM t1;
+INSERT INTO t1 SELECT a+16, CONCAT(a, "-", REPEAT("x", 200)) FROM t1;
+INSERT INTO t1 SELECT a+32, CONCAT(a, "-", REPEAT("x", 200)) FROM t1;
+INSERT INTO t1 SELECT a+64, CONCAT(a, "-", REPEAT("x", 200)) FROM t1;
+INSERT INTO t1 SELECT a+128, CONCAT(a, "-", REPEAT("x", 200)) FROM t1;
+SHOW STATUS LIKE "binlog_stmt_cache%";
+
+SET @old_dbug= @@SESSION.debug_dbug;
+SET SESSION debug_dbug="+d,simulate_disk_full_at_flush_pending";
+--replace_regex /Error writing file '[^']+'/Error writing file '<FILENAME>'/
+--error 3
+INSERT INTO t1 SELECT a+256, CONCAT(a, "-", REPEAT("x", 200)) FROM t1;
+SET SESSION debug_dbug= @old_dbug;
+SHOW STATUS LIKE "binlog_stmt_cache%";
+# The actual number of rows left after the disk full error may change as
+# binlog event sizes are modified. So here we just test that we get partial
+# update from the last INSERT..SELECT that gets disk full error.
+SELECT IF(COUNT(*) > 256 AND COUNT(*) < 512,
+ "ok",
+ CONCAT("ERROR! Row count ", COUNT(*), " not as expected for partially executed query"))
+ AS check_result
+ FROM t1;
+
+# A random extra event that helped show the bug that a partial event
+# group was binlogged.
+ALTER TABLE t1 COMMENT '<mumble>';
+
+--save_master_pos
+
+--connection slave
+--let $slave_sql_errno= 1590
+--source include/wait_for_slave_sql_error_and_skip.inc
+
+--sync_with_master
+SELECT COUNT(*) FROM t1;
+
+# Cleanup
+
+--connection master
+SET GLOBAL binlog_stmt_cache_size= @save_binlog_stmt_cache_size;
+DROP TABLE t1;
+
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_binlog_dump_slave_gtid_state_info.test b/mysql-test/suite/rpl/t/rpl_binlog_dump_slave_gtid_state_info.test
index bba41295..02b31c06 100644
--- a/mysql-test/suite/rpl/t/rpl_binlog_dump_slave_gtid_state_info.test
+++ b/mysql-test/suite/rpl/t/rpl_binlog_dump_slave_gtid_state_info.test
@@ -59,7 +59,7 @@ if(!$log_error_)
--let SEARCH_FILE=$log_error_
--let SEARCH_RANGE=-50000
--let SEARCH_PATTERN=using_gtid\(1\), gtid\(\'\'\).*
---source include/search_pattern_in_file.inc
+--source include/wait_for_pattern_in_file.inc
--connection slave
--source include/stop_slave.inc
@@ -71,7 +71,7 @@ CHANGE MASTER TO MASTER_USE_GTID=no;
--let SEARCH_FILE=$log_error_
--let SEARCH_RANGE=-50000
--let SEARCH_PATTERN=using_gtid\(0\), gtid\(\'\'\).*
---source include/search_pattern_in_file.inc
+--source include/wait_for_pattern_in_file.inc
CREATE TABLE t (f INT) ENGINE=INNODB;
INSERT INTO t VALUES(10);
save_master_pos;
@@ -89,7 +89,7 @@ CHANGE MASTER TO MASTER_USE_GTID=slave_pos;
--let SEARCH_FILE=$log_error_
--let SEARCH_RANGE=-50000
--let SEARCH_PATTERN=using_gtid\(1\), gtid\(\'0-1-2\'\).*
---source include/search_pattern_in_file.inc
+--source include/wait_for_pattern_in_file.inc
SET @@SESSION.gtid_domain_id=10;
INSERT INTO t VALUES(20);
save_master_pos;
@@ -107,7 +107,7 @@ CHANGE MASTER TO MASTER_USE_GTID=slave_pos;
--let SEARCH_FILE=$log_error_
--let SEARCH_RANGE=-50000
--let SEARCH_PATTERN=using_gtid\(1\), gtid\(\'0-1-2,10-1-1\'\).*
---source include/search_pattern_in_file.inc
+--source include/wait_for_pattern_in_file.inc
--echo "===== Clean up ====="
--connection slave
diff --git a/mysql-test/suite/rpl/t/rpl_checksum.test b/mysql-test/suite/rpl/t/rpl_checksum.test
index fc765744..bea325b2 100644
--- a/mysql-test/suite/rpl/t/rpl_checksum.test
+++ b/mysql-test/suite/rpl/t/rpl_checksum.test
@@ -95,6 +95,9 @@ flush logs;
flush logs;
-- source include/wait_for_binlog_checkpoint.inc
flush logs;
+# The binlog position here is output in the error message from
+# wait_for_slave_io_error below, so make sure it's deterministic.
+-- source include/wait_for_binlog_checkpoint.inc
sync_slave_with_master;
#connection slave;
diff --git a/mysql-test/suite/rpl/t/rpl_circular_semi_sync.test b/mysql-test/suite/rpl/t/rpl_circular_semi_sync.test
index 267fa621..e533c54b 100644
--- a/mysql-test/suite/rpl/t/rpl_circular_semi_sync.test
+++ b/mysql-test/suite/rpl/t/rpl_circular_semi_sync.test
@@ -7,6 +7,9 @@
--source include/have_binlog_format_mixed.inc
--source include/master-slave.inc
+connection server_2;
+call mtr.add_suppression("Timeout waiting for reply of binlog");
+
# The following tests prove
# A.
# no out-of-order gtid error is done to the stict gtid mode semisync
@@ -66,10 +69,18 @@ evalp CHANGE MASTER TO master_host='127.0.0.1', master_port=$SERVER_MYPORT_2, ma
--connection server_2
set @@global.gtid_strict_mode = true;
set @@global.rpl_semi_sync_master_enabled = 1;
+
+# The following command is likely to cause the slave master is not yet setup
+# for semi-sync
+
INSERT INTO t1(a) VALUES (2);
--source include/save_master_gtid.inc
--connection server_1
+# Update slave to notice that server_2 now has rpl_semi_sync_master_enabled
+--source include/stop_slave.inc
+--source include/start_slave.inc
+
--echo #
--echo # the successful sync is a required proof
--echo #
diff --git a/mysql-test/suite/rpl/t/rpl_connection.test b/mysql-test/suite/rpl/t/rpl_connection.test
index 31024006..24ada7c8 100644
--- a/mysql-test/suite/rpl/t/rpl_connection.test
+++ b/mysql-test/suite/rpl/t/rpl_connection.test
@@ -16,7 +16,7 @@ CHANGE MASTER TO MASTER_USER= '', MASTER_PASSWORD= '';
START SLAVE;
--let $slave_io_errno= 1045, 1593
--source include/wait_for_slave_io_error.inc
---source include/stop_slave.inc
+--source include/stop_slave_sql.inc
CHANGE MASTER TO MASTER_USER= 'root', MASTER_PASSWORD= '';
START SLAVE;
diff --git a/mysql-test/suite/rpl/t/rpl_deadlock_show_slave_status.test b/mysql-test/suite/rpl/t/rpl_deadlock_show_slave_status.test
new file mode 100644
index 00000000..4c41011e
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_deadlock_show_slave_status.test
@@ -0,0 +1,121 @@
+#
+# Verify that SHOW SLAVE STATUS will not cause deadlocks on the replica.
+# A deadlock has been seen in do_gco_wait if the thread is killed, as it will
+# hold the LOCK_parallel_entry, and during error reporting, try to grab the
+# err_lock. Prior to MDEV-10653, SHOW SLAVE STATUS would grab these locks in
+# the reverse order, as calling workers_idle() used to grab LOCK_parallel_entry
+# with the err_lock already grabbed (though the MDEV-10653 patch changed the
+# workles_idle() implementation to remove the need for locking the
+# parallel_entry).
+#
+# References:
+# MDEV-10653: SHOW SLAVE STATUS Can Deadlock an Errored Slave
+#
+
+--source include/master-slave.inc
+--source include/have_innodb.inc
+--source include/have_debug.inc
+--source include/have_binlog_format_row.inc
+
+--echo #
+--echo # Initialize test data
+--connection master
+create table t1 (a int) engine=innodb;
+insert into t1 values (1);
+--source include/save_master_gtid.inc
+
+--connection slave
+--source include/sync_with_master_gtid.inc
+--source include/stop_slave.inc
+
+call mtr.add_suppression("Connection was killed");
+call mtr.add_suppression("Commit failed due to failure of an earlier commit on which this one depends");
+
+set @save_parallel_threads= @@global.slave_parallel_threads;
+set @save_parallel_mode= @@global.slave_parallel_mode;
+set @save_transaction_retries= @@global.slave_transaction_retries;
+set @save_innodb_lock_wait_timeout= @@global.innodb_lock_wait_timeout;
+
+set @@global.slave_parallel_threads= 2;
+set @@global.slave_parallel_mode= CONSERVATIVE;
+set @@global.slave_transaction_retries= 0;
+set @@global.innodb_lock_wait_timeout= 10;
+
+--echo # Grabbing lock on innodb row to force future replication transaction to wait (and eventually timeout)
+BEGIN;
+select * from t1 where a=1 for update;
+
+--connection master
+
+set @old_dbug= @@session.debug_dbug;
+set @@session.debug_dbug="+d,binlog_force_commit_id";
+
+
+# GCO 1
+SET @commit_id= 10000;
+# T1
+update t1 set a=2 where a=1;
+
+# GCO 2
+SET @commit_id= 10001;
+# T2
+insert into t1 values (3);
+
+set @@session.debug_dbug= @old_dbug;
+
+--connection slave
+start slave;
+
+--echo # Waiting for first transaction to start (and be held at innodb row lock)..
+--let $wait_condition= SELECT count(*)=1 FROM information_schema.processlist WHERE state LIKE 'Update_rows_log_event::find_row(%)%' and command LIKE 'Slave_worker';
+--source include/wait_condition.inc
+
+--echo # Waiting for next transaction to start and hold at do_gco_wait()..
+--let $wait_condition= SELECT count(*)=1 FROM information_schema.processlist WHERE state LIKE 'Waiting for prior transaction to start commit%' and command LIKE 'Slave_worker';
+--source include/wait_condition.inc
+
+--connection slave1
+set @@session.debug_dbug="+d,hold_sss_with_err_lock";
+--send show slave status
+
+--connection slave
+set debug_sync="now wait_for sss_got_err_lock";
+
+--let $t2_tid= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'Waiting for prior transaction to start commit%'`
+--replace_result $t2_tid "<TID of worker in do_gco_wait>"
+--eval kill $t2_tid
+--let $wait_condition= SELECT count(*)=1 FROM information_schema.processlist WHERE command LIKE 'Killed';
+--source include/wait_condition.inc
+
+set debug_sync="now signal sss_continue";
+
+--connection slave1
+--echo # Waiting for SHOW SLAVE STATUS to complete..
+--disable_result_log
+--reap
+--enable_result_log
+--echo # ..done
+
+--connection slave
+ROLLBACK;
+--let $slave_sql_errno= 1927
+--source include/wait_for_slave_sql_error.inc
+
+
+--echo #
+--echo # Cleanup
+--connection master
+drop table t1;
+--source include/save_master_gtid.inc
+
+--connection slave
+set debug_sync= "RESET";
+set @@global.slave_parallel_threads= @save_parallel_threads;
+set @@global.slave_parallel_mode= @save_parallel_mode;
+set @@global.slave_transaction_retries= @save_transaction_retries;
+set @@global.innodb_lock_wait_timeout= @save_innodb_lock_wait_timeout;
+start slave sql_thread;
+--source include/sync_with_master_gtid.inc
+
+--source include/rpl_end.inc
+--echo # End of rpl_deadlock_show_slave_status.test
diff --git a/mysql-test/suite/rpl/t/rpl_delayed_slave.test b/mysql-test/suite/rpl/t/rpl_delayed_slave.test
index d00e796b..32d0b030 100644
--- a/mysql-test/suite/rpl/t/rpl_delayed_slave.test
+++ b/mysql-test/suite/rpl/t/rpl_delayed_slave.test
@@ -192,6 +192,12 @@ eval CHANGE MASTER TO MASTER_DELAY = $time2;
--enable_query_log
--source include/start_slave.inc
+# Ensure that slave has started properly
+--connection master
+INSERT INTO t1 VALUES ('Syncing slave', 5);
+--save_master_pos
+--sync_slave_with_master
+
--connection master
INSERT INTO t1 VALUES (delay_on_slave(1), 6);
--save_master_pos
diff --git a/mysql-test/suite/rpl/t/rpl_domain_id_filter_io_crash.test b/mysql-test/suite/rpl/t/rpl_domain_id_filter_io_crash.test
index a949da0c..95fac6c2 100644
--- a/mysql-test/suite/rpl/t/rpl_domain_id_filter_io_crash.test
+++ b/mysql-test/suite/rpl/t/rpl_domain_id_filter_io_crash.test
@@ -149,8 +149,7 @@ connection slave;
SELECT * FROM t1;
SET @@global.debug_dbug=@saved_dbug;
-
---source include/stop_slave.inc
+--source include/stop_slave_sql.inc
let $do_domain_ids_before= query_get_value(SHOW SLAVE STATUS, Replicate_Do_Domain_Ids, 1);
let $ignore_domain_ids_before= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Domain_Ids, 1);
--echo DO_DOMAIN_IDS (BEFORE) : $do_domain_ids_before
@@ -218,7 +217,7 @@ SELECT * FROM t1;
SET @@global.debug_dbug=@saved_dbug;
---source include/stop_slave.inc
+--source include/stop_slave_sql.inc
let $do_domain_ids_before= query_get_value(SHOW SLAVE STATUS, Replicate_Do_Domain_Ids, 1);
let $ignore_domain_ids_before= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Domain_Ids, 1);
--echo DO_DOMAIN_IDS (BEFORE) : $do_domain_ids_before
@@ -286,7 +285,7 @@ SELECT * FROM t1;
SET @@global.debug_dbug=@saved_dbug;
---source include/stop_slave.inc
+--source include/stop_slave_sql.inc
let $do_domain_ids_before= query_get_value(SHOW SLAVE STATUS, Replicate_Do_Domain_Ids, 1);
let $ignore_domain_ids_before= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Domain_Ids, 1);
--echo DO_DOMAIN_IDS (BEFORE) : $do_domain_ids_before
@@ -354,7 +353,7 @@ SELECT * FROM t1;
SET @@global.debug_dbug=@saved_dbug;
---source include/stop_slave.inc
+--source include/stop_slave_sql.inc
let $do_domain_ids_before= query_get_value(SHOW SLAVE STATUS, Replicate_Do_Domain_Ids, 1);
let $ignore_domain_ids_before= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Domain_Ids, 1);
--echo DO_DOMAIN_IDS (BEFORE) : $do_domain_ids_before
diff --git a/mysql-test/suite/rpl/t/rpl_domain_id_filter_master_crash.test b/mysql-test/suite/rpl/t/rpl_domain_id_filter_master_crash.test
index 6dafab19..cdfdc098 100644
--- a/mysql-test/suite/rpl/t/rpl_domain_id_filter_master_crash.test
+++ b/mysql-test/suite/rpl/t/rpl_domain_id_filter_master_crash.test
@@ -67,8 +67,26 @@ connection master;
save_master_pos;
--connection slave
---source include/stop_slave.inc
+
+# Left to its own devices, the IO thread may or may not stop in error,
+# depending on what it is doing when its connection to the primary is killed
+# (e.g. a failed read results in an error, whereas if the IO thread is idly
+# waiting for events when the connection dies, it will enter into a reconnect
+# loop and reconnect). So we manually stop/start the IO thread to ensure it is
+# in a consistent state
+#
+# FIXME: We shouldn't need to stop/start the SQL thread here, but due to
+# MDEV-33268, we have to. So after fixing 33268, this should only stop/start
+# the IO thread. Note the SQL thread must be stopped first due to an invalid
+# DBUG_ASSERT in the IO thread's stop logic that depends on the state of the
+# SQL thread (also reported and to be fixed in the same ticket).
+#
+--source include/stop_slave_sql.inc
+--let rpl_allow_error=1
+--source include/stop_slave_io.inc
+--let rpl_allow_error=
--source include/start_slave.inc
+
sync_with_master;
select * from ti;
select * from tm;
diff --git a/mysql-test/suite/rpl/t/rpl_fail_register.test b/mysql-test/suite/rpl/t/rpl_fail_register.test
index d95a5c5f..5f86a33c 100644
--- a/mysql-test/suite/rpl/t/rpl_fail_register.test
+++ b/mysql-test/suite/rpl/t/rpl_fail_register.test
@@ -3,7 +3,7 @@ source include/have_binlog_format_mixed.inc;
source include/master-slave.inc;
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';
@@ -11,8 +11,11 @@ stop slave;
reset slave;
source include/wait_for_slave_to_stop.inc;
start slave;
-stop slave;
-source include/wait_for_slave_to_stop.inc;
+# Debug point will raise IO thread error ER_SLAVE_MASTER_COM_FAILURE
+# so we will wait for that and manually stop the SQL thread
+--let $slave_io_errno= 1597
+--source include/wait_for_slave_io_error.inc
+--source include/stop_slave_sql.inc
set global debug_dbug=@old_dbug;
connection master;
diff --git a/mysql-test/suite/rpl/t/rpl_gis_user_var.test b/mysql-test/suite/rpl/t/rpl_gis_user_var.test
new file mode 100644
index 00000000..8edd8cb9
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_gis_user_var.test
@@ -0,0 +1,18 @@
+--source include/have_geometry.inc
+--source include/master-slave.inc
+
+--echo #
+--echo #
+--echo #
+
+connection master;
+SET @p=POINT(1,1);
+CREATE TABLE t1 AS SELECT @p AS p;
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+SELECT ST_AsWKT(p) FROM t1;
+connection master;
+DROP TABLE t1;
+sync_slave_with_master;
+
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_gtid_basic.test b/mysql-test/suite/rpl/t/rpl_gtid_basic.test
index 70bd0087..a7af234d 100644
--- a/mysql-test/suite/rpl/t/rpl_gtid_basic.test
+++ b/mysql-test/suite/rpl/t/rpl_gtid_basic.test
@@ -162,6 +162,13 @@ eval SELECT BINLOG_GTID_POS('$valid_binlog_name',0);
eval SELECT BINLOG_GTID_POS('$valid_binlog_name',18446744073709551615);
eval SELECT BINLOG_GTID_POS('$valid_binlog_name',18446744073709551616);
+# MDEV-33045: Server crashes in Item_func_binlog_gtid_pos::val_str / Binary_string::c_ptr_safe
+SET sql_log_bin= 0;
+CREATE TABLE t1 AS SELECT MASTER_POS_WAIT(@binlog_file, 4, 0);
+SELECT BINLOG_GTID_POS(@binlog_file, 4);
+DROP TABLE t1;
+SET sql_log_bin= 1;
+
--echo *** Some tests of @@GLOBAL.gtid_binlog_state ***
--connection server_2
diff --git a/mysql-test/suite/rpl/t/rpl_gtid_errorhandling.test b/mysql-test/suite/rpl/t/rpl_gtid_errorhandling.test
index 412489b3..c9c4d650 100644
--- a/mysql-test/suite/rpl/t/rpl_gtid_errorhandling.test
+++ b/mysql-test/suite/rpl/t/rpl_gtid_errorhandling.test
@@ -20,7 +20,7 @@ INSERT INTO t1 VALUES (1);
CALL mtr.add_suppression("Slave: Failed to open mysql.gtid_slave_pos");
--let $slave_sql_errno=1944
--source include/wait_for_slave_sql_error.inc
-
+--let $rpl_only_running_threads= 1
--source include/stop_slave.inc
ALTER TABLE mysql.gtid_slave_pos CHANGE seq_no seq_no BIGINT UNSIGNED NOT NULL;
ALTER TABLE mysql.gtid_slave_pos DROP PRIMARY KEY;
diff --git a/mysql-test/suite/rpl/t/rpl_gtid_errorlog.test b/mysql-test/suite/rpl/t/rpl_gtid_errorlog.test
index ea321062..0ee54cd1 100644
--- a/mysql-test/suite/rpl/t/rpl_gtid_errorlog.test
+++ b/mysql-test/suite/rpl/t/rpl_gtid_errorlog.test
@@ -31,8 +31,8 @@ SET sql_log_bin=1;
START SLAVE;
--let $slave_sql_errno=1062
--source include/wait_for_slave_sql_error.inc
-
---source include/stop_slave.inc
+--source include/wait_for_slave_io_to_start.inc
+--source include/stop_slave_io.inc
# Skip the problem event from the master.
SET GLOBAL gtid_slave_pos= "0-1-100";
--source include/start_slave.inc
@@ -51,7 +51,7 @@ SET debug_dbug= @dbug_save;
--connection slave
--let $slave_sql_errno=1590
--source include/wait_for_slave_sql_error.inc
---source include/stop_slave.inc
+--source include/stop_slave_io.inc
SET sql_slave_skip_counter=1;
--source include/start_slave.inc
--sync_with_master
diff --git a/mysql-test/suite/rpl/t/rpl_gtid_slave_filtering.cnf b/mysql-test/suite/rpl/t/rpl_gtid_slave_filtering.cnf
new file mode 100644
index 00000000..a57dbbf3
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_gtid_slave_filtering.cnf
@@ -0,0 +1,28 @@
+!include ../my.cnf
+
+[mysqld.1]
+log-slave-updates
+loose-innodb
+gtid-domain-id=1
+gtid-strict-mode=0
+gtid-ignore-duplicates=1
+
+[mysqld.2]
+log-slave-updates
+loose-innodb
+gtid-domain-id=0
+replicate-ignore-table=test.t3
+gtid-strict-mode=0
+gtid-ignore-duplicates=1
+
+[mysqld.3]
+log-slave-updates
+loose-innodb
+gtid-domain-id=0
+replicate-ignore-table=test.t3
+gtid-strict-mode=0
+gtid-ignore-duplicates=1
+
+[ENV]
+SERVER_MYPORT_3= @mysqld.3.port
+SERVER_MYSOCK_3= @mysqld.3.socket
diff --git a/mysql-test/suite/rpl/t/rpl_gtid_slave_filtering.test b/mysql-test/suite/rpl/t/rpl_gtid_slave_filtering.test
new file mode 100644
index 00000000..842bae82
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_gtid_slave_filtering.test
@@ -0,0 +1,109 @@
+--source include/have_innodb.inc
+--source include/have_binlog_format_mixed.inc
+
+--let $rpl_topology=1->2->3
+--source include/rpl_init.inc
+
+--echo *** Test GTID master switch in a topology with filtered events.
+--echo *** With --gtid-ignore-duplicate and --gtid-strict-mode, should allow
+--echo *** GTID connect at a GTID position that is filtered on the new master.
+
+--connection server_1
+
+ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
+CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,1);
+CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
+INSERT INTO t3 VALUES (1,1);
+INSERT INTO t1 VALUES (2,1);
+INSERT INTO t3 VALUES (2,1);
+--source include/save_master_gtid.inc
+
+--connection server_2
+CREATE TABLE t2 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1,2);
+
+--let $slave_timeout= 10
+--source include/sync_with_master_gtid.inc
+--source include/save_master_gtid.inc
+
+--connection server_3
+--source include/sync_with_master_gtid.inc
+
+--echo *** Promote 3 as new master, demote 2 as slave of 3.
+--echo *** GTID position of 2 in domain 0 is filtered on 3.
+
+--connection server_2
+--source include/stop_slave.inc
+
+--connection server_3
+--source include/stop_slave.inc
+--replace_result $SERVER_MYPORT_1 SERVER_MYPORT_1
+eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SERVER_MYPORT_1,
+ MASTER_USE_GTID=SLAVE_POS;
+
+--connection server_2
+--replace_result $SERVER_MYPORT_3 SERVER_MYPORT_3
+eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SERVER_MYPORT_3,
+ MASTER_USE_GTID=SLAVE_POS;
+--source include/start_slave.inc
+
+--connection server_3
+--source include/start_slave.inc
+
+--connection server_1
+INSERT INTO t1 VALUES (3,1);
+INSERT INTO t3 VALUES (3,1);
+--source include/save_master_gtid.inc
+
+--connection server_3
+INSERT INTO t2 VALUES (2,2);
+
+--source include/sync_with_master_gtid.inc
+--source include/save_master_gtid.inc
+
+--connection server_2
+--source include/sync_with_master_gtid.inc
+
+SELECT * FROM t1 ORDER BY a;
+# Verify that table t3 is being filtered.
+--error 1146
+SELECT * FROM t3 ORDER BY a;
+SELECT * FROM t2 ORDER BY a;
+
+
+--echo *** Restore original topology.
+
+--connection server_3
+--source include/stop_slave.inc
+
+--connection server_2
+--source include/stop_slave.inc
+--replace_result $SERVER_MYPORT_1 SERVER_MYPORT_1
+eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SERVER_MYPORT_1,
+ MASTER_USE_GTID=SLAVE_POS;
+--source include/start_slave.inc
+
+--connection server_3
+--replace_result $SERVER_MYPORT_2 SERVER_MYPORT_2
+eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SERVER_MYPORT_2,
+ MASTER_USE_GTID=SLAVE_POS;
+--source include/start_slave.inc
+
+
+# Cleanup
+
+--connection server_1
+DROP TABLE t1;
+DROP TABLE t3;
+--source include/save_master_gtid.inc
+
+--connection server_2
+DROP TABLE t2;
+--source include/sync_with_master_gtid.inc
+--source include/save_master_gtid.inc
+
+--connection server_3
+--source include/sync_with_master_gtid.inc
+
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_gtid_startpos.test b/mysql-test/suite/rpl/t/rpl_gtid_startpos.test
index c7bcc1bb..d0885ab8 100644
--- a/mysql-test/suite/rpl/t/rpl_gtid_startpos.test
+++ b/mysql-test/suite/rpl/t/rpl_gtid_startpos.test
@@ -50,7 +50,7 @@ eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $MASTER_MYPORT,
START SLAVE;
--let $slave_io_errno= 1236
--source include/wait_for_slave_io_error.inc
---source include/stop_slave.inc
+--source include/stop_slave_sql.inc
--replace_result $MASTER_MYPORT MASTER_PORT
eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $MASTER_MYPORT,
diff --git a/mysql-test/suite/rpl/t/rpl_gtid_stop_start.test b/mysql-test/suite/rpl/t/rpl_gtid_stop_start.test
index 9760d4df..b5ff2949 100644
--- a/mysql-test/suite/rpl/t/rpl_gtid_stop_start.test
+++ b/mysql-test/suite/rpl/t/rpl_gtid_stop_start.test
@@ -210,7 +210,7 @@ SET sql_log_bin=0;
call mtr.add_suppression("Failed to load slave replication state from table");
call mtr.add_suppression("Unable to load replication GTID slave state");
SET sql_log_bin=1;
-
+--let rpl_allow_error= 1
--source include/start_slave.inc
--connection server_1
INSERT INTO t1 VALUES (9);
diff --git a/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test b/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test
index d6d14e02..b6133625 100644
--- a/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test
+++ b/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test
@@ -331,7 +331,7 @@ sleep 4;
let $rcvd_heartbeats_after= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
let $result= query_get_value(SELECT ($rcvd_heartbeats_after - $rcvd_heartbeats_before) > 0 AS Result, Result, 1);
--echo Heartbeat events are received while sql thread stopped (1 means 'yes'): $result
---source include/stop_slave.inc
+--source include/stop_slave_io.inc
set sql_log_bin= 0;
DROP TABLE t1;
set sql_log_bin= 1;
diff --git a/mysql-test/suite/rpl/t/rpl_invoked_features.test b/mysql-test/suite/rpl/t/rpl_invoked_features.test
index 91391cf8..cd2b770c 100644
--- a/mysql-test/suite/rpl/t/rpl_invoked_features.test
+++ b/mysql-test/suite/rpl/t/rpl_invoked_features.test
@@ -102,14 +102,17 @@ BEGIN
UPDATE t13 SET c = '';
END|
-# Create events which will run every 1 sec
-CREATE EVENT e1 ON SCHEDULE EVERY 1 SECOND DISABLE DO
+# Create events which will run every 10 sec
+# It cannot be much shorter as we have to ensure that a new
+# event is not scheduled before the DISABLE has been
+# executed.
+CREATE EVENT e1 ON SCHEDULE EVERY 10 SECOND DISABLE DO
BEGIN
ALTER EVENT e1 DISABLE;
CALL p1(10, '');
END|
-CREATE EVENT e11 ON SCHEDULE EVERY 1 SECOND DISABLE DO
+CREATE EVENT e11 ON SCHEDULE EVERY 10 SECOND DISABLE DO
BEGIN
ALTER EVENT e11 DISABLE;
CALL p11(10, '');
diff --git a/mysql-test/suite/rpl/t/rpl_mariadb_slave_capability.test b/mysql-test/suite/rpl/t/rpl_mariadb_slave_capability.test
index d49851cc..7e313b37 100644
--- a/mysql-test/suite/rpl/t/rpl_mariadb_slave_capability.test
+++ b/mysql-test/suite/rpl/t/rpl_mariadb_slave_capability.test
@@ -11,13 +11,25 @@ set @old_master_binlog_checksum= @@global.binlog_checksum;
# empty Gtid_list event
#
# Test this by binlog rotation before we log any GTIDs.
-connection slave;
+sync_slave_with_master;
# Need to stop/start the master without GTID before setting debug_dbug
--source include/stop_slave.inc
CHANGE MASTER TO MASTER_USE_GTID=NO;
--source include/start_slave.inc
+--connection master
+--echo # Ensure only the new binlog dump thread is alive (wait for the old one
+--echo # to complete its kill)
+--let $wait_condition= select count(*)=1 from information_schema.processlist where command='Binlog Dump'
+--source include/wait_condition.inc
+
+--echo # And that it has already sent its fake rotate
+--let $wait_condition= select count(*)=1 from information_schema.processlist where state LIKE '%Master has sent all binlog to slave%' and command='Binlog Dump'
+--source include/wait_condition.inc
+
+
+--connection slave
--source include/stop_slave.inc
--echo # Test slave with no capability gets dummy event, which is ignored.
set @old_dbug= @@global.debug_dbug;
@@ -26,6 +38,7 @@ SET @@global.debug_dbug='+d,simulate_slave_capability_none';
connection master;
FLUSH LOGS;
+--source include/wait_for_binlog_checkpoint.inc
CREATE TABLE t1 (a INT PRIMARY KEY);
INSERT INTO t1 VALUES (0);
sync_slave_with_master;
diff --git a/mysql-test/suite/rpl/t/rpl_mdev_17614.test b/mysql-test/suite/rpl/t/rpl_mdev_17614.test
index 8d91944a..e9a41c95 100644
--- a/mysql-test/suite/rpl/t/rpl_mdev_17614.test
+++ b/mysql-test/suite/rpl/t/rpl_mdev_17614.test
@@ -40,8 +40,7 @@ SELECT * FROM t1;
SELECT * FROM t1;
# restart replication for the next testcase
-stop slave;
---source include/wait_for_slave_to_stop.inc
+--source include/stop_slave_io.inc
--source include/reset_slave.inc
connection master;
reset master;
@@ -159,8 +158,7 @@ SELECT * FROM t1;
SELECT * FROM t1;
# restart replication for the next testcase
-stop slave;
---source include/wait_for_slave_to_stop.inc
+--source include/stop_slave_io.inc
--source include/reset_slave.inc
connection master;
reset master;
diff --git a/mysql-test/suite/rpl/t/rpl_parallel_ignored_errors.test b/mysql-test/suite/rpl/t/rpl_parallel_ignored_errors.test
index 493385f1..83b89a69 100644
--- a/mysql-test/suite/rpl/t/rpl_parallel_ignored_errors.test
+++ b/mysql-test/suite/rpl/t/rpl_parallel_ignored_errors.test
@@ -96,7 +96,9 @@ COMMIT;
# Clean up.
--connection server_2
---source include/stop_slave.inc
+--let $slave_sql_errno= 1062
+--source include/wait_for_slave_sql_error.inc
+--source include/stop_slave_io.inc
--let $assert_cond= COUNT(*) = 0 FROM t1 WHERE a>32
--let $assert_text= table t1 should have zero rows where a>32
--source include/assert.inc
diff --git a/mysql-test/suite/rpl/t/rpl_parallel_missed_error_handling.test b/mysql-test/suite/rpl/t/rpl_parallel_missed_error_handling.test
index 33b1bcb1..6ed9638d 100644
--- a/mysql-test/suite/rpl/t/rpl_parallel_missed_error_handling.test
+++ b/mysql-test/suite/rpl/t/rpl_parallel_missed_error_handling.test
@@ -60,7 +60,6 @@ SET debug_sync='RESET';
--connection server_2
--let $slave_sql_errno= 1062
--source include/wait_for_slave_sql_error.inc
---source include/wait_for_slave_sql_to_stop.inc
# We should not see the row (112,3) here, it should be rolled back due to
# error signal from the prior transaction.
SELECT * FROM t3 WHERE a >= 110 ORDER BY a;
diff --git a/mysql-test/suite/rpl/t/rpl_parallel_retry.test b/mysql-test/suite/rpl/t/rpl_parallel_retry.test
index 8b2affed..fe6f40d2 100644
--- a/mysql-test/suite/rpl/t/rpl_parallel_retry.test
+++ b/mysql-test/suite/rpl/t/rpl_parallel_retry.test
@@ -497,6 +497,7 @@ if (`SELECT count(*) = 1 FROM t1 WHERE a = 2`)
# Clean up
#
--connection server_2
+--let $rpl_only_running_threads= 1
--source include/stop_slave.inc
SET @@GLOBAL.slave_parallel_threads=@old_parallel_threads;
SET @@GLOBAL.slave_parallel_mode=@old_parallel_mode;
diff --git a/mysql-test/suite/rpl/t/rpl_perfschema_applier_status_by_coordinator.test b/mysql-test/suite/rpl/t/rpl_perfschema_applier_status_by_coordinator.test
index 44df3ca4..794a0c63 100644
--- a/mysql-test/suite/rpl/t/rpl_perfschema_applier_status_by_coordinator.test
+++ b/mysql-test/suite/rpl/t/rpl_perfschema_applier_status_by_coordinator.test
@@ -209,6 +209,7 @@ drop table t;
reset master;
--connection slave
+--let $rpl_only_running_threads= 1
--source include/stop_slave.inc
reset slave;
reset master;
diff --git a/mysql-test/suite/rpl/t/rpl_perfschema_applier_status_by_worker.test b/mysql-test/suite/rpl/t/rpl_perfschema_applier_status_by_worker.test
index 857979d0..5ef28a62 100644
--- a/mysql-test/suite/rpl/t/rpl_perfschema_applier_status_by_worker.test
+++ b/mysql-test/suite/rpl/t/rpl_perfschema_applier_status_by_worker.test
@@ -227,6 +227,7 @@ select Last_Error_Message from performance_schema.replication_applier_status_by_
#let $assert_cond= "$sss_value" = "$ps_value_in_sss_format";
#source include/assert.inc;
+--let $rpl_only_running_threads= 1
--source include/stop_slave.inc
RESET SLAVE;
--connection master
diff --git a/mysql-test/suite/rpl/t/rpl_rewrite_db_sys_vars.test b/mysql-test/suite/rpl/t/rpl_rewrite_db_sys_vars.test
index b06899bb..27710063 100644
--- a/mysql-test/suite/rpl/t/rpl_rewrite_db_sys_vars.test
+++ b/mysql-test/suite/rpl/t/rpl_rewrite_db_sys_vars.test
@@ -108,6 +108,7 @@ select * from my_table;
--source include/save_master_gtid.inc
connection slave;
+--let $rpl_only_running_threads=1
--source include/stop_slave.inc
--source include/reset_slave.inc
--source include/start_slave.inc
diff --git a/mysql-test/suite/rpl/t/rpl_row_corruption.test b/mysql-test/suite/rpl/t/rpl_row_corruption.test
index d78df905..6f4f9c88 100644
--- a/mysql-test/suite/rpl/t/rpl_row_corruption.test
+++ b/mysql-test/suite/rpl/t/rpl_row_corruption.test
@@ -39,7 +39,7 @@ SET @@global.debug_dbug="d,inject_tblmap_same_id_maps_diff_table";
# wait for error 1593 (ER_SLAVE_FATAL_ERROR)
--let $slave_sql_errno=1593
--source include/wait_for_slave_sql_error.inc
---source include/stop_slave.inc
+--source include/stop_slave_io.inc
# clean up
SET @@global.debug_dbug=@saved_debug;
diff --git a/mysql-test/suite/rpl/t/rpl_row_idempotency.test b/mysql-test/suite/rpl/t/rpl_row_idempotency.test
index 85775832..326f94ec 100644
--- a/mysql-test/suite/rpl/t/rpl_row_idempotency.test
+++ b/mysql-test/suite/rpl/t/rpl_row_idempotency.test
@@ -139,7 +139,9 @@ select * from ti1 order by b /* must be (2),(3) */;
--echo *** slave must stop (Trying to delete a referenced foreing key)
connection slave;
-source include/wait_for_slave_sql_to_stop.inc;
+# ER_ROW_IS_REFERENCED_2 # Cannot add or update a child row: a foreign key constraint fails
+--let slave_sql_errno= 1451
+source include/wait_for_slave_sql_error.inc;
let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1);
disable_query_log;
@@ -173,7 +175,9 @@ insert into ti2 set a=3, b=3 /* offending write event */;
--echo *** slave must stop (Trying to insert an invalid foreign key)
connection slave;
-source include/wait_for_slave_sql_to_stop.inc;
+# ER_NO_REFERENCED_ROW_2 # Cannot add or update a parent row: a foreign key constraint fails
+--let slave_sql_errno= 1452
+source include/wait_for_slave_sql_error.inc;
let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1);
disable_query_log;
@@ -210,9 +214,11 @@ insert into ti1 set b=1;
connection master;
insert into ti1 set b=1 /* offending write event */;
---echo *** slave must stop (Trying to insert a dupliacte key)
+--echo *** slave must stop (Trying to insert a duplicate key)
connection slave;
-source include/wait_for_slave_sql_to_stop.inc;
+# ER_DUP_ENTRY # Duplicate entry for key
+--let slave_sql_errno= 1062
+source include/wait_for_slave_sql_error.inc;
let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1);
disable_query_log;
@@ -247,7 +253,10 @@ DELETE FROM t1 WHERE a = -2;
--echo *** slave must stop (Key was not found)
connection slave;
-source include/wait_for_slave_sql_to_stop.inc;
+# ER_KEY_NOT_FOUND # Can't find record
+--let slave_sql_errno= 1032
+source include/wait_for_slave_sql_error.inc;
+
let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1);
disable_query_log;
@@ -265,7 +274,9 @@ connection master;
DELETE FROM t2 WHERE a = -2;
--echo *** slave must stop (Key was not found)
connection slave;
-source include/wait_for_slave_sql_to_stop.inc;
+# ER_KEY_NOT_FOUND # Can't find record
+--let slave_sql_errno= 1032
+source include/wait_for_slave_sql_error.inc;
let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1);
disable_query_log;
@@ -287,7 +298,9 @@ UPDATE t1 SET a = 1 WHERE a = -1;
--echo *** slave must stop (Key was not found)
connection slave;
-source include/wait_for_slave_sql_to_stop.inc;
+# ER_KEY_NOT_FOUND # Can't find record
+--let slave_sql_errno= 1032
+source include/wait_for_slave_sql_error.inc;
let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1);
disable_query_log;
@@ -307,7 +320,9 @@ UPDATE t2 SET a = 1 WHERE a = -1;
--echo *** slave must stop (Key was not found)
connection slave;
-source include/wait_for_slave_sql_to_stop.inc;
+# ER_KEY_NOT_FOUND # Can't find record
+--let slave_sql_errno= 1032
+source include/wait_for_slave_sql_error.inc;
let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1);
disable_query_log;
diff --git a/mysql-test/suite/rpl/t/rpl_row_until.test b/mysql-test/suite/rpl/t/rpl_row_until.test
index d318e0d7..aa43831b 100644
--- a/mysql-test/suite/rpl/t/rpl_row_until.test
+++ b/mysql-test/suite/rpl/t/rpl_row_until.test
@@ -101,7 +101,12 @@ START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', MASTER_LOG_POS=561;
--replace_result 740 MASTER_LOG_POS
START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=740;
---source include/stop_slave.inc
+# Explicit wait for slave thread start and then stop. Otherwise the STOP SLAVE
+# command can abort the slave connecting to the master, and an error state
+# left which makes stop_slave.inc throw an error.
+--source include/wait_for_slave_io_to_start.inc
+--source include/wait_for_slave_sql_to_stop.inc
+--source include/stop_slave_io.inc
--source include/reset_slave.inc
--source include/start_slave.inc
diff --git a/mysql-test/suite/rpl/t/rpl_seconds_behind_master_spike.test b/mysql-test/suite/rpl/t/rpl_seconds_behind_master_spike.test
index 7c2e39dc..a80dedb7 100644
--- a/mysql-test/suite/rpl/t/rpl_seconds_behind_master_spike.test
+++ b/mysql-test/suite/rpl/t/rpl_seconds_behind_master_spike.test
@@ -33,7 +33,8 @@ CHANGE MASTER TO MASTER_USE_GTID=NO;
--source include/stop_slave.inc
SET @save_dbug= @@GLOBAL.debug_dbug;
-SET @@global.debug_dbug="+d,pause_sql_thread_on_fde,negate_clock_diff_with_master";
+SET @@global.debug_dbug="+d,pause_sql_thread_on_relay_fde_after_trans";
+SET @@global.debug_dbug="+d,negate_clock_diff_with_master";
--source include/start_slave.inc
--let $sleep_time=2
@@ -52,12 +53,6 @@ insert into t1 values (1);
flush logs;
--connection slave
---echo # Ignore FDEs that happen before the CREATE/INSERT commands
-SET DEBUG_SYNC='now WAIT_FOR paused_on_fde';
-SET DEBUG_SYNC='now SIGNAL sql_thread_continue';
-SET DEBUG_SYNC='now WAIT_FOR paused_on_fde';
-SET DEBUG_SYNC='now SIGNAL sql_thread_continue';
-
--echo # On the next FDE, the slave should have the master CREATE/INSERT events
SET DEBUG_SYNC='now WAIT_FOR paused_on_fde';
select count(*)=1 from t1;
@@ -138,6 +133,7 @@ while (!$caught_up)
}
sleep 0.1;
}
+set debug_sync="RESET";
--enable_query_log
--connection master
diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync.test b/mysql-test/suite/rpl/t/rpl_semi_sync.test
index 720ec059..ff233615 100644
--- a/mysql-test/suite/rpl/t/rpl_semi_sync.test
+++ b/mysql-test/suite/rpl/t/rpl_semi_sync.test
@@ -23,7 +23,6 @@ connection slave;
# inconsistent GTID values because the seq_nos are non-deterministic with
# the masters events coming in concurrently
set sql_log_bin=0;
-call mtr.add_suppression("Master server does not support semi-sync");
call mtr.add_suppression("Semi-sync slave .* reply");
call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
set sql_log_bin=1;
@@ -58,7 +57,7 @@ set global rpl_semi_sync_slave_enabled= 0;
connection master;
-set global rpl_semi_sync_master_timeout= 60000; # 60s
+set global rpl_semi_sync_master_timeout= 2000; # 2s
echo [ default state of semi-sync on master should be OFF ];
show variables like 'rpl_semi_sync_master_enabled';
@@ -202,12 +201,16 @@ sync_slave_with_master;
--echo # Test semi-sync master will switch OFF after one transaction
--echo # timeout waiting for slave reply.
--echo #
+
+connection master;
+show status like "Rpl_semi_sync_master_status";
+
connection slave;
source include/stop_slave.inc;
connection master;
--source include/kill_binlog_dump_threads.inc
-set global rpl_semi_sync_master_timeout= 5000;
+set global rpl_semi_sync_master_timeout= 2000;
# The first semi-sync check should be on because after slave stop,
# there are no transactions on the master.
@@ -239,8 +242,8 @@ show status like 'Rpl_semi_sync_master_status';
show status like 'Rpl_semi_sync_master_no_tx';
show status like 'Rpl_semi_sync_master_yes_tx';
-# Semi-sync status on master is now OFF, so all these transactions
-# will be replicated asynchronously.
+# Semi-sync status on master is now ON, but there are no slaves attached,
+# so all these transactions will be replicated asynchronously.
delete from t1 where a=10;
delete from t1 where a=9;
delete from t1 where a=8;
@@ -374,6 +377,9 @@ let $status_var= Rpl_semi_sync_master_clients;
let $status_var_value= 1;
source include/wait_for_status_var.inc;
+sync_slave_with_master;
+connection master;
+
replace_result $engine_type ENGINE_TYPE;
eval create table t1 (a int) engine = $engine_type;
insert into t1 values (1);
@@ -420,6 +426,10 @@ connection master;
let $status_var= Rpl_semi_sync_master_clients;
let $status_var_value= 1;
source include/wait_for_status_var.inc;
+
+sync_slave_with_master;
+connection master;
+
echo [ master semi-sync should be ON ];
show status like 'Rpl_semi_sync_master_clients';
show status like 'Rpl_semi_sync_master_status';
diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_event.test b/mysql-test/suite/rpl/t/rpl_semi_sync_event.test
index d4df9b40..86e1522e 100644
--- a/mysql-test/suite/rpl/t/rpl_semi_sync_event.test
+++ b/mysql-test/suite/rpl/t/rpl_semi_sync_event.test
@@ -14,7 +14,6 @@ call mtr.add_suppression("Unsafe statement written to the binary log using state
call mtr.add_suppression("mysqld: Got an error reading communication packets");
connection slave;
-call mtr.add_suppression("Master server does not support semi-sync");
call mtr.add_suppression("Semi-sync slave .* reply");
call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_fail_over.test b/mysql-test/suite/rpl/t/rpl_semi_sync_fail_over.test
index 6a691ae0..17d7b50d 100644
--- a/mysql-test/suite/rpl/t/rpl_semi_sync_fail_over.test
+++ b/mysql-test/suite/rpl/t/rpl_semi_sync_fail_over.test
@@ -18,6 +18,7 @@
--connection server_1
RESET MASTER;
SET @@global.max_binlog_size= 4096;
+set @@global.rpl_semi_sync_master_enabled = 1;
--connection server_2
RESET MASTER;
@@ -29,7 +30,6 @@ CHANGE MASTER TO master_use_gtid= slave_pos;
--connection server_1
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
-set @@global.rpl_semi_sync_master_enabled = 1;
set @@global.rpl_semi_sync_master_wait_point=AFTER_SYNC;
CREATE TABLE t1 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Innodb;
diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_master_shutdown.test b/mysql-test/suite/rpl/t/rpl_semi_sync_master_shutdown.test
index 2224f78d..05e6fcca 100644
--- a/mysql-test/suite/rpl/t/rpl_semi_sync_master_shutdown.test
+++ b/mysql-test/suite/rpl/t/rpl_semi_sync_master_shutdown.test
@@ -30,8 +30,12 @@ connection master;
--let $rpl_server_number=1
source include/rpl_stop_server.inc;
+# After stoping the master, slave receives the disconnect error (2003)
--connection slave
---source include/stop_slave.inc
+--let $slave_io_errno=2003
+--let $slave_io_error_is_nonfatal=1
+--source include/wait_for_slave_io_error.inc
+--let $slave_io_error_is_nonfatal=0
#connection master;
--echo # Restart master
@@ -42,8 +46,10 @@ source include/rpl_start_server.inc;
# Clean up
#
--connection slave
---source include/stop_slave.inc
---source include/start_slave.inc
+--source include/wait_for_slave_sql_to_start.inc
+--let rpl_allow_error=1
+--source include/wait_for_slave_io_to_start.inc
+#--source include/start_slave.inc
--connection master
SET @@GLOBAL.debug_dbug="";
diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_no_missed_ack_after_add_slave.cnf b/mysql-test/suite/rpl/t/rpl_semi_sync_no_missed_ack_after_add_slave.cnf
new file mode 100644
index 00000000..cb7062d5
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_semi_sync_no_missed_ack_after_add_slave.cnf
@@ -0,0 +1,12 @@
+!include include/default_mysqld.cnf
+
+[mysqld.1]
+
+[mysqld.2]
+
+[mysqld.3]
+
+[ENV]
+SERVER_MYPORT_1= @mysqld.1.port
+SERVER_MYPORT_2= @mysqld.2.port
+SERVER_MYPORT_3= @mysqld.3.port
diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_no_missed_ack_after_add_slave.test b/mysql-test/suite/rpl/t/rpl_semi_sync_no_missed_ack_after_add_slave.test
new file mode 100644
index 00000000..c8870e47
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_semi_sync_no_missed_ack_after_add_slave.test
@@ -0,0 +1,122 @@
+#
+# This test ensures that a primary will listen for ACKs by newly added
+# semi-sync connections connections, after a pre-existing connection is already
+# established. MDEV-32960 reported that the newly added slave's ACK can be
+# ignored if listen_on_sockets() does not timeout before
+# rpl_semi_sync_master_timeout, and if the existing semi-sync connections fail
+# to send ACKs, semi-sync is switched off.
+#
+# This test ensures this in a two-replica setup with a semi-sync timeout of
+# 500ms, and delaying the ACK reply of the first-established replica by 800ms
+# to force a timeout, and allowing the second replica to immediately ACK.
+#
+# References:
+# MDEV-32960: Semi-sync ACKed Transaction can Timeout and Switch Off
+# Semi-sync with Multiple Replicas
+#
+--source include/have_debug.inc
+# binlog_format independent
+--source include/have_binlog_format_statement.inc
+
+--let $rpl_topology= 1->2,1->3
+--source include/rpl_init.inc
+
+
+--connection server_1
+set @old_enabled= @@global.rpl_semi_sync_master_enabled;
+set @old_timeout= @@global.rpl_semi_sync_master_timeout;
+set global rpl_semi_sync_master_enabled= 1;
+set global rpl_semi_sync_master_timeout= 500;
+
+--connection server_2
+--source include/stop_slave.inc
+set @old_enabled= @@global.rpl_semi_sync_slave_enabled;
+set @old_dbug= @@global.debug_dbug;
+set global rpl_semi_sync_slave_enabled= 1;
+set global debug_dbug="+d,simulate_delay_semisync_slave_reply";
+--source include/start_slave.inc
+
+--connection server_3
+--source include/stop_slave.inc
+set @old_enabled= @@global.rpl_semi_sync_slave_enabled;
+set global rpl_semi_sync_slave_enabled= 1;
+--source include/start_slave.inc
+
+--echo # Ensure primary recognizes both replicas are semi-sync
+--connection server_1
+--let $status_var_value= 2
+--let $status_var= rpl_semi_sync_master_clients
+--source include/wait_for_status_var.inc
+
+--let $master_ss_status= query_get_value(SHOW STATUS LIKE 'rpl_semi_sync_master_status', Value, 1)
+if (`SELECT strcmp("$master_ss_status", "ON") != 0`)
+{
+ SHOW STATUS LIKE 'rpl_semi_sync_master_status';
+ --die rpl_semi_sync_master_status should be ON to start
+}
+
+--connection server_1
+--let $init_master_yes_tx= query_get_value(SHOW STATUS LIKE 'rpl_semi_sync_master_yes_tx', Value, 1)
+create table t1 (a int);
+
+--connection server_2
+--echo # Verifying server_2 did not send ACK
+--let $slave1_sent_ack= query_get_value(SHOW STATUS LIKE 'rpl_semi_sync_slave_send_ack', Value, 1)
+if (`SELECT $slave1_sent_ack`)
+{
+ SHOW STATUS LIKE 'rpl_semi_sync_slave_send_ack';
+ --die server_2 should not have sent semi-sync ACK to primary
+}
+
+--connection server_3
+--echo # Verifying server_3 did send ACK
+--let $slave2_sent_ack= query_get_value(SHOW STATUS LIKE 'rpl_semi_sync_slave_send_ack', Value, 1)
+if (`SELECT NOT $slave2_sent_ack`)
+{
+ SHOW STATUS LIKE 'rpl_semi_sync_slave_send_ack';
+ --die server_3 should have sent semi-sync ACK to primary
+}
+
+--connection server_1
+--echo # Verifying master's semi-sync status is still ON (This failed pre-MDEV-32960 fixes)
+let $master_ss_status= query_get_value(SHOW STATUS LIKE 'rpl_semi_sync_master_status', Value, 1);
+if (`SELECT strcmp("$master_ss_status", "ON") != 0`)
+{
+ SHOW STATUS LIKE 'rpl_semi_sync_master_status';
+ --die rpl_semi_sync_master_status should not have switched off after server_3 ACKed transaction
+}
+
+--echo # Verifying rpl_semi_sync_master_yes_tx incremented
+--let $cur_master_yes_tx= query_get_value(SHOW STATUS LIKE 'rpl_semi_sync_master_yes_tx', Value, 1)
+if (`SELECT $cur_master_yes_tx != ($init_master_yes_tx + 1)`)
+{
+ --echo # Initial yes_tx: $init_master_yes_tx
+ --echo # Current yes_tx: $cur_master_yes_tx
+ --die rpl_semi_sync_master_yes_tx should have been incremented by primary
+}
+
+
+--echo #
+--echo # Cleanup
+
+--connection server_2
+set global rpl_semi_sync_slave_enabled= @old_enabled;
+set global debug_dbug= @old_dbug;
+--source include/stop_slave.inc
+
+--connection server_3
+set global rpl_semi_sync_slave_enabled= @old_enabled;
+--source include/stop_slave.inc
+
+--connection server_1
+set global rpl_semi_sync_master_enabled= @old_enabled;
+set global rpl_semi_sync_master_timeout= @old_timeout;
+drop table t1;
+
+--connection server_2
+--source include/start_slave.inc
+--connection server_3
+--source include/start_slave.inc
+
+--source include/rpl_end.inc
+--echo # End of rpl_semi_sync_no_missed_ack_after_add_slave.test
diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_shutdown_await_ack.inc b/mysql-test/suite/rpl/t/rpl_semi_sync_shutdown_await_ack.inc
index a232f685..252541ae 100644
--- a/mysql-test/suite/rpl/t/rpl_semi_sync_shutdown_await_ack.inc
+++ b/mysql-test/suite/rpl/t/rpl_semi_sync_shutdown_await_ack.inc
@@ -116,11 +116,13 @@ show status like 'Rpl_semi_sync_master_no_tx';
--connection server_2
--eval SET @@GLOBAL.debug_dbug= "$sav_server_2_dbug"
--eval SET @@GLOBAL.rpl_semi_sync_slave_enabled= 0
+--let $rpl_only_running_threads= 1
source include/stop_slave.inc;
--connection server_3
--eval SET @@GLOBAL.debug_dbug= "$sav_server_3_dbug"
--eval SET @@GLOBAL.rpl_semi_sync_slave_enabled= 0
+--let $rpl_only_running_threads= 1
source include/stop_slave.inc;
--echo #-- Bring the master back up
diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_slave_compressed_protocol.test b/mysql-test/suite/rpl/t/rpl_semi_sync_slave_compressed_protocol.test
index bc05bec2..644e6517 100644
--- a/mysql-test/suite/rpl/t/rpl_semi_sync_slave_compressed_protocol.test
+++ b/mysql-test/suite/rpl/t/rpl_semi_sync_slave_compressed_protocol.test
@@ -40,7 +40,7 @@ DROP TABLE t1;
--let $assert_select=Read semi-sync reply magic number error
--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err
--let $assert_count= 0
---let $assert_only_after = CURRENT_TEST:rpl.rpl_semi_sync_slave_compressed_protocol.test
+--let $assert_only_after = CURRENT_TEST: rpl.rpl_semi_sync_slave_compressed_protocol
--source include/assert_grep.inc
--connection master
diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_slave_enabled_consistent.test b/mysql-test/suite/rpl/t/rpl_semi_sync_slave_enabled_consistent.test
new file mode 100644
index 00000000..9e388ab4
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_semi_sync_slave_enabled_consistent.test
@@ -0,0 +1,73 @@
+#
+# MDEV-32551: "Read semi-sync reply magic number error" warnings on master
+#
+# Test that changing rpl_semi_sync_master_enabled after startup does not
+# cause problems with semi-sync cleanup.
+#
+
+--source include/have_debug.inc
+--source include/have_debug_sync.inc
+
+# Test is binlog format independent, so save resources
+--source include/have_binlog_format_row.inc
+--source include/master-slave.inc
+
+call mtr.add_suppression("Replication event checksum verification failed");
+call mtr.add_suppression("could not queue event from master");
+
+--echo #
+--echo # Set up a semisync connection
+--connection master
+set @@global.rpl_semi_sync_master_enabled= ON;
+
+--connection slave
+stop slave io_thread;
+set @@global.rpl_semi_sync_slave_enabled= ON;
+set @old_dbug= @@global.debug_dbug;
+
+# Force an error to abort out of the main IO thread loop
+set @@global.debug_dbug= "+d,corrupt_queue_event";
+
+# Pause the IO thread as soon as the main loop starts. Note we can't use
+# processlist where "Waiting for master to send event" because the
+# "corrupt_queue_event" will trigger before we can turn semisync OFF
+set @@global.debug_dbug= "+d,pause_before_io_read_event";
+
+# Because the other debug_dbug points are automatically negated when they are
+# run, and there is a bug that if "-d" takes us to an empty debug string state,
+# _all_ debug_print statements are output
+set @@global.debug_dbug= "+d,placeholder";
+
+start slave io_thread;
+
+--echo # Disable semi-sync on the slave while the IO thread is active
+set debug_sync='now wait_for io_thread_at_read_event';
+set @@global.rpl_semi_sync_slave_enabled= OFF;
+set debug_sync='now signal io_thread_continue_read_event';
+
+--echo # Waiting for the slave to stop with the error from corrupt_queue_event
+--connection slave
+--let $slave_io_errno= 1595,1743
+--source include/wait_for_slave_io_error.inc
+
+--echo # Sleep 1 to give time for Ack_receiver to receive COM_QUIT
+--sleep 1
+
+--let $assert_text= Check that there is no 'Read semi-sync reply magic number error' in error log.
+--let $assert_select=magic number error
+--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err
+--let $assert_count= 0
+--let $assert_only_after=CURRENT_TEST
+--source include/assert_grep.inc
+
+--echo #
+--echo # Cleanup
+--connection slave
+--source include/stop_slave.inc
+set @@global.debug_dbug= @old_dbug;
+--source include/start_slave.inc
+--connection master
+set @@global.rpl_semi_sync_master_enabled= default;
+
+--source include/rpl_end.inc
+--echo # End of rpl_semi_sync_slave_enabled_consistent.test
diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_slave_reply_fail.test b/mysql-test/suite/rpl/t/rpl_semi_sync_slave_reply_fail.test
index 94853799..84462ed6 100644
--- a/mysql-test/suite/rpl/t/rpl_semi_sync_slave_reply_fail.test
+++ b/mysql-test/suite/rpl/t/rpl_semi_sync_slave_reply_fail.test
@@ -31,6 +31,7 @@
--connection master
call mtr.add_suppression("Timeout waiting for reply of binlog*");
+call mtr.add_suppression("Master server does not read semi-sync messages*");
--let $sav_timeout_master=`SELECT @@GLOBAL.rpl_semi_sync_master_timeout`
set global rpl_semi_sync_master_enabled = ON;
SET @@GLOBAL.rpl_semi_sync_master_timeout=100;
@@ -54,9 +55,9 @@ if(!$log_error_)
# does not know the location of its .err log, use default location
let $log_error_ = $MYSQLTEST_VARDIR/log/mysqld.2.err;
}
---echo "Assert that the net_fulsh() reply failed is present in slave error log.
+--echo "Assert that Master server does not read semi-sync messages" is present in slave error log.
--let SEARCH_FILE=$log_error_
---let SEARCH_PATTERN=Semi-sync slave net_flush\(\) reply failed
+--let SEARCH_PATTERN=Master server does not read semi-sync messages
--source include/search_pattern_in_file.inc
--echo "Assert that Slave IO thread is up and running."
@@ -78,7 +79,7 @@ insert into t1 values (10);
--connection master
set statement sql_log_bin=0 for call mtr.add_suppression("Read semi-sync reply magic number error");
-SET @save_debug_master= @@global.debug;
+SET @save_debug_master= @@global.debug_dbug;
SET GLOBAL debug_dbug="+d,semisync_corrupt_magic";
insert into t1 values (11);
diff --git a/mysql-test/suite/rpl/t/rpl_semisync_ali_issues.test b/mysql-test/suite/rpl/t/rpl_semisync_ali_issues.test
index 5e6f350b..c5c1daa4 100644
--- a/mysql-test/suite/rpl/t/rpl_semisync_ali_issues.test
+++ b/mysql-test/suite/rpl/t/rpl_semisync_ali_issues.test
@@ -16,7 +16,6 @@ CALL mtr.add_suppression("Failed on request_dump()*");
CALL mtr.add_suppression("Semi-sync master failed on*");
CALL mtr.add_suppression("Master command COM_BINLOG_DUMP failed*");
CALL mtr.add_suppression("on master failed*");
-CALL mtr.add_suppression("Master server does not support semi-sync*");
CALL mtr.add_suppression("Semi-sync slave net_flush*");
CALL mtr.add_suppression("Failed to flush master info*");
CALL mtr.add_suppression("Request to stop slave SQL Thread received while apply*");
diff --git a/mysql-test/suite/rpl/t/rpl_session_var.test b/mysql-test/suite/rpl/t/rpl_session_var.test
index cf3faa65..3ea6d5da 100644
--- a/mysql-test/suite/rpl/t/rpl_session_var.test
+++ b/mysql-test/suite/rpl/t/rpl_session_var.test
@@ -7,6 +7,12 @@ disable_query_log;
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
enable_query_log;
+select @@rpl_semi_sync_master_enabled;
+connection slave;
+select @@rpl_semi_sync_slave_enabled;
+show status like "rpl_semi_sync_slave_status";
+connection master;
+
drop table if exists t1;
create table t1(a varchar(100),b int);
set @@session.sql_mode=pipes_as_concat;
diff --git a/mysql-test/suite/rpl/t/rpl_session_var2-master.opt b/mysql-test/suite/rpl/t/rpl_session_var2-master.opt
new file mode 100644
index 00000000..edb0c915
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_session_var2-master.opt
@@ -0,0 +1 @@
+--rpl_semi_sync_master_enabled=1 --rpl_semi_sync_slave_enabled=1
diff --git a/mysql-test/suite/rpl/t/rpl_session_var2-slave.opt b/mysql-test/suite/rpl/t/rpl_session_var2-slave.opt
new file mode 100644
index 00000000..c9f3082e
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_session_var2-slave.opt
@@ -0,0 +1 @@
+--rpl_semi_sync_slave_enabled=1
diff --git a/mysql-test/suite/rpl/t/rpl_session_var2.test b/mysql-test/suite/rpl/t/rpl_session_var2.test
new file mode 100644
index 00000000..cbf8a5cf
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_session_var2.test
@@ -0,0 +1,3 @@
+# Replication of session variables when semi-sync is on
+
+--source rpl_session_var.test
diff --git a/mysql-test/suite/rpl/t/rpl_set_statement_default_master.test b/mysql-test/suite/rpl/t/rpl_set_statement_default_master.test
index 106cb454..d30da61b 100644
--- a/mysql-test/suite/rpl/t/rpl_set_statement_default_master.test
+++ b/mysql-test/suite/rpl/t/rpl_set_statement_default_master.test
@@ -26,6 +26,7 @@ eval CHANGE MASTER 'm1' TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT,
SET STATEMENT default_master_connection = 'm1' FOR START SLAVE;
set default_master_connection = 'm1';
+--source include/wait_for_slave_to_start.inc
stop slave;
--source include/wait_for_slave_to_stop.inc
reset slave all;
diff --git a/mysql-test/suite/rpl/t/rpl_shutdown_wait_semisync_slaves.test b/mysql-test/suite/rpl/t/rpl_shutdown_wait_semisync_slaves.test
index 2c63df30..0547a97f 100644
--- a/mysql-test/suite/rpl/t/rpl_shutdown_wait_semisync_slaves.test
+++ b/mysql-test/suite/rpl/t/rpl_shutdown_wait_semisync_slaves.test
@@ -28,6 +28,9 @@ while (`SELECT $i <= $slaves`)
--inc $i
}
+# The following script will restart master and slaves. This will also set
+# rpl_semi_sync_master_enabled=0
+
--source include/rpl_shutdown_wait_slaves.inc
--let i= 2
while (`SELECT $i <= $slaves`)
diff --git a/mysql-test/suite/rpl/t/rpl_slave_load_tmpdir_not_exist.test b/mysql-test/suite/rpl/t/rpl_slave_load_tmpdir_not_exist.test
index 16dcd8ec..89b7c7f1 100644
--- a/mysql-test/suite/rpl/t/rpl_slave_load_tmpdir_not_exist.test
+++ b/mysql-test/suite/rpl/t/rpl_slave_load_tmpdir_not_exist.test
@@ -15,6 +15,7 @@ call mtr.add_suppression("Slave SQL.*Unable to use slave.s temporary directory")
--let $slave_sql_errno= 12
source include/wait_for_slave_sql_error.inc;
+--source include/wait_for_slave_io_to_start.inc
--source include/stop_slave_io.inc
RESET SLAVE;
diff --git a/mysql-test/suite/rpl/t/rpl_slave_status.test b/mysql-test/suite/rpl/t/rpl_slave_status.test
index 63e37216..fb552d64 100644
--- a/mysql-test/suite/rpl/t/rpl_slave_status.test
+++ b/mysql-test/suite/rpl/t/rpl_slave_status.test
@@ -59,7 +59,6 @@ sync_slave_with_master;
source include/stop_slave.inc;
START SLAVE;
source include/wait_for_slave_sql_to_start.inc;
-source include/wait_for_slave_io_to_stop.inc;
--echo ==== Verify that Slave IO thread stopped with error ====
# 1045 = ER_ACCESS_DENIED_ERROR
@@ -68,7 +67,7 @@ source include/wait_for_slave_io_to_stop.inc;
--echo ==== Cleanup (Note that slave IO thread is not running) ====
-# cleanup: slave io thread has is stopped so we reset replication
+# cleanup: slave io thread is stopped so we reset replication
--source include/stop_slave_sql.inc
CHANGE MASTER TO MASTER_USER = 'root', MASTER_PASSWORD = '';
# clear Slave_IO_Errno
diff --git a/mysql-test/suite/rpl/t/rpl_sql_thd_start_errno_cleared.test b/mysql-test/suite/rpl/t/rpl_sql_thd_start_errno_cleared.test
index f6dcfd91..8b096902 100644
--- a/mysql-test/suite/rpl/t/rpl_sql_thd_start_errno_cleared.test
+++ b/mysql-test/suite/rpl/t/rpl_sql_thd_start_errno_cleared.test
@@ -76,6 +76,10 @@ if ($last_error)
set debug_sync= "now signal sql_thread_continue";
+--echo # Wait for debug_sync signal to have been received before issuing RESET
+let $wait_condition= select count(*)=0 from information_schema.processlist where state like "debug sync point%";
+source include/wait_condition.inc;
+
set @@global.debug_dbug= @saved_dbug;
set debug_sync= "RESET";
diff --git a/mysql-test/suite/rpl/t/rpl_ssl1.test b/mysql-test/suite/rpl/t/rpl_ssl1.test
index d994dd21..04f6cfff 100644
--- a/mysql-test/suite/rpl/t/rpl_ssl1.test
+++ b/mysql-test/suite/rpl/t/rpl_ssl1.test
@@ -29,8 +29,10 @@ connection slave;
select * from t1;
#showing that replication could work with ssl params
-stop slave;
---source include/wait_for_slave_to_stop.inc
+--let $slave_io_errno=1045
+--source include/wait_for_slave_io_error.inc
+--source include/stop_slave_sql.inc
+
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
eval 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;
diff --git a/mysql-test/suite/rpl/t/rpl_start_alter_1.test b/mysql-test/suite/rpl/t/rpl_start_alter_1.test
index 9ce061f1..b16f6a53 100644
--- a/mysql-test/suite/rpl/t/rpl_start_alter_1.test
+++ b/mysql-test/suite/rpl/t/rpl_start_alter_1.test
@@ -6,6 +6,7 @@
--source include/master-slave.inc
--connection master
+ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
--let $binlog_alter_two_phase= `select @@binlog_alter_two_phase`
set global binlog_alter_two_phase = ON;
set binlog_alter_two_phase = ON;
diff --git a/mysql-test/suite/rpl/t/rpl_start_alter_2.test b/mysql-test/suite/rpl/t/rpl_start_alter_2.test
index 457409c5..a5cef2e5 100644
--- a/mysql-test/suite/rpl/t/rpl_start_alter_2.test
+++ b/mysql-test/suite/rpl/t/rpl_start_alter_2.test
@@ -8,9 +8,11 @@
--source include/have_debug.inc
--source include/master-slave.inc
--connection master
+ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
--let $binlog_alter_two_phase= `select @@binlog_alter_two_phase`
set global binlog_alter_two_phase = ON;
set binlog_alter_two_phase = ON;
+
--connection slave
--let $gtid_strict_mode= `select @@gtid_strict_mode`
--let $slave_parallel_threads= `select @@slave_parallel_threads`
diff --git a/mysql-test/suite/rpl/t/rpl_start_alter_3.test b/mysql-test/suite/rpl/t/rpl_start_alter_3.test
index b280aeb9..8207dcbb 100644
--- a/mysql-test/suite/rpl/t/rpl_start_alter_3.test
+++ b/mysql-test/suite/rpl/t/rpl_start_alter_3.test
@@ -9,9 +9,11 @@
--source include/master-slave.inc
--source include/have_debug.inc
--connection master
+ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
--let $binlog_alter_two_phase= `select @@binlog_alter_two_phase`
set global binlog_alter_two_phase = ON;
set binlog_alter_two_phase = ON;
+
--connection slave
--let $gtid_strict_mode= `select @@gtid_strict_mode`
--let $slave_parallel_threads= `select @@slave_parallel_threads`
diff --git a/mysql-test/suite/rpl/t/rpl_start_alter_4.test b/mysql-test/suite/rpl/t/rpl_start_alter_4.test
index 8c67b50a..f4edc4b9 100644
--- a/mysql-test/suite/rpl/t/rpl_start_alter_4.test
+++ b/mysql-test/suite/rpl/t/rpl_start_alter_4.test
@@ -9,6 +9,7 @@
--source include/master-slave.inc
--source include/have_debug.inc
--connection master
+ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
--let $binlog_alter_two_phase= `select @@binlog_alter_two_phase`
set global binlog_alter_two_phase = ON;
set binlog_alter_two_phase = ON;
diff --git a/mysql-test/suite/rpl/t/rpl_start_alter_5.test b/mysql-test/suite/rpl/t/rpl_start_alter_5.test
index 10d0d523..b2d31f21 100644
--- a/mysql-test/suite/rpl/t/rpl_start_alter_5.test
+++ b/mysql-test/suite/rpl/t/rpl_start_alter_5.test
@@ -9,6 +9,7 @@
--source include/master-slave.inc
--source include/have_debug.inc
--connection master
+ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
--let $binlog_alter_two_phase= `select @@binlog_alter_two_phase`
set global binlog_alter_two_phase = ON;
set binlog_alter_two_phase = ON;
diff --git a/mysql-test/suite/rpl/t/rpl_start_alter_6.test b/mysql-test/suite/rpl/t/rpl_start_alter_6.test
index fc49ea4a..6c2b5015 100644
--- a/mysql-test/suite/rpl/t/rpl_start_alter_6.test
+++ b/mysql-test/suite/rpl/t/rpl_start_alter_6.test
@@ -10,6 +10,7 @@
--source include/master-slave.inc
--source include/have_debug.inc
--connection master
+ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
--let $binlog_alter_two_phase= `select @@binlog_alter_two_phase`
set global binlog_alter_two_phase = ON;
set binlog_alter_two_phase = ON;
diff --git a/mysql-test/suite/rpl/t/rpl_start_alter_7.test b/mysql-test/suite/rpl/t/rpl_start_alter_7.test
index 7225c075..21c21c85 100644
--- a/mysql-test/suite/rpl/t/rpl_start_alter_7.test
+++ b/mysql-test/suite/rpl/t/rpl_start_alter_7.test
@@ -21,6 +21,10 @@ stop slave;
set global binlog_alter_two_phase=true;
--connection server_3
+SET STATEMENT sql_log_bin=0 FOR
+ CALL mtr.add_suppression("The table mysql.gtid_slave_pos was removed. This change will not take full effect until all SQL threads have been restarted");
+SET STATEMENT sql_log_bin=0 FOR
+ ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
--let $gtid_strict_mode= `select @@gtid_strict_mode`
--let $slave_parallel_threads= `select @@slave_parallel_threads`
--let $slave_parallel_mode= `select @@slave_parallel_mode`
diff --git a/mysql-test/suite/rpl/t/rpl_start_alter_8.test b/mysql-test/suite/rpl/t/rpl_start_alter_8.test
index 4ab8e2b0..c8c5ac74 100644
--- a/mysql-test/suite/rpl/t/rpl_start_alter_8.test
+++ b/mysql-test/suite/rpl/t/rpl_start_alter_8.test
@@ -21,6 +21,10 @@ stop slave;
set global binlog_alter_two_phase=true;
--connection server_3
+SET STATEMENT sql_log_bin=0 FOR
+ CALL mtr.add_suppression("The table mysql.gtid_slave_pos was removed. This change will not take full effect until all SQL threads have been restarted");
+SET STATEMENT sql_log_bin=0 FOR
+ ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
--let $gtid_strict_mode= `select @@gtid_strict_mode`
--let $slave_parallel_threads= `select @@slave_parallel_threads`
--let $slave_parallel_mode= `select @@slave_parallel_mode`
diff --git a/mysql-test/suite/rpl/t/rpl_start_alter_mysqlbinlog_1.test b/mysql-test/suite/rpl/t/rpl_start_alter_mysqlbinlog_1.test
index f655d3c1..a2f6adcc 100644
--- a/mysql-test/suite/rpl/t/rpl_start_alter_mysqlbinlog_1.test
+++ b/mysql-test/suite/rpl/t/rpl_start_alter_mysqlbinlog_1.test
@@ -10,6 +10,8 @@
set global binlog_alter_two_phase=true;
--connection slave
--source include/stop_slave.inc
+SET STATEMENT sql_log_bin=0 FOR
+ ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
set global gtid_strict_mode=1;
--echo # Legacy Master Slave
diff --git a/mysql-test/suite/rpl/t/rpl_start_alter_mysqlbinlog_2.test b/mysql-test/suite/rpl/t/rpl_start_alter_mysqlbinlog_2.test
index c7d5bd66..9d9675c6 100644
--- a/mysql-test/suite/rpl/t/rpl_start_alter_mysqlbinlog_2.test
+++ b/mysql-test/suite/rpl/t/rpl_start_alter_mysqlbinlog_2.test
@@ -57,6 +57,10 @@ SET @save_binlog_alter_two_phase= @@GLOBAL.binlog_alter_two_phase;
SET GLOBAL binlog_alter_two_phase = ON;
--connection server_3
+SET STATEMENT sql_log_bin=0 FOR
+ CALL mtr.add_suppression("The table mysql.gtid_slave_pos was removed. This change will not take full effect until all SQL threads have been restarted");
+SET STATEMENT sql_log_bin=0 FOR
+ ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
SET @save_gtid_strict_mode= @@GLOBAL.gtid_strict_mode;
SET @slave_parallel_threads= @@GLOBAL.slave_parallel_threads;
SET @slave_parallel_mode= @@GLOBAL.slave_parallel_mode;
diff --git a/mysql-test/suite/rpl/t/rpl_start_alter_restart_slave.test b/mysql-test/suite/rpl/t/rpl_start_alter_restart_slave.test
index df028ff1..5dcb0bf8 100644
--- a/mysql-test/suite/rpl/t/rpl_start_alter_restart_slave.test
+++ b/mysql-test/suite/rpl/t/rpl_start_alter_restart_slave.test
@@ -90,8 +90,12 @@ SET GLOBAL debug_dbug= @old_debug_slave;
select domain_id, seq_no from mysql.gtid_slave_pos order by seq_no desc limit 1;
--source include/start_slave.inc
+
--connection master
---sync_slave_with_master
+--source include/save_master_gtid.inc
+
+--connection slave
+--source include/sync_with_master_gtid.inc
--echo # Everything from the master binlog must have been applied now:
select domain_id, seq_no from mysql.gtid_slave_pos order by seq_no desc limit 1;
--let $slave_gtid_state = `select @@gtid_binlog_state`
diff --git a/mysql-test/suite/rpl/t/rpl_temporary_errors.test b/mysql-test/suite/rpl/t/rpl_temporary_errors.test
index 85e16afa..4d179cd5 100644
--- a/mysql-test/suite/rpl/t/rpl_temporary_errors.test
+++ b/mysql-test/suite/rpl/t/rpl_temporary_errors.test
@@ -71,13 +71,15 @@ connection slave;
set @@global.innodb_lock_wait_timeout=1;
set @@global.slave_transaction_retries=100;
+--let $rpl_allow_error=1
--source include/restart_slave_sql.inc
+--let $rpl_allow_error=0
--let $last_retries= query_get_value(SHOW GLOBAL STATUS LIKE 'Slave_retried_transactions', Value, 1)
--let $status_type=GLOBAL
--let $status_var=Slave_retried_transactions
--let $status_var_value=`SELECT 1 + $last_retries`
---let $$status_var_comparsion= >
+--let $status_var_comparsion= >
--source include/wait_for_status_var.inc
# Release the record after just one retry
diff --git a/mysql-test/suite/rpl/t/rpl_using_gtid_default.test b/mysql-test/suite/rpl/t/rpl_using_gtid_default.test
index eab5b4dd..c14695f9 100644
--- a/mysql-test/suite/rpl/t/rpl_using_gtid_default.test
+++ b/mysql-test/suite/rpl/t/rpl_using_gtid_default.test
@@ -271,7 +271,10 @@ eval set global gtid_slave_pos="$old_slave_pos";
--echo # not master_use_gtid=no should warn the user that Using_Gtid is being
--echo # changed to No.
--echo #
+--connection master
+--source include/save_master_pos.inc
--connection slave
+--source include/sync_io_with_master.inc
--let $io_log_pos= query_get_value('SHOW SLAVE STATUS', Read_Master_Log_Pos, 1)
--let $io_log_file= query_get_value('SHOW SLAVE STATUS', Master_Log_File, 1)
--source include/stop_slave.inc
diff --git a/mysql-test/suite/rpl/t/semisync_future-7591.test b/mysql-test/suite/rpl/t/semisync_future-7591.test
index 793d8bcc..ce01e41f 100644
--- a/mysql-test/suite/rpl/t/semisync_future-7591.test
+++ b/mysql-test/suite/rpl/t/semisync_future-7591.test
@@ -19,7 +19,7 @@ insert into t1 values (1);
reset master;
--connection slave
---source include/stop_slave.inc
+--source include/stop_slave_sql.inc
--let $master_use_gtid_option= No
--source include/reset_slave.inc
--source include/start_slave.inc
diff --git a/mysql-test/suite/rpl/t/show_status_stop_slave_race-7126.test b/mysql-test/suite/rpl/t/show_status_stop_slave_race-7126.test
index 12794dbd..cd0f8aad 100644
--- a/mysql-test/suite/rpl/t/show_status_stop_slave_race-7126.test
+++ b/mysql-test/suite/rpl/t/show_status_stop_slave_race-7126.test
@@ -15,6 +15,9 @@ call mtr.add_suppression("Master is configured to log replication events");
# All done.
--connection slave
+# The parallel START SLAVE can leave an error condition if the last START was
+# aborted by the master due to conflicting server_id from multiple connections.
+--let $rpl_allow_error= 1
--source include/wait_for_slave_to_stop.inc
start slave;