MXS-2234: Extend persisted config file log message

The log message should now contain enough information to more easily debug
any configuration issues that result from updating the main config file
after runtime changes have been done.

Also fixed the theoretical race condition in detection of persisted
configuration files by only checking for their existence once.
This commit is contained in:
Markus Mäkelä 2018-12-31 17:06:38 +02:00
parent 8f0e4a3034
commit 87c3b1d25b
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19

View File

@ -917,6 +917,7 @@ config_load_and_process(const char* filename, bool (*process_config)(CONFIG_CONT
{
bool rval = false;
DUPLICATE_CONTEXT dcontext;
bool have_persisted_configs = false;
if (duplicate_context_init(&dcontext))
{
@ -950,8 +951,12 @@ config_load_and_process(const char* filename, bool (*process_config)(CONFIG_CONT
* TODO: Figure out a cleaner way to do this
*/
is_persisted_config = true;
have_persisted_configs = true;
MXS_NOTICE("Loading generated configuration files from '%s'", persist_cnf);
MXS_NOTICE("Runtime configuration changes have been done to MaxScale. Loading persisted "
"configuration files and applying them on top of the main configuration file. "
"These changes can override the values of the main configuration file: "
"To revert them, remove all the files in '%s'.", persist_cnf);
DUPLICATE_CONTEXT p_dcontext;
/**
* We need to initialize a second duplicate context for the
@ -977,12 +982,12 @@ config_load_and_process(const char* filename, bool (*process_config)(CONFIG_CONT
if (!check_config_objects(config_context.next) || !process_config(config_context.next))
{
rval = false;
if (contains_cnf_files(persist_cnf))
if (have_persisted_configs)
{
MXS_WARNING("One or more generated configurations were found at '%s'. "
"If the error relates to any of the files located there, "
"remove the offending configurations from this directory.",
persist_cnf);
MXS_WARNING("Persisted configuration files generated by runtime configuration "
"changes were found at '%s' and at least one configuration error was "
"encountered. If the errors relate to any of the persisted configuration "
"files, remove the offending files and restart MaxScale.", persist_cnf);
}
}
}