From 6937bb6663ebbd6d9ebf63960978c10e59fcf5be Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Thu, 24 Jan 2019 13:05:43 +0200 Subject: [PATCH] MXS-2274 Create globally unique name for dynamic servers Convention needs to be that the runtime object creating other objects needs to incorporate its own name in the name of any object created. Together with the '@@' prefix that ensures that the created name will be reasonably globally unique. --- server/modules/monitor/clustrixmon/clustrixmonitor.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/modules/monitor/clustrixmon/clustrixmonitor.cc b/server/modules/monitor/clustrixmon/clustrixmonitor.cc index 1f9cf30cd..005ab6efd 100644 --- a/server/modules/monitor/clustrixmon/clustrixmonitor.cc +++ b/server/modules/monitor/clustrixmon/clustrixmonitor.cc @@ -253,7 +253,9 @@ void ClustrixMonitor::update_cluster_nodes(MXS_MONITORED_SERVER& ms) int mysql_port = row[2] ? atoi(row[2]) : DEFAULT_MYSQL_PORT; int health_port = row[3] ? atoi(row[3]) : DEFAULT_HEALTH_PORT; - string name = "@Clustrix-Server-" + std::to_string(id); + // '@@' ensures no clash with user created servers. + // Monitor name ensures no clash with other Clustrix monitor instances. + string name = string("@@") + this->name + ":server-" + std::to_string(id); auto nit = m_nodes.find(id); auto mit = memberships.find(id);