MXS-1831: Return error on invalid monitor parameter

If a parameter that is not declared by the monitor is altered, an error is
returned instead of it being silently added to the monitor parameters.
This commit is contained in:
Markus Mäkelä
2018-04-26 17:57:08 +03:00
parent 6f80e11f1d
commit bbe59732d8

View File

@ -448,6 +448,7 @@ bool runtime_alter_monitor(MXS_MONITOR *monitor, const char *key, const char *va
{
spinlock_acquire(&crt_lock);
bool valid = false;
const MXS_MODULE *mod = get_module(monitor->module_name, MODULE_MONITOR);
if (strcmp(key, CN_USER) == 0)
{
@ -522,7 +523,7 @@ bool runtime_alter_monitor(MXS_MONITOR *monitor, const char *key, const char *va
monitorSetScriptTimeout(monitor, ival);
}
}
else
else if (config_param_is_valid(mod->parameters, key, value, NULL))
{
/** We're modifying module specific parameters and we need to stop the monitor */
monitorStop(monitor);