Bug #21804 SHOW SLAVE HOSTS lists itself and other slaves on a SLAVE!
Submitted: 24 Aug 2006 8:19 Modified: 29 Aug 2006 16:43
Reporter: Oli Sennhauser Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:any, up to 5.0.24 OS:n.a.
Assigned to: Stefan Hinz CPU Architecture:Any

[24 Aug 2006 8:19] Oli Sennhauser
Description:
When I have a Master M and 2 Slaves S1 and S2 on the same host SHOW SLAVE HOSTS lists the slaves on M correctly but also list S1 and S2 on both hosts.

This IMHO is eighter a bug or not properly documented.

See also Bug: http://bugs.mysql.com/bug.php?id=13963

How to repeat:
Setup M and S1 and S2 on same host and set report_host and repot_port on both slaves.
master> show slave hosts;
+-----------+--------------+------+-------------------+-----------+
| Server_id | Host         | Port | Rpl_recovery_rank | Master_id |
+-----------+--------------+------+-------------------+-----------+
|        18 | Slave 5.0.22 | 3318 |                 0 |        15 |
|        28 | Slave 5.0.24 | 3328 |                 0 |        15 |
+-----------+--------------+------+-------------------+-----------+

slave1> show slave hosts;
+-----------+--------------+------+-------------------+-----------+
| Server_id | Host         | Port | Rpl_recovery_rank | Master_id |
+-----------+--------------+------+-------------------+-----------+
|        28 | Slave 5.0.24 | 3328 |                 0 |        15 |
|        18 | Slave 5.0.22 | 3318 |                 0 |        15 |
+-----------+--------------+------+-------------------+-----------+

slave2> show slave hosts;
+-----------+--------------+------+-------------------+-----------+
| Server_id | Host         | Port | Rpl_recovery_rank | Master_id |
+-----------+--------------+------+-------------------+-----------+
|        18 | Slave 5.0.22 | 3318 |                 0 |        15 |
|        28 | Slave 5.0.24 | 3328 |                 0 |        15 |
+-----------+--------------+------+-------------------+-----------+

Suggested fix:
Eighter fix this (IMHO this sould not be displayed on slave) or adapt documentation:

http://dev.mysql.com/doc/refman/5.0/en/show-slave-hosts.html
http://dev.mysql.com/doc/refman/5.0/en/replication-options.html
[25 Aug 2006 21:19] Sveta Smirnova
There are other commands allow to control master on slaves, so I classify it as documentation bug: there is not any information about GRANTs user with REPLICATION SLAVE privilege has.
[27 Aug 2006 15:05] Stefan Hinz
The documentation doesn't say that replication slaves are reported *on* the master, but rather says this: "Displays a list of replication slaves currently registered with the master." If you think this should be restricted to work *on* the master only, please file a Server:Replication bug.
[28 Aug 2006 8:14] Sveta Smirnova
Documentation contains chapter "SQL Statements for Controlling Master Servers". 
This chapter contains, for example, "SHOW SLAVE HOSTS" statement working on slave and returns useful information and "PURGE MASTER LOGS" statement working on master only. But documentation contains no word about difference between these 2 statements: new user only can try these statements self to get exact information how they work or even make guesswork about work of these statements.
[29 Aug 2006 16:44] Stefan Hinz
Thank you for your bug report. This issue has been addressed in the documentation. The updated documentation will appear on our website shortly, and will be included in the next release of the relevant products.