Remove configuration reloading

Removed the deprecated configuration reloading code. Added a entry into
the release notes that states this and the fact that it was deprecated in
2.2.
This commit is contained in:
Markus Mäkelä
2018-07-09 21:58:40 +03:00
parent 904b7d9d39
commit b320217212
8 changed files with 7 additions and 250 deletions

View File

@ -1004,33 +1004,6 @@ config_load(const char *filename)
return rval;
}
/**
* Reload the configuration file for the MaxScale
*
* @return True on success, false on fatal error.
*/
bool config_reload()
{
bool rval = false;
if (config_file)
{
if (gateway.version_string)
{
MXS_FREE(gateway.version_string);
}
rval = config_load_and_process(config_file, process_config_update);
}
else
{
MXS_ERROR("config_reload() called without the configuration having "
"been loaded first.");
}
return rval;
}
/**
* @brief Process a configuration context and turn it into the set of objects
*
@ -2268,154 +2241,6 @@ void config_set_global_defaults()
gateway.qc_sql_mode = QC_SQL_MODE_DEFAULT;
}
/**
* Process a configuration context update and turn it into the set of object
* we need.
*
* @param context The configuration data
*/
static bool
process_config_update(CONFIG_CONTEXT *context)
{
CONFIG_CONTEXT *obj;
SERVICE *service;
SERVER *server;
/**
* Process the data and create the services and servers defined
* in the data.
*/
obj = context;
while (obj)
{
char *type = config_get_value(obj->parameters, CN_TYPE);
if (type == NULL)
{
MXS_ERROR("Configuration object %s has no type.", obj->object);
}
else if (!strcmp(type, CN_SERVICE))
{
char *router = config_get_value(obj->parameters, CN_ROUTER);
if (router)
{
if ((service = service_find(obj->object)) != NULL)
{
char *user;
char *auth;
char *enable_root_user;
const char *max_connections;
const char *max_queued_connections;
const char *queued_connection_timeout;
char *connection_timeout;
char* auth_all_servers;
char* strip_db_esc;
char* max_slave_conn_str;
char* max_slave_rlag_str;
char *version_string;
char *allow_localhost_match_wildcard_host;
enable_root_user = config_get_value(obj->parameters, CN_ENABLE_ROOT_USER);
connection_timeout = config_get_value(obj->parameters, CN_CONNECTION_TIMEOUT);
max_connections = config_get_value_string(obj->parameters, CN_MAX_CONNECTIONS);
max_queued_connections = config_get_value_string(obj->parameters, "max_queued_connections");
queued_connection_timeout = config_get_value_string(obj->parameters, "queued_connection_timeout");
user = config_get_value(obj->parameters, CN_USER);
auth = config_get_password(obj->parameters);
auth_all_servers = config_get_value(obj->parameters, CN_AUTH_ALL_SERVERS);
strip_db_esc = config_get_value(obj->parameters, CN_STRIP_DB_ESC);
version_string = config_get_value(obj->parameters, CN_VERSION_STRING);
allow_localhost_match_wildcard_host =
config_get_value(obj->parameters, CN_LOCALHOST_MATCH_WILDCARD_HOST);
char *log_auth_warnings = config_get_value(obj->parameters, CN_LOG_AUTH_WARNINGS);
int truthval;
if (log_auth_warnings && (truthval = config_truth_value(log_auth_warnings)) != -1)
{
service->log_auth_warnings = (bool)truthval;
}
if (version_string)
{
serviceSetVersionString(service, version_string);
}
if (user && auth)
{
service_update(service, router, user, auth);
if (enable_root_user)
{
serviceEnableRootUser(service, config_truth_value(enable_root_user));
}
if (connection_timeout)
{
serviceSetTimeout(service, atoi(connection_timeout));
}
if (strlen(max_connections))
{
serviceSetConnectionLimits(service,
atoi(max_connections),
atoi(max_queued_connections),
atoi(queued_connection_timeout));
}
if (auth_all_servers)
{
serviceAuthAllServers(service, config_truth_value(auth_all_servers));
}
if (strip_db_esc)
{
serviceStripDbEsc(service, config_truth_value(strip_db_esc));
}
if (allow_localhost_match_wildcard_host)
{
serviceEnableLocalhostMatchWildcardHost(
service,
config_truth_value(allow_localhost_match_wildcard_host));
}
}
obj->element = service;
}
}
else
{
obj->element = NULL;
MXS_ERROR("No router defined for service '%s'.", obj->object);
}
}
else if (!strcmp(type, "server"))
{
char *address = config_get_value(obj->parameters, CN_ADDRESS);
char *port = config_get_value(obj->parameters, CN_PORT);
if (address && port &&
(server = server_find(address, atoi(port))) != NULL)
{
char *monuser = config_get_value(obj->parameters, CN_MONITORUSER);
char *monpw = config_get_value(obj->parameters, CN_MONITORPW);
server_update_credentials(server, monuser, monpw);
obj->element = server;
}
else
{
create_new_server(obj);
}
}
obj = obj->next;
}
return true;
}
/**
* @brief Check if required parameters are missing
*