MXS-2592 Enable runtime configuration of session_trace

This commit is contained in:
Marko
2019-08-06 16:49:11 +03:00
parent eda830c9f3
commit 5899556d89
3 changed files with 19 additions and 0 deletions

View File

@ -4579,6 +4579,7 @@ json_t* config_maxscale_to_json(const char* host)
json_object_set_new(param, CN_RETAIN_LAST_STATEMENTS, json_integer(session_get_retain_last_statements()));
json_object_set_new(param, CN_DUMP_LAST_STATEMENTS, json_string(session_get_dump_statements_str()));
json_object_set_new(param, CN_SESSION_TRACE, json_integer(session_get_session_trace()));
json_object_set_new(param, CN_LOAD_PERSISTED_CONFIGS, json_boolean(cnf->load_persisted_configs));
json_t* attr = json_object();

View File

@ -1008,6 +1008,23 @@ bool runtime_alter_maxscale(const char* name, const char* value)
CN_DUMP_LAST_STATEMENTS);
}
}
else if (key == CN_SESSION_TRACE)
{
char* endptr;
long intval = strtol(value, &endptr, 10);
if (*endptr == '\0' && intval >= 0)
{
session_set_session_trace(intval);
mxb_log_set_session_trace(true);
rval = true;
}
else
{
rval = false;
config_runtime_error("Invalid value for '%s': %s", CN_SESSION_TRACE, value);
}
}
else if (config_can_modify_at_runtime(key.c_str()))
{
config_runtime_error("Global parameter '%s' cannot be modified at runtime", name);