MXS-1755 Warn about unknown global configuration entries.
MXS_WARNING for unknown entries. Later to become an error (in 2.4).
This commit is contained in:
committed by
Niclas Antti
parent
39ca403ffa
commit
62a3dd664d
@ -74,8 +74,7 @@ MXS_BEGIN_DECLS
|
|||||||
* Common configuration parameters names
|
* Common configuration parameters names
|
||||||
*
|
*
|
||||||
* All of the constants resolve to a lowercase version without the CN_ prefix.
|
* All of the constants resolve to a lowercase version without the CN_ prefix.
|
||||||
* For example CN_PASSWORD resolves to the static string "password". This means
|
* For example CN_PASSWORD resolves to the static string "password".
|
||||||
* that the sizeof(CN_<name>) returns the actual size of that string.
|
|
||||||
*/
|
*/
|
||||||
extern const char CN_ACCOUNT[];
|
extern const char CN_ACCOUNT[];
|
||||||
extern const char CN_ADDRESS[];
|
extern const char CN_ADDRESS[];
|
||||||
@ -177,6 +176,25 @@ extern const char CN_WEIGHTBY[];
|
|||||||
extern const char CN_WRITEQ_HIGH_WATER[];
|
extern const char CN_WRITEQ_HIGH_WATER[];
|
||||||
extern const char CN_WRITEQ_LOW_WATER[];
|
extern const char CN_WRITEQ_LOW_WATER[];
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Global configuration items that are read (or pre_parsed) to be available for
|
||||||
|
* subsequent configuration reading. @see config_pre_parse_global_params.
|
||||||
|
*/
|
||||||
|
extern const char CN_LOGDIR[];
|
||||||
|
extern const char CN_LIBDIR[];
|
||||||
|
extern const char CN_PIDDIR[];
|
||||||
|
extern const char CN_DATADIR[];
|
||||||
|
extern const char CN_CACHEDIR[];
|
||||||
|
extern const char CN_LANGUAGE[];
|
||||||
|
extern const char CN_EXECDIR[];
|
||||||
|
extern const char CN_CONNECTOR_PLUGINDIR[];
|
||||||
|
extern const char CN_PERSISTDIR[];
|
||||||
|
extern const char CN_MODULE_CONFIGDIR[];
|
||||||
|
extern const char CN_SYSLOG[];
|
||||||
|
extern const char CN_MAXLOG[];
|
||||||
|
extern const char CN_LOG_AUGMENTATION[];
|
||||||
|
extern const char CN_LOG_TO_SHM[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The config parameter
|
* The config parameter
|
||||||
*/
|
*/
|
||||||
@ -515,14 +533,14 @@ json_t* config_maxscale_to_json(const char* host);
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get DCB write queue high water mark
|
* @brief Get DCB write queue high water mark
|
||||||
*
|
*
|
||||||
* @return Number of high water mark in bytes
|
* @return Number of high water mark in bytes
|
||||||
*/
|
*/
|
||||||
uint32_t config_writeq_high_water();
|
uint32_t config_writeq_high_water();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get DCB write queue low water mark
|
* @brief Get DCB write queue low water mark
|
||||||
*
|
*
|
||||||
* @return @return Number of low water mark in bytes
|
* @return @return Number of low water mark in bytes
|
||||||
*/
|
*/
|
||||||
uint32_t config_writeq_low_water();
|
uint32_t config_writeq_low_water();
|
||||||
|
|||||||
@ -160,6 +160,22 @@ const char CN_SESSION_TRACK_TRX_STATE[] = "session_track_trx_state";
|
|||||||
const char CN_WRITEQ_HIGH_WATER[] = "writeq_high_water";
|
const char CN_WRITEQ_HIGH_WATER[] = "writeq_high_water";
|
||||||
const char CN_WRITEQ_LOW_WATER[] = "writeq_low_water";
|
const char CN_WRITEQ_LOW_WATER[] = "writeq_low_water";
|
||||||
|
|
||||||
|
|
||||||
|
extern const char CN_LOGDIR[] = "logdir";
|
||||||
|
extern const char CN_LIBDIR[] = "libdir";
|
||||||
|
extern const char CN_PIDDIR[] = "piddir";
|
||||||
|
extern const char CN_DATADIR[] = "datadir";
|
||||||
|
extern const char CN_CACHEDIR[] = "cachedir";
|
||||||
|
extern const char CN_LANGUAGE[] = "language";
|
||||||
|
extern const char CN_EXECDIR[] = "execdir";
|
||||||
|
extern const char CN_CONNECTOR_PLUGINDIR[] = "connector_plugindir";
|
||||||
|
extern const char CN_PERSISTDIR[] = "persistdir";
|
||||||
|
extern const char CN_MODULE_CONFIGDIR[] = "module_configdir";
|
||||||
|
extern const char CN_SYSLOG[] = "syslog";
|
||||||
|
extern const char CN_MAXLOG[] = "maxlog";
|
||||||
|
extern const char CN_LOG_AUGMENTATION[] = "log_augmentation";
|
||||||
|
extern const char CN_LOG_TO_SHM[] = "log_to_shm";
|
||||||
|
|
||||||
typedef struct duplicate_context
|
typedef struct duplicate_context
|
||||||
{
|
{
|
||||||
HASHTABLE *hash;
|
HASHTABLE *hash;
|
||||||
@ -299,6 +315,29 @@ const char *server_params[] =
|
|||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This is currently only used in handle_global_item() to verify that
|
||||||
|
* all global configuration item names are valid.
|
||||||
|
*/
|
||||||
|
const char *config_pre_parse_global_params[] =
|
||||||
|
{
|
||||||
|
CN_LOGDIR,
|
||||||
|
CN_LIBDIR,
|
||||||
|
CN_PIDDIR,
|
||||||
|
CN_DATADIR,
|
||||||
|
CN_CACHEDIR,
|
||||||
|
CN_LANGUAGE,
|
||||||
|
CN_EXECDIR,
|
||||||
|
CN_CONNECTOR_PLUGINDIR,
|
||||||
|
CN_PERSISTDIR,
|
||||||
|
CN_MODULE_CONFIGDIR,
|
||||||
|
CN_SYSLOG,
|
||||||
|
CN_MAXLOG,
|
||||||
|
CN_LOG_AUGMENTATION,
|
||||||
|
CN_LOG_TO_SHM,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the context object used for tracking duplicate sections.
|
* Initialize the context object used for tracking duplicate sections.
|
||||||
*
|
*
|
||||||
@ -1548,6 +1587,8 @@ static struct
|
|||||||
static int
|
static int
|
||||||
handle_global_item(const char *name, const char *value)
|
handle_global_item(const char *name, const char *value)
|
||||||
{
|
{
|
||||||
|
bool processed = true; // assume 'name' is valid
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
if (strcmp(name, CN_THREADS) == 0)
|
if (strcmp(name, CN_THREADS) == 0)
|
||||||
{
|
{
|
||||||
@ -1921,10 +1962,12 @@ handle_global_item(const char *name, const char *value)
|
|||||||
MXS_WARNING("The 'log_debug' option has no effect in release mode.");
|
MXS_WARNING("The 'log_debug' option has no effect in release mode.");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
bool found = false;
|
||||||
for (i = 0; lognames[i].name; i++)
|
for (i = 0; lognames[i].name; i++)
|
||||||
{
|
{
|
||||||
if (strcasecmp(name, lognames[i].name) == 0)
|
if (strcasecmp(name, lognames[i].name) == 0)
|
||||||
{
|
{
|
||||||
|
found = true;
|
||||||
if (lognames[i].replacement)
|
if (lognames[i].replacement)
|
||||||
{
|
{
|
||||||
MXS_WARNING("In the configuration file the use of '%s' is deprecated, "
|
MXS_WARNING("In the configuration file the use of '%s' is deprecated, "
|
||||||
@ -1935,7 +1978,24 @@ handle_global_item(const char *name, const char *value)
|
|||||||
mxs_log_set_priority_enabled(lognames[i].priority, config_truth_value(value));
|
mxs_log_set_priority_enabled(lognames[i].priority, config_truth_value(value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!found)
|
||||||
|
{
|
||||||
|
for (int i = 0; !found && config_pre_parse_global_params[i]; ++i)
|
||||||
|
{
|
||||||
|
found = strcmp(name, config_pre_parse_global_params[i]) == 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
processed = found;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!processed)
|
||||||
|
{
|
||||||
|
MXS_WARNING("Config entry '%s' is unknown."
|
||||||
|
" Please remove it from the configuration file.", name);
|
||||||
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2717,7 +2717,7 @@ static int cnf_preparser(void* data, const char* section, const char* name, cons
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(name, "logdir") == 0)
|
if (strcmp(name, CN_LOGDIR) == 0)
|
||||||
{
|
{
|
||||||
if (strcmp(get_logdir(), default_logdir) == 0)
|
if (strcmp(get_logdir(), default_logdir) == 0)
|
||||||
{
|
{
|
||||||
@ -2731,7 +2731,7 @@ static int cnf_preparser(void* data, const char* section, const char* name, cons
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (strcmp(name, "libdir") == 0)
|
else if (strcmp(name, CN_LIBDIR) == 0)
|
||||||
{
|
{
|
||||||
if (strcmp(get_libdir(), default_libdir) == 0)
|
if (strcmp(get_libdir(), default_libdir) == 0)
|
||||||
{
|
{
|
||||||
@ -2745,7 +2745,7 @@ static int cnf_preparser(void* data, const char* section, const char* name, cons
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (strcmp(name, "piddir") == 0)
|
else if (strcmp(name, CN_PIDDIR) == 0)
|
||||||
{
|
{
|
||||||
if (strcmp(get_piddir(), default_piddir) == 0)
|
if (strcmp(get_piddir(), default_piddir) == 0)
|
||||||
{
|
{
|
||||||
@ -2759,7 +2759,7 @@ static int cnf_preparser(void* data, const char* section, const char* name, cons
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (strcmp(name, "datadir") == 0)
|
else if (strcmp(name, CN_DATADIR) == 0)
|
||||||
{
|
{
|
||||||
if (!datadir_defined)
|
if (!datadir_defined)
|
||||||
{
|
{
|
||||||
@ -2776,7 +2776,7 @@ static int cnf_preparser(void* data, const char* section, const char* name, cons
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (strcmp(name, "cachedir") == 0)
|
else if (strcmp(name, CN_CACHEDIR) == 0)
|
||||||
{
|
{
|
||||||
if (strcmp(get_cachedir(), default_cachedir) == 0)
|
if (strcmp(get_cachedir(), default_cachedir) == 0)
|
||||||
{
|
{
|
||||||
@ -2790,7 +2790,7 @@ static int cnf_preparser(void* data, const char* section, const char* name, cons
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (strcmp(name, "language") == 0)
|
else if (strcmp(name, CN_LANGUAGE) == 0)
|
||||||
{
|
{
|
||||||
if (strcmp(get_langdir(), default_langdir) == 0)
|
if (strcmp(get_langdir(), default_langdir) == 0)
|
||||||
{
|
{
|
||||||
@ -2804,7 +2804,7 @@ static int cnf_preparser(void* data, const char* section, const char* name, cons
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (strcmp(name, "execdir") == 0)
|
else if (strcmp(name, CN_EXECDIR) == 0)
|
||||||
{
|
{
|
||||||
if (strcmp(get_execdir(), default_execdir) == 0)
|
if (strcmp(get_execdir(), default_execdir) == 0)
|
||||||
{
|
{
|
||||||
@ -2818,7 +2818,7 @@ static int cnf_preparser(void* data, const char* section, const char* name, cons
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (strcmp(name, "connector_plugindir") == 0)
|
else if (strcmp(name, CN_CONNECTOR_PLUGINDIR) == 0)
|
||||||
{
|
{
|
||||||
if (strcmp(get_connector_plugindir(), default_connector_plugindir) == 0)
|
if (strcmp(get_connector_plugindir(), default_connector_plugindir) == 0)
|
||||||
{
|
{
|
||||||
@ -2832,7 +2832,7 @@ static int cnf_preparser(void* data, const char* section, const char* name, cons
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (strcmp(name, "persistdir") == 0)
|
else if (strcmp(name, CN_PERSISTDIR) == 0)
|
||||||
{
|
{
|
||||||
if (strcmp(get_config_persistdir(), default_config_persistdir) == 0)
|
if (strcmp(get_config_persistdir(), default_config_persistdir) == 0)
|
||||||
{
|
{
|
||||||
@ -2846,7 +2846,7 @@ static int cnf_preparser(void* data, const char* section, const char* name, cons
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (strcmp(name, "module_configdir") == 0)
|
else if (strcmp(name, CN_MODULE_CONFIGDIR) == 0)
|
||||||
{
|
{
|
||||||
if (strcmp(get_module_configdir(), default_module_configdir) == 0)
|
if (strcmp(get_module_configdir(), default_module_configdir) == 0)
|
||||||
{
|
{
|
||||||
@ -2860,25 +2860,25 @@ static int cnf_preparser(void* data, const char* section, const char* name, cons
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (strcmp(name, "syslog") == 0)
|
else if (strcmp(name, CN_SYSLOG) == 0)
|
||||||
{
|
{
|
||||||
if (!syslog_configured)
|
if (!syslog_configured)
|
||||||
{
|
{
|
||||||
cnf->syslog = config_truth_value((char*)value);
|
cnf->syslog = config_truth_value((char*)value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (strcmp(name, "maxlog") == 0)
|
else if (strcmp(name, CN_MAXLOG) == 0)
|
||||||
{
|
{
|
||||||
if (!maxlog_configured)
|
if (!maxlog_configured)
|
||||||
{
|
{
|
||||||
cnf->maxlog = config_truth_value((char*)value);
|
cnf->maxlog = config_truth_value((char*)value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (strcmp(name, "log_augmentation") == 0)
|
else if (strcmp(name, CN_LOG_AUGMENTATION) == 0)
|
||||||
{
|
{
|
||||||
set_log_augmentation(value);
|
set_log_augmentation(value);
|
||||||
}
|
}
|
||||||
else if (strcmp(name, "log_to_shm") == 0)
|
else if (strcmp(name, CN_LOG_TO_SHM) == 0)
|
||||||
{
|
{
|
||||||
if (!log_to_shm_configured)
|
if (!log_to_shm_configured)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -45,6 +45,7 @@ extern const char *config_listener_params[];
|
|||||||
extern const char *config_monitor_params[];
|
extern const char *config_monitor_params[];
|
||||||
extern const char *config_filter_params[];
|
extern const char *config_filter_params[];
|
||||||
extern const char *config_server_params[];
|
extern const char *config_server_params[];
|
||||||
|
extern const char *config_pre_parse_global_params[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the defaults for the global configuration options
|
* Set the defaults for the global configuration options
|
||||||
|
|||||||
Reference in New Issue
Block a user