summaryrefslogtreecommitdiff
path: root/sql/repl_failsafe.cc
diff options
context:
space:
mode:
authorMarkus Mäkelä <markus456@gmail.com>2019-07-04 12:59:18 +0300
committerRobert Bindar <robert@mariadb.org>2019-07-29 13:38:29 +0300
commit0d5d8d2e7a1debece188f355ecd7b0984ef8d171 (patch)
tree08643ba3c951b20c37bd6728efbce37c4eb5487a /sql/repl_failsafe.cc
parent1e9aa46dc34de23c78a4c897ad3977aa10fbcf95 (diff)
downloadmariadb-git-0d5d8d2e7a1debece188f355ecd7b0984ef8d171.tar.gz
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.
Diffstat (limited to 'sql/repl_failsafe.cc')
-rw-r--r--sql/repl_failsafe.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc
index 18fc3d9431a..7905e112e2e 100644
--- a/sql/repl_failsafe.cc
+++ b/sql/repl_failsafe.cc
@@ -147,6 +147,9 @@ int THD::register_slave(uchar *packet, size_t packet_length)
if (!(si->master_id= uint4korr(p)))
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();
mysql_mutex_lock(&LOCK_thd_data);
slave_info= si;