1###############################################################################
2# Bug#13963 SHOW SLAVE HOSTS is unreliable
3#
4# Slaves only appear in the output of SHOW SLAVE HOSTS when report-host option
5# is set. If an expected slave does not appear in the list, nobody knows
6# whether the slave does not connect or has started without the "report-host"
7# option.
8#
9# Remove the "Rpl_recovery_rank" column from SHOW SLAVE HOSTS, It is not
10# implemented.
11#######################################################################
12source include/master-slave.inc;
13connect (slave2,127.0.0.1,root,,test,$SLAVE_MYPORT2,);
14
15connection slave2;
16RESET SLAVE;
17--replace_result $MASTER_MYPORT MASTER_PORT
18--eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$MASTER_MYPORT,master_user='root'
19START SLAVE IO_THREAD;
20source include/wait_for_slave_io_to_start.inc;
21
22connection master;
23let $show_statement= SHOW SLAVE HOSTS;
24let $field= Server_id;
25# 3 is server_id of slave2.
26let $condition= ='3';
27source include/wait_show_condition.inc;
28# Make sure that the other slave also had time to register. Otherwise we get
29# occasional spurious failures where server_id=2 is missing from SHOW SLAVE
30# HOSTS, when that slave is much slower to register due to thread scheduling.
31let $condition= ='2';
32source include/wait_show_condition.inc;
33--replace_column 3 'SLAVE_PORT'
34--replace_result $SLAVE_MYPORT SLAVE_PORT $DEFAULT_MASTER_PORT DEFAULT_PORT
35SHOW SLAVE HOSTS;
36
37connection slave2;
38--source include/stop_slave_io.inc
39
40connection master;
41let $show_statement= SHOW SLAVE HOSTS;
42let $field= Server_id;
43# 3 is server_id of slave2.
44let $condition= <> '3';
45# All rows of 'SHOW SLAVE HOSTS' are not equal to 3.  It mean that master has
46# knew the leave of slave2 and has unregistered it.
47let $wait_for_all= 1;
48source include/wait_show_condition.inc;
49--replace_result $SLAVE_MYPORT SLAVE_PORT
50SHOW SLAVE HOSTS;
51
52--source include/rpl_end.inc
53