MXS-2000 Add query_classifier_cache_size to maxscale resource

This commit is contained in:
Johan Wikman
2018-08-08 14:27:58 +03:00
parent cf4521503f
commit 2539183be2
4 changed files with 36 additions and 11 deletions

View File

@ -2123,17 +2123,17 @@ handle_global_item(const char *name, const char *value)
}
else if (strcmp(name, CN_QUERY_CLASSIFIER_CACHE_SIZE) == 0)
{
static QC_CACHE_PROPERTIES cache_properties = { INT64_MAX };
decltype(gateway.qc_cache_properties.max_size) max_size = get_suffixed_size(value);
cache_properties.max_size = get_suffixed_size(value);
if (cache_properties.max_size < 0)
if (max_size >= 0)
{
// Someone got carried away; we'll just silently adjust the value.
cache_properties.max_size = INT64_MAX;
gateway.qc_cache_properties.max_size = max_size;
}
else
{
MXS_ERROR("Invalid value for %s: %s", CN_QUERY_CLASSIFIER_CACHE_SIZE, value);
return 0;
}
gateway.qc_cache_properties = &cache_properties;
}
else if (strcmp(name, "sql_mode") == 0)
{
@ -4200,6 +4200,9 @@ json_t* config_maxscale_to_json(const char* host)
json_object_set_new(param, CN_QUERY_CLASSIFIER_ARGS, json_string(cnf->qc_args));
}
json_object_set_new(param, CN_QUERY_CLASSIFIER_CACHE_SIZE,
json_integer(cnf->qc_cache_properties.max_size));
json_t* attr = json_object();
time_t started = maxscale_started();
time_t activated = started + MXS_CLOCK_TO_SEC(cnf->promoted_at);