Commit e0cff1e7 authored by Monty's avatar Monty

Fixed failure in rpl.rpl_change_master_demote : "IO thread should not be running..."

The issue was that the test did not take into account that the IO thread
could have been in COMMAND=Connecting state, which happens before the
COMMANMD=Slave_IO state.

The test is a bit fragile as it depends on the COMMAND state to be
syncronised with the Slave_IO_State, which is not the case.

I added a new proc state and some more information to the error
output to be able to diagnose future failures more easily.
parent dd997809
...@@ -295,19 +295,20 @@ eval START SLAVE UNTIL master_gtid_pos="$ssu_middle_binlog_pos"; ...@@ -295,19 +295,20 @@ eval START SLAVE UNTIL master_gtid_pos="$ssu_middle_binlog_pos";
--let $wait_condition= SELECT count(*)=0 from information_schema.PROCESSLIST where COMMAND="Slave_SQL" --let $wait_condition= SELECT count(*)=0 from information_schema.PROCESSLIST where COMMAND="Slave_SQL"
--source include/wait_condition.inc --source include/wait_condition.inc
--echo # Waiting for IO thread to be killed.. --echo # Waiting for IO thread to be killed..
--let $wait_condition= SELECT count(*)=0 from information_schema.PROCESSLIST where COMMAND="Slave_IO" --let $wait_condition= SELECT count(*)=0 from information_schema.PROCESSLIST where COMMAND="Slave_IO" or COMMAND="Connect"
--source include/wait_condition.inc --source include/wait_condition.inc
--echo # Validating neither SQL nor IO threads are running.. --echo # Validating neither SQL nor IO threads are running..
--let $io_state= query_get_value("SHOW SLAVE STATUS", Slave_IO_State, 1) --let $io_state= query_get_value("SHOW SLAVE STATUS", Slave_IO_State, 1)
if (`SELECT strcmp("$io_state","") != 0`) if (`SELECT strcmp("$io_state","") != 0`)
{ {
die "IO thread should not be running after START SLAVE UNTIL master_gtid_pos using a pre-existing GTID"; SELECT * from information_schema.PROCESSLIST;
die "IO thread should not be running after START SLAVE UNTIL master_gtid_pos using a pre-existing GTID. Slave_IO_State=$io_state";
} }
--let $sql_state= query_get_value("SHOW SLAVE STATUS", Slave_SQL_Running_State, 1) --let $sql_state= query_get_value("SHOW SLAVE STATUS", Slave_SQL_Running_State, 1)
if (`SELECT strcmp("$sql_state","") != 0`) if (`SELECT strcmp("$sql_state","") != 0`)
{ {
die "SQL thread should not be running after START SLAVE UNTIL master_gtid_pos using a pre-existing GTID"; die "SQL thread should not be running after START SLAVE UNTIL master_gtid_pos using a pre-existing GTID. Slave_SQL_Running_State=$sql_state";
} }
--echo # ..success --echo # ..success
......
...@@ -9324,6 +9324,7 @@ PSI_stage_info stage_deleting_from_reference_tables= { 0, "Deleting from referen ...@@ -9324,6 +9324,7 @@ PSI_stage_info stage_deleting_from_reference_tables= { 0, "Deleting from referen
PSI_stage_info stage_discard_or_import_tablespace= { 0, "Discard_or_import_tablespace", 0}; PSI_stage_info stage_discard_or_import_tablespace= { 0, "Discard_or_import_tablespace", 0};
PSI_stage_info stage_enabling_keys= { 0, "Enabling keys", 0}; PSI_stage_info stage_enabling_keys= { 0, "Enabling keys", 0};
PSI_stage_info stage_end= { 0, "End of update loop", 0}; PSI_stage_info stage_end= { 0, "End of update loop", 0};
PSI_stage_info stage_ending_io_thread= { 0, "Ending IO thread", 0};
PSI_stage_info stage_executing= { 0, "Executing", 0}; PSI_stage_info stage_executing= { 0, "Executing", 0};
PSI_stage_info stage_execution_of_init_command= { 0, "Execution of init_command", 0}; PSI_stage_info stage_execution_of_init_command= { 0, "Execution of init_command", 0};
PSI_stage_info stage_explaining= { 0, "Explaining", 0}; PSI_stage_info stage_explaining= { 0, "Explaining", 0};
......
...@@ -594,6 +594,7 @@ extern PSI_stage_info stage_deleting_from_main_table; ...@@ -594,6 +594,7 @@ extern PSI_stage_info stage_deleting_from_main_table;
extern PSI_stage_info stage_deleting_from_reference_tables; extern PSI_stage_info stage_deleting_from_reference_tables;
extern PSI_stage_info stage_discard_or_import_tablespace; extern PSI_stage_info stage_discard_or_import_tablespace;
extern PSI_stage_info stage_end; extern PSI_stage_info stage_end;
extern PSI_stage_info stage_ending_io_thread;
extern PSI_stage_info stage_enabling_keys; extern PSI_stage_info stage_enabling_keys;
extern PSI_stage_info stage_executing; extern PSI_stage_info stage_executing;
extern PSI_stage_info stage_execution_of_init_command; extern PSI_stage_info stage_execution_of_init_command;
......
...@@ -5195,6 +5195,7 @@ log space"); ...@@ -5195,6 +5195,7 @@ log space");
// error = 0; // error = 0;
err: err:
THD_STAGE_INFO(thd, stage_ending_io_thread);
// print the current replication position // print the current replication position
if (mi->using_gtid == Master_info::USE_GTID_NO) if (mi->using_gtid == Master_info::USE_GTID_NO)
sql_print_information("Slave I/O thread exiting, read up to log '%s', " sql_print_information("Slave I/O thread exiting, read up to log '%s', "
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment