Detect double monitoring of servers
Adding a server to multiple monitors is forbidden. This should be detected and reported to the end user. The information provided by the config_runtime system to the client isn't as detailed as it could be. Some sort of an error message stack should be added so that client facing interfaces could properly report the reason for the failure. Currently the only way to detect the reason of the failure is to parse the log files.
This commit is contained in:
@ -29,23 +29,26 @@ bool runtime_link_server(SERVER *server, const char *target)
|
||||
SERVICE *service = service_find(target);
|
||||
MONITOR *monitor = service ? NULL : monitor_find(target);
|
||||
|
||||
if (service || monitor)
|
||||
if (service)
|
||||
{
|
||||
rval = true;
|
||||
|
||||
if (service)
|
||||
if (serviceAddBackend(service, server))
|
||||
{
|
||||
serviceAddBackend(service, server);
|
||||
service_serialize_servers(service);
|
||||
rval = true;
|
||||
}
|
||||
else if (monitor)
|
||||
}
|
||||
else if (monitor)
|
||||
{
|
||||
if (monitorAddServer(monitor, server))
|
||||
{
|
||||
monitorAddServer(monitor, server);
|
||||
monitor_serialize_servers(monitor);
|
||||
rval = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (rval)
|
||||
{
|
||||
const char *type = service ? "service" : "monitor";
|
||||
|
||||
MXS_NOTICE("Added server '%s' to %s '%s'", server->unique_name, type, target);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user