Improve --config-check
mode
The configuration checking now detects bad router options. This allows for better coverage of the configuration with only the --config-check flag.
This commit is contained in:
parent
a64825c866
commit
6d7e419ed4
@ -110,6 +110,7 @@ typedef struct config_context
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
bool config_check; /**< Only check config */
|
||||
int n_threads; /**< Number of polling threads */
|
||||
char *version_string; /**< The version string of embedded db library */
|
||||
char release_string[_RELEASE_STR_LENGTH]; /**< The release name string of the system */
|
||||
|
@ -1561,6 +1561,7 @@ global_defaults()
|
||||
{
|
||||
uint8_t mac_addr[6] = "";
|
||||
struct utsname uname_data;
|
||||
gateway.config_check = false;
|
||||
gateway.n_threads = DEFAULT_NTHREADS;
|
||||
gateway.n_nbpoll = DEFAULT_NBPOLLS;
|
||||
gateway.pollsleep = DEFAULT_POLLSLEEP;
|
||||
|
@ -1865,12 +1865,7 @@ int main(int argc, char **argv)
|
||||
goto return_main;
|
||||
}
|
||||
|
||||
if (config_check)
|
||||
{
|
||||
MXS_NOTICE("Configuration was successfully verified.");
|
||||
rc = MAXSCALE_SHUTDOWN;
|
||||
goto return_main;
|
||||
}
|
||||
cnf->config_check = config_check;
|
||||
|
||||
if (mysql_library_init(0, NULL, NULL))
|
||||
{
|
||||
@ -1918,21 +1913,24 @@ int main(int argc, char **argv)
|
||||
}
|
||||
libmysql_initialized = TRUE;
|
||||
|
||||
/** Check if a MaxScale process is already running */
|
||||
if (pid_file_exists())
|
||||
if (!config_check)
|
||||
{
|
||||
/** There is a process with the PID of the maxscale.pid file running.
|
||||
* Assuming that this is an already running MaxScale process, we
|
||||
* should exit with an error code. */
|
||||
rc = MAXSCALE_ALREADYRUNNING;
|
||||
goto return_main;
|
||||
}
|
||||
/** Check if a MaxScale process is already running */
|
||||
if (pid_file_exists())
|
||||
{
|
||||
/** There is a process with the PID of the maxscale.pid file running.
|
||||
* Assuming that this is an already running MaxScale process, we
|
||||
* should exit with an error code. */
|
||||
rc = MAXSCALE_ALREADYRUNNING;
|
||||
goto return_main;
|
||||
}
|
||||
|
||||
/* Write process pid into MaxScale pidfile */
|
||||
if (write_pid_file() != 0)
|
||||
{
|
||||
rc = MAXSCALE_ALREADYRUNNING;
|
||||
goto return_main;
|
||||
/* Write process pid into MaxScale pidfile */
|
||||
if (write_pid_file() != 0)
|
||||
{
|
||||
rc = MAXSCALE_ALREADYRUNNING;
|
||||
goto return_main;
|
||||
}
|
||||
}
|
||||
|
||||
/** Initialize statistics */
|
||||
@ -1961,6 +1959,14 @@ int main(int argc, char **argv)
|
||||
rc = MAXSCALE_NOSERVICES;
|
||||
goto return_main;
|
||||
}
|
||||
|
||||
if (config_check)
|
||||
{
|
||||
MXS_NOTICE("Configuration was successfully verified.");
|
||||
rc = MAXSCALE_SHUTDOWN;
|
||||
goto return_main;
|
||||
}
|
||||
|
||||
/*<
|
||||
* Start periodic log flusher thread.
|
||||
*/
|
||||
|
@ -478,7 +478,15 @@ int serviceInitialize(SERVICE *service)
|
||||
|
||||
if ((service->router_instance = service->router->createInstance(service, router_options)))
|
||||
{
|
||||
listeners = serviceStartAllPorts(service);
|
||||
if (!config_get_global_options()->config_check)
|
||||
{
|
||||
listeners = serviceStartAllPorts(service);
|
||||
}
|
||||
else
|
||||
{
|
||||
/** We're only checking that the configuration is valid */
|
||||
listeners++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user