MXS-1446: Move failover parameters into mysqlmon

The `failover` and `failover_timeout` parameters are now declared as a
part of the mysqlmon module. Changed the implementation of the failover
function so that the dependencies on the monitor struct can be removed or
moved into parameters.
This commit is contained in:
Markus Mäkelä
2017-09-28 08:15:28 +03:00
parent ef115208e6
commit d4fd34cecd
7 changed files with 44 additions and 120 deletions

View File

@ -244,8 +244,6 @@ 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,
CN_BACKEND_WRITE_TIMEOUT,
@ -3189,41 +3187,6 @@ 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)
{
char *endptr;
long interval = strtol(failover_timeout, &endptr, 0);
if (*endptr == '\0' && interval > 0)
{
monitorSetFailoverTimeout(monitor, (uint32_t)interval);
}
else
{
error_count++;
MXS_NOTICE("Invalid '%s' parameter for monitor '%s'",
CN_FAILOVER_TIMEOUT, obj->object);
}
}
char *connect_timeout = config_get_value(obj->parameters, CN_BACKEND_CONNECT_TIMEOUT);
if (connect_timeout)
{