MXS-2417: Add option to ignore persisted configs
The load_persisted_configs parameter now controls whether persisted runtime changes are loaded on startup. The changes are still generated as it persists the current state of MaxScale making problem analysis easier.
This commit is contained in:
@ -145,6 +145,7 @@ const char CN_QUERY_RETRIES[] = "query_retries";
|
||||
const char CN_QUERY_RETRY_TIMEOUT[] = "query_retry_timeout";
|
||||
const char CN_RELATIONSHIPS[] = "relationships";
|
||||
const char CN_LINKS[] = "links";
|
||||
const char CN_LOAD_PERSISTED_CONFIGS[] = "load_persisted_configs";
|
||||
const char CN_LOCAL_ADDRESS[] = "local_address";
|
||||
const char CN_REQUIRED[] = "required";
|
||||
const char CN_RETAIN_LAST_STATEMENTS[] = "retain_last_statements";
|
||||
@ -1158,7 +1159,8 @@ static bool config_load_and_process(const char* filename, bool (* process_config
|
||||
const char* persist_cnf = get_config_persistdir();
|
||||
mxs_mkdir_all(persist_cnf, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
|
||||
|
||||
if (is_directory(persist_cnf) && contains_cnf_files(persist_cnf))
|
||||
if (config_get_global_options()->load_persisted_configs
|
||||
&& is_directory(persist_cnf) && contains_cnf_files(persist_cnf))
|
||||
{
|
||||
/**
|
||||
* Set the global flag that we are processing a persisted configuration.
|
||||
@ -2607,6 +2609,20 @@ static int handle_global_item(const char* name, const char* value)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else if (strcmp(name, CN_LOAD_PERSISTED_CONFIGS) == 0)
|
||||
{
|
||||
int b = config_truth_value(value);
|
||||
|
||||
if (b != -1)
|
||||
{
|
||||
gateway.load_persisted_configs = b;
|
||||
}
|
||||
else
|
||||
{
|
||||
MXS_ERROR("Invalid value for '%s': %s", CN_LOAD_PERSISTED_CONFIGS, value);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bool found = false;
|
||||
@ -2825,6 +2841,7 @@ void config_set_global_defaults()
|
||||
gateway.query_retry_timeout = DEFAULT_QUERY_RETRY_TIMEOUT;
|
||||
gateway.passive = false;
|
||||
gateway.promoted_at = 0;
|
||||
gateway.load_persisted_configs = true;
|
||||
|
||||
gateway.peer_hosts[0] = '\0';
|
||||
gateway.peer_user[0] = '\0';
|
||||
|
||||
Reference in New Issue
Block a user