Remove servers from destroyed monitors

A destroyed monitor should not have any servers added to it. This allows
the servers that once were monitored by a destroyed monitor to be added to
new monitors.
This commit is contained in:
Markus Makela
2016-12-11 09:18:43 +02:00
parent cb218804ef
commit d543ecb483

View File

@ -586,6 +586,11 @@ bool runtime_destroy_monitor(MONITOR *monitor)
if (rval) if (rval)
{ {
monitorStop(monitor); monitorStop(monitor);
while (monitor->databases)
{
monitorRemoveServer(monitor, monitor->databases->server);
}
MXS_NOTICE("Destroyed monitor '%s'. The monitor will be removed " MXS_NOTICE("Destroyed monitor '%s'. The monitor will be removed "
"after the next restart of MaxScale.", monitor->name); "after the next restart of MaxScale.", monitor->name);
} }