Bug #47724 SHOW SLAVE HOSTS reports incorrect port number
Submitted: 29 Sep 2009 18:30 Modified: 23 Dec 2009 21:26
Reporter: Gary Smith Email Updates:
Status: Verified Impact on me:
Category:MySQL Server Severity:S4 (Feature request)
Version:5.1.35, 5.0, 5.1 bzr OS:Any
Assigned to: Assigned Account CPU Architecture:Any

[29 Sep 2009 18:30] Gary Smith
When you execute the command "SHOW SLAVE HOSTS" on a master which operates on a different port than 3306, the expected port is not displayed.

| Server_id | Host       | Port | Rpl_recovery_rank | Master_id |
|        99 | myhostname | 3306 |                 0 |        98 | 

We are not running mysqld on the default port.  As such, we would expect to see the port that mysqld is running on displayed.  Running netstat -atunep shows the connection from the client, which is using a random port, to connect to the non-default port that we have specified. Nothing is running on 3306, so it was suprising to see this pop-up on the results.

How to repeat:
Configure machine as master, setup a slave, start replication, run "SHOW SLAVE HOSTS" on master.

Suggested fix:
Put in the correct port number.
[29 Sep 2009 19:51] Sveta Smirnova
Thank you for the report.

Verified as described.
[23 Dec 2009 21:09] Sveta Smirnova
This is not a bug: there is option report_port to display correct port #. See also http://dev.mysql.com/doc/refman/5.1/en/replication-options-slave.html#option_mysqld_report...
[23 Dec 2009 21:20] Gary Smith
I can understand what you are saying with that option, but it makes no sense in how it defaults to a value.  The master server is reporting that the slave is either talking/answering/whatever on the default port.  So I need to specify on the slave what that "hey, I know I told you to listen on a non-standard port, but while you are at it, make sure you tell master that as well" by using two seperate configuration parameters.  

From the docs
The TCP/IP port number for connecting to the slave, to be reported to the master during slave registration. Set this only if the slave is listening on a nondefault port or if you have a special tunnel from the master or other clients to the slave. If you are not sure, do not use this option. 

It's reporting the defualt value of 3306 even though there is no process at all even remotely listening on that port.  Even if this is not a bug, I think that it's a significant deficit in design.  In what case would it ever be useful to keep that default even though the listening port is different?

Would it not make more sense to use the default value of listening port instead of 3306 unless the override (to command above) is given?

I vote that it's still a bug.  Maybe a bug with a documented work around, but never the less, a bug in design.
[23 Dec 2009 21:26] Sveta Smirnova
Thank you for the feedback.

I agree and change to feature request "please display some NULL value or so if report-port was not set"