MXS-1446: Add execution of dummy failover command

The failover command is simulated by executing a call to /usr/bin/echo
with all possible monitor parameters. This allows testing of the failover
mechanism without actually using the failover command.
This commit is contained in:
Markus Mäkelä
2017-09-27 10:50:25 +03:00
parent 316f792242
commit 4c3d6f6884
6 changed files with 88 additions and 23 deletions

View File

@ -244,6 +244,7 @@ const char *config_monitor_params[] =
CN_MONITOR_INTERVAL,
CN_JOURNAL_MAX_AGE,
CN_SCRIPT_TIMEOUT,
CN_FAILOVER,
CN_FAILOVER_TIMEOUT,
CN_BACKEND_CONNECT_TIMEOUT,
CN_BACKEND_READ_TIMEOUT,
@ -3188,6 +3189,23 @@ int create_new_monitor(CONFIG_CONTEXT *context, CONFIG_CONTEXT *obj, HASHTABLE*
obj->object, CN_SCRIPT_TIMEOUT, DEFAULT_SCRIPT_TIMEOUT);
}
char *failover = config_get_value(obj->parameters, CN_FAILOVER);
if (failover)
{
int val = config_truth_value(failover);
if (val != -1)
{
monitorSetFailover(monitor, val);
}
else
{
error_count++;
MXS_NOTICE("Invalid '%s' parameter for monitor '%s'",
CN_FAILOVER, obj->object);
}
}
char *failover_timeout = config_get_value(obj->parameters, CN_FAILOVER_TIMEOUT);
if (failover_timeout)
{