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.
This commit is contained in:
Johan Wikman 2019-01-24 13:05:43 +02:00
parent 7d92717b66
commit 6937bb6663

View File

@ -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);