Improve error message for zero monitor timeout values
The error message was not 100% accurate about the value. In addition to that, neither the value itself nor the monitor or parameter names were printed in the error message.
This commit is contained in:
@ -3239,7 +3239,8 @@ int create_new_monitor(CONFIG_CONTEXT *context, CONFIG_CONTEXT *obj, HASHTABLE*
|
|||||||
char *connect_timeout = config_get_value(obj->parameters, CN_BACKEND_CONNECT_TIMEOUT);
|
char *connect_timeout = config_get_value(obj->parameters, CN_BACKEND_CONNECT_TIMEOUT);
|
||||||
if (connect_timeout)
|
if (connect_timeout)
|
||||||
{
|
{
|
||||||
if (!monitorSetNetworkTimeout(monitor, MONITOR_CONNECT_TIMEOUT, atoi(connect_timeout)))
|
if (!monitorSetNetworkTimeout(monitor, MONITOR_CONNECT_TIMEOUT,
|
||||||
|
atoi(connect_timeout), CN_BACKEND_CONNECT_TIMEOUT))
|
||||||
{
|
{
|
||||||
MXS_ERROR("Failed to set '%s'", CN_BACKEND_CONNECT_TIMEOUT);
|
MXS_ERROR("Failed to set '%s'", CN_BACKEND_CONNECT_TIMEOUT);
|
||||||
error_count++;
|
error_count++;
|
||||||
@ -3249,7 +3250,8 @@ int create_new_monitor(CONFIG_CONTEXT *context, CONFIG_CONTEXT *obj, HASHTABLE*
|
|||||||
char *read_timeout = config_get_value(obj->parameters, CN_BACKEND_READ_TIMEOUT);
|
char *read_timeout = config_get_value(obj->parameters, CN_BACKEND_READ_TIMEOUT);
|
||||||
if (read_timeout)
|
if (read_timeout)
|
||||||
{
|
{
|
||||||
if (!monitorSetNetworkTimeout(monitor, MONITOR_READ_TIMEOUT, atoi(read_timeout)))
|
if (!monitorSetNetworkTimeout(monitor, MONITOR_READ_TIMEOUT,
|
||||||
|
atoi(read_timeout), CN_BACKEND_READ_TIMEOUT))
|
||||||
{
|
{
|
||||||
MXS_ERROR("Failed to set '%s'", CN_BACKEND_READ_TIMEOUT);
|
MXS_ERROR("Failed to set '%s'", CN_BACKEND_READ_TIMEOUT);
|
||||||
error_count++;
|
error_count++;
|
||||||
@ -3259,7 +3261,8 @@ int create_new_monitor(CONFIG_CONTEXT *context, CONFIG_CONTEXT *obj, HASHTABLE*
|
|||||||
char *write_timeout = config_get_value(obj->parameters, CN_BACKEND_WRITE_TIMEOUT);
|
char *write_timeout = config_get_value(obj->parameters, CN_BACKEND_WRITE_TIMEOUT);
|
||||||
if (write_timeout)
|
if (write_timeout)
|
||||||
{
|
{
|
||||||
if (!monitorSetNetworkTimeout(monitor, MONITOR_WRITE_TIMEOUT, atoi(write_timeout)))
|
if (!monitorSetNetworkTimeout(monitor, MONITOR_WRITE_TIMEOUT,
|
||||||
|
atoi(write_timeout), CN_BACKEND_WRITE_TIMEOUT))
|
||||||
{
|
{
|
||||||
MXS_ERROR("Failed to set '%s'", CN_BACKEND_WRITE_TIMEOUT);
|
MXS_ERROR("Failed to set '%s'", CN_BACKEND_WRITE_TIMEOUT);
|
||||||
error_count++;
|
error_count++;
|
||||||
@ -3269,7 +3272,8 @@ int create_new_monitor(CONFIG_CONTEXT *context, CONFIG_CONTEXT *obj, HASHTABLE*
|
|||||||
char *connect_attempts = config_get_value(obj->parameters, CN_BACKEND_CONNECT_ATTEMPTS);
|
char *connect_attempts = config_get_value(obj->parameters, CN_BACKEND_CONNECT_ATTEMPTS);
|
||||||
if (connect_attempts)
|
if (connect_attempts)
|
||||||
{
|
{
|
||||||
if (!monitorSetNetworkTimeout(monitor, MONITOR_CONNECT_ATTEMPTS, atoi(connect_attempts)))
|
if (!monitorSetNetworkTimeout(monitor, MONITOR_CONNECT_ATTEMPTS,
|
||||||
|
atoi(connect_attempts), CN_BACKEND_CONNECT_ATTEMPTS))
|
||||||
{
|
{
|
||||||
MXS_ERROR("Failed to set '%s'", CN_BACKEND_CONNECT_ATTEMPTS);
|
MXS_ERROR("Failed to set '%s'", CN_BACKEND_CONNECT_ATTEMPTS);
|
||||||
error_count++;
|
error_count++;
|
||||||
|
@ -474,7 +474,7 @@ bool runtime_alter_monitor(MXS_MONITOR *monitor, const char *key, const char *va
|
|||||||
if (ival)
|
if (ival)
|
||||||
{
|
{
|
||||||
valid = true;
|
valid = true;
|
||||||
monitorSetNetworkTimeout(monitor, MONITOR_CONNECT_TIMEOUT, ival);
|
monitorSetNetworkTimeout(monitor, MONITOR_CONNECT_TIMEOUT, ival, CN_BACKEND_CONNECT_TIMEOUT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (strcmp(key, CN_BACKEND_WRITE_TIMEOUT) == 0)
|
else if (strcmp(key, CN_BACKEND_WRITE_TIMEOUT) == 0)
|
||||||
@ -483,7 +483,7 @@ bool runtime_alter_monitor(MXS_MONITOR *monitor, const char *key, const char *va
|
|||||||
if (ival)
|
if (ival)
|
||||||
{
|
{
|
||||||
valid = true;
|
valid = true;
|
||||||
monitorSetNetworkTimeout(monitor, MONITOR_WRITE_TIMEOUT, ival);
|
monitorSetNetworkTimeout(monitor, MONITOR_WRITE_TIMEOUT, ival, CN_BACKEND_WRITE_TIMEOUT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (strcmp(key, CN_BACKEND_READ_TIMEOUT) == 0)
|
else if (strcmp(key, CN_BACKEND_READ_TIMEOUT) == 0)
|
||||||
@ -492,7 +492,7 @@ bool runtime_alter_monitor(MXS_MONITOR *monitor, const char *key, const char *va
|
|||||||
if (ival)
|
if (ival)
|
||||||
{
|
{
|
||||||
valid = true;
|
valid = true;
|
||||||
monitorSetNetworkTimeout(monitor, MONITOR_READ_TIMEOUT, ival);
|
monitorSetNetworkTimeout(monitor, MONITOR_READ_TIMEOUT, ival, CN_BACKEND_READ_TIMEOUT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (strcmp(key, CN_BACKEND_CONNECT_ATTEMPTS) == 0)
|
else if (strcmp(key, CN_BACKEND_CONNECT_ATTEMPTS) == 0)
|
||||||
@ -501,7 +501,7 @@ bool runtime_alter_monitor(MXS_MONITOR *monitor, const char *key, const char *va
|
|||||||
if (ival)
|
if (ival)
|
||||||
{
|
{
|
||||||
valid = true;
|
valid = true;
|
||||||
monitorSetNetworkTimeout(monitor, MONITOR_CONNECT_ATTEMPTS, ival);
|
monitorSetNetworkTimeout(monitor, MONITOR_CONNECT_ATTEMPTS, ival, CN_BACKEND_CONNECT_ATTEMPTS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (strcmp(key, CN_JOURNAL_MAX_AGE) == 0)
|
else if (strcmp(key, CN_JOURNAL_MAX_AGE) == 0)
|
||||||
|
@ -72,7 +72,7 @@ void monitorAddParameters(MXS_MONITOR *monitor, MXS_CONFIG_PARAMETER *params);
|
|||||||
bool monitorRemoveParameter(MXS_MONITOR *monitor, const char *key);
|
bool monitorRemoveParameter(MXS_MONITOR *monitor, const char *key);
|
||||||
|
|
||||||
void monitorSetInterval (MXS_MONITOR *, unsigned long);
|
void monitorSetInterval (MXS_MONITOR *, unsigned long);
|
||||||
bool monitorSetNetworkTimeout(MXS_MONITOR *, int, int);
|
bool monitorSetNetworkTimeout(MXS_MONITOR *, int, int, const char*);
|
||||||
void monitorSetJournalMaxAge(MXS_MONITOR *mon, time_t value);
|
void monitorSetJournalMaxAge(MXS_MONITOR *mon, time_t value);
|
||||||
void monitorSetScriptTimeout(MXS_MONITOR *mon, uint32_t value);
|
void monitorSetScriptTimeout(MXS_MONITOR *mon, uint32_t value);
|
||||||
|
|
||||||
|
@ -668,8 +668,7 @@ void monitorSetScriptTimeout(MXS_MONITOR *mon, uint32_t value)
|
|||||||
* @param type The timeout handling type
|
* @param type The timeout handling type
|
||||||
* @param value The timeout to set
|
* @param value The timeout to set
|
||||||
*/
|
*/
|
||||||
bool
|
bool monitorSetNetworkTimeout(MXS_MONITOR *mon, int type, int value, const char* key)
|
||||||
monitorSetNetworkTimeout(MXS_MONITOR *mon, int type, int value)
|
|
||||||
{
|
{
|
||||||
bool rval = true;
|
bool rval = true;
|
||||||
|
|
||||||
@ -695,13 +694,14 @@ monitorSetNetworkTimeout(MXS_MONITOR *mon, int type, int value)
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
MXS_ERROR("Monitor setNetworkTimeout received an unsupported action type %i", type);
|
MXS_ERROR("Monitor setNetworkTimeout received an unsupported action type %i", type);
|
||||||
|
ss_dassert(!true);
|
||||||
rval = false;
|
rval = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MXS_ERROR("Negative value for monitor timeout.");
|
MXS_ERROR("Value '%s' for monitor '%s' is not a positive integer: %d", key, mon->name, value);
|
||||||
rval = false;
|
rval = false;
|
||||||
}
|
}
|
||||||
return rval;
|
return rval;
|
||||||
|
Reference in New Issue
Block a user