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:
@ -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
|
||||
*
|
||||
|
@ -311,13 +311,11 @@ static void maxscale_ssl_id(CRYPTO_THREADID* id)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Handler for SIGHUP signal. Reload the configuration for the
|
||||
* gateway.
|
||||
* Handler for SIGHUP signal.
|
||||
*/
|
||||
static void sighup_handler (int i)
|
||||
{
|
||||
MXS_NOTICE("Refreshing configuration following SIGHUP\n");
|
||||
config_reload();
|
||||
// Legacy configuration reload handler
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -115,7 +115,6 @@ void service_update_weights();
|
||||
*/
|
||||
void serviceAddRouterOption(SERVICE *service, char *option);
|
||||
void serviceClearRouterOptions(SERVICE *service);
|
||||
void service_update(SERVICE *service, char *router, char *user, char *auth);
|
||||
|
||||
/**
|
||||
* @brief Add parameters to a service
|
||||
|
@ -1570,47 +1570,6 @@ dListListeners(DCB *dcb)
|
||||
spinlock_release(&service_spin);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the definition of a service
|
||||
*
|
||||
* @param service The service to update
|
||||
* @param router The router module to use
|
||||
* @param user The user to use to extract information from the database
|
||||
* @param auth The password for the user above
|
||||
*/
|
||||
void
|
||||
service_update(SERVICE *service, char *router, char *user, char *auth)
|
||||
{
|
||||
MXS_ROUTER_OBJECT *router_obj;
|
||||
|
||||
if (!strcmp(service->routerModule, router))
|
||||
{
|
||||
if ((router_obj = (MXS_ROUTER_OBJECT*)load_module(router, MODULE_ROUTER)) == NULL)
|
||||
{
|
||||
MXS_ERROR("Failed to update router "
|
||||
"for service %s to %s.",
|
||||
service->name,
|
||||
router);
|
||||
}
|
||||
else
|
||||
{
|
||||
MXS_NOTICE("Update router for service %s to %s.",
|
||||
service->name,
|
||||
router);
|
||||
MXS_FREE(service->routerModule);
|
||||
service->routerModule = MXS_STRDUP_A(router);
|
||||
service->router = router_obj;
|
||||
}
|
||||
}
|
||||
if (user &&
|
||||
(strcmp(service->credentials.name, user) != 0 ||
|
||||
strcmp(service->credentials.authdata, auth) != 0))
|
||||
{
|
||||
MXS_NOTICE("Update credentials for service %s.", service->name);
|
||||
serviceSetUser(service, user, auth);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh the database users for the service
|
||||
* This function replaces the MySQL users used by the service with the latest
|
||||
|
Reference in New Issue
Block a user