diff --git a/mysql-test/main/rli_run_lock.result b/mysql-test/main/rli_run_lock.result new file mode 100644 index 00000000000..480316ab8f3 --- /dev/null +++ b/mysql-test/main/rli_run_lock.result @@ -0,0 +1,11 @@ +CHANGE MASTER TO master_host='127.0.0.1', master_user='root'; +START SLAVE SQL_THREAD; +include/wait_for_slave_sql_to_start.inc +SET @@GLOBAL.debug_dbug= '+d,hold_sss_with_run_lock'; +SHOW SLAVE STATUS; +connect stopper, 127.0.0.1, root, , , $SERVER_MYPORT_1; +SET @@SESSION.debug_sync= 'now WAIT_FOR sss_got_run_lock'; +STOP SLAVE SQL_THREAD; +connection default; +disconnect stopper; +SET @@SESSION.debug_sync= RESET; diff --git a/mysql-test/main/rli_run_lock.test b/mysql-test/main/rli_run_lock.test new file mode 100644 index 00000000000..b955b53bde3 --- /dev/null +++ b/mysql-test/main/rli_run_lock.test @@ -0,0 +1,30 @@ +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/have_binlog_format_mixed.inc # No actual replication required +CHANGE MASTER TO master_host='127.0.0.1', master_user='root'; # basic setup + +START SLAVE SQL_THREAD; +--source include/wait_for_slave_sql_to_start.inc + + +SET @@GLOBAL.debug_dbug= '+d,hold_sss_with_run_lock'; +--send SHOW SLAVE STATUS + +--connect (stopper, 127.0.0.1, root, , , $SERVER_MYPORT_1) + SET @@SESSION.debug_sync= 'now WAIT_FOR sss_got_run_lock'; + STOP SLAVE SQL_THREAD; + # Wait a bit for the thread to "shut down" + # (It should not shut down, but wait for the ongoing SSS; + # the bug instead pulls this carpet under the SSS's feet.) + --sleep 3 + SET @@SESSION.debug_sync= 'now SIGNAL sss_continue'; +--connection default +--disconnect stopper + + +--disable_result_log + --reap +--enable_result_log + +SET @@SESSION.debug_sync= RESET; +--source include/wait_for_slave_sql_to_stop.inc diff --git a/sql/slave.cc b/sql/slave.cc index 0f11630dde0..5458b3f43e2 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -3396,6 +3396,11 @@ static bool send_show_master_info_data(THD *thd, Master_info *mi, bool full, mysql_mutex_lock(&mi->run_lock); THD *sql_thd= mi->rli.sql_driver_thd; + DBUG_EXECUTE_IF("hold_sss_with_run_lock", { + DBUG_SET("-d,hold_sss_with_run_lock"); + DBUG_ASSERT(!debug_sync_set_action(thd, + STRING_WITH_LEN("now SIGNAL sss_got_run_lock WAIT_FOR sss_continue"))); + }); const char *slave_sql_running_state= sql_thd ? sql_thd->get_proc_info() : ""; THD *io_thd= mi->io_thd;