Commit 0d5d8d2e authored by Markus Mäkelä's avatar Markus Mäkelä Committed by Robert Bindar

Always print slave host in SHOW SLAVE HOSTS

Since the client host can be extracted from the network connection, it can
always be printed. This makes it easier to find out where a slave is
replicating from. It could also be used to automatically discover slaves
that are replicating from a master.
parent 1e9aa46d
...@@ -10,11 +10,11 @@ connection master; ...@@ -10,11 +10,11 @@ connection master;
SHOW SLAVE HOSTS; SHOW SLAVE HOSTS;
Server_id Host Port Master_id Server_id Host Port Master_id
3 slave2 SLAVE_PORT 1 3 slave2 SLAVE_PORT 1
2 SLAVE_PORT 1 2 localhost SLAVE_PORT 1
connection slave2; connection slave2;
include/stop_slave_io.inc include/stop_slave_io.inc
connection master; connection master;
SHOW SLAVE HOSTS; SHOW SLAVE HOSTS;
Server_id Host Port Master_id Server_id Host Port Master_id
2 SLAVE_PORT 1 2 localhost SLAVE_PORT 1
include/rpl_end.inc include/rpl_end.inc
...@@ -147,6 +147,9 @@ int THD::register_slave(uchar *packet, size_t packet_length) ...@@ -147,6 +147,9 @@ int THD::register_slave(uchar *packet, size_t packet_length)
if (!(si->master_id= uint4korr(p))) if (!(si->master_id= uint4korr(p)))
si->master_id= global_system_variables.server_id; si->master_id= global_system_variables.server_id;
if (!*si->host)
::strmake(si->host, main_security_ctx.host_or_ip, sizeof(si->host));
unregister_slave(); unregister_slave();
mysql_mutex_lock(&LOCK_thd_data); mysql_mutex_lock(&LOCK_thd_data);
slave_info= si; slave_info= si;
......
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