MXS-2314 Monitor decides whether servers are added to services

When the servers of a service are defined by a monitor, then
at startup all servers of the monitor should be added to relevant
services. Likewise, when a server is added to or removed from a
monitor at runtime, those changes should affect services as well.

However, whether that should happen or not depends upon the monitor.
In the case of the Clustrix monitor this should not happen as it
adds and removes servers depending on the runtime state of the
Clustrix cluster.
This commit is contained in:
Johan Wikman
2019-02-08 12:29:59 +02:00
parent ab93216064
commit cac1d76e48
7 changed files with 165 additions and 48 deletions

View File

@ -165,7 +165,7 @@ bool runtime_link_server(Server* server, const char* target)
}
else if (monitor)
{
if (monitor_add_server(monitor, server))
if (MonitorManager::add_server(monitor, server))
{
monitor_serialize(monitor);
rval = true;
@ -213,7 +213,7 @@ bool runtime_unlink_server(Server* server, const char* target)
}
else if (monitor)
{
monitor_remove_server(monitor, server);
MonitorManager::remove_server(monitor, server);
monitor_serialize(monitor);
rval = true;
}
@ -1434,7 +1434,7 @@ bool runtime_destroy_monitor(Monitor* monitor)
while (!monitor->m_servers.empty())
{
monitor_remove_server(monitor, monitor->m_servers[0]->server);
MonitorManager::remove_server(monitor, monitor->m_servers[0]->server);
}
monitor_deactivate(monitor);
MXS_NOTICE("Destroyed monitor '%s'", monitor->m_name);