Persist changes to the list of monitored servers

When a server is added to a monitor, an supplementary configuration file
is generated to persist this information. This will allow dynamic
modifications to server lists which will survive restarts and unexpected
downtime.

The monitor will only add new servers to its list of monitored
servers. This prevents duplicate entries in the list and makes it safe to
persist all used servers to the supplementary configuration file instead of only the ones that are not listed in the main configuration.
This commit is contained in:
Markus Makela
2016-11-12 21:55:42 +02:00
parent a651eff633
commit a17aa28eed
4 changed files with 214 additions and 32 deletions

View File

@ -753,6 +753,7 @@ static void cmd_AddServer(DCB *dcb, void *a, void *b)
else if (monitor)
{
monitorAddServer(monitor, server);
monitor_serialize_servers(monitor);
}
const char *target = service ? "service" : "monitor";
@ -809,6 +810,7 @@ static void cmd_RemoveServer(DCB *dcb, void *a, void *b)
else if (monitor)
{
monitorRemoveServer(monitor, server);
monitor_serialize_servers(monitor);
}
const char *target = service ? "service" : "monitor";