Bug #13963 SHOW SLAVE HOSTS is unreliable
Submitted: 12 Oct 2005 17:47 Modified: 26 Mar 2007 13:21
Reporter: John David Duncan
Status: Verified
Category:Server: Replication Severity:S3 (Non-critical)
Version:5.0 OS:Linux (Linux)
Assigned to: Zhenxing He Target Version:6.0
Triage: D3 (Medium)

[12 Oct 2005 17:47] John David Duncan
Description:
The SHOW SLAVE HOSTS command could be very useful, but in fact its output is ambiguous and
uninformative.  Slaves appear in the output of SHOW SLAVE HOSTS if they have the
"report-host" option set and they either *are* or *have previously been* connected.  If an
expected slave does not appear in the list, nobody knows whether this is because the slave
is not connected or if it simply did not start with the "report-host" option.  When a
slave does appear in the list, there is no way of knowing whether it is currently
connected or simply has been at some time in the past.

The output also contains strange information. "Rpl_recovery_rank" is not implemented, and
"Port" simply indicates master's port number (which is easily available from other
sources, and says absolutely nothing about the slave).

How to repeat:
Start a slave with the --report-host option.  Run SHOW SLAVE HOSTS on the master.  Run
STOP SLAVE on the slave.  Connect another slave started without the --report-host option. 
Run SHOW SLAVE HOSTS again. 

Suggested fix:
1) If "report-host" is not set, but a slave thread is started, have report-host default to
a value like "Slave_n" (where n is the server-id).

2) Remove the "Rpl_recovery_rank" column from SHOW SLAVE HOSTS unless it is implemented.

3) Remove the "Port" column or use it to indicate the client TCP port of the slave's IO
thread. 

4) Remove a slave from the output table after it disconnects, or add a column to the table
to indicate its status as "connected" or "disconnected," or add a "last seen" timestamp
column. 

5)  Bind "report-host" to a server global variable, at least in a read-only fashion  (the
only current way for a DBA to know what "report-host" is set to is to look in my.cnf).

6) When the mysqlbinlog utility connects to a master over the network, it should identify
itself as "mysqlbinlog"
[12 Oct 2005 19:39] Jorge del Conde
Reproduced using a recent 5.0bk pull under FC4
[12 Mar 2007 19:51] Rafal Somla
See HLS of WL#2860 for the issue which must be decided.
[21 May 2007 12:29] Lars Thalmann
Related to BUG#21132.
[6 Dec 2007 3:29] Baron "Xaprb" Schwartz
The port doesn't show the master's port.  It shows the port the slave is configured to
report with --report-host.  If this is not configure, it shows the default port (3306).
[6 Dec 2007 3:30] Baron "Xaprb" Schwartz
Sorry, I mean --report-port :-(  There are several other --report-X parameters too.