Read config as late as possible

By reading the configuration as late as possible, we allow the objects to
be created in an environment which is nearly identical to the environment
that is present at runtime.

This change makes it possible to execute worker tasks in the instance
creation functions of various modules. The avrorouter in particular
depended on being able to queue worker tasks on startup.
This commit is contained in:
Markus Mäkelä 2018-07-22 10:39:45 +03:00
parent a553ddba6e
commit 823efffb00
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19

View File

@ -1978,19 +1978,6 @@ int main(int argc, char **argv)
goto return_main;
}
if (!config_load(cnf_file_path))
{
const char* fprerr =
"Failed to open, read or process the MaxScale configuration "
"file. Exiting. See the error log for details.";
print_log_n_stderr(false, true, fprerr, fprerr, 0);
MXS_ERROR("Failed to open, read or process the MaxScale configuration file %s. "
"Exiting.",
cnf_file_path);
rc = MAXSCALE_BADCONFIG;
goto return_main;
}
if (!qc_setup(cnf->qc_cache_properties, cnf->qc_sql_mode, cnf->qc_name, cnf->qc_args))
{
const char* logerr = "Failed to initialise query classifier library.";
@ -2071,6 +2058,19 @@ int main(int argc, char **argv)
goto return_main;
}
if (!config_load(cnf_file_path))
{
const char* fprerr =
"Failed to open, read or process the MaxScale configuration "
"file. Exiting. See the error log for details.";
print_log_n_stderr(false, true, fprerr, fprerr, 0);
MXS_ERROR("Failed to open, read or process the MaxScale configuration file %s. "
"Exiting.",
cnf_file_path);
rc = MAXSCALE_BADCONFIG;
goto return_main;
}
/* Init MaxScale modules */
if (!modules_process_init())
{