MXS-1929: Take serialization helpers into use in service

The service configuration serialization now uses the helper functions from
config.hh. This fixes the failing test mxs1731_old_persisted_config and
improves the readability of persisted configuration files.

Converted parameters into booleans that were used like booleans. This
forced the removal of the automatic enabling of
localhost_match_wildcard_host but since it has been enable by default,
this change should have no practical effects.

In addition to the clarification of the persisted configurations, this
change will limit the negative side-effects of changing a configuration
value in the main configuration file after a runtime modification has been
made. If a value has not been modified at runtime, changes to it in the
main configuration will take effect.

Previously, a runtime modification prevented all further manual changes to
the configuration file. Although in theory this sounds good, in practice
this does very little to improve the situation: The only reliable way to
change a parameter after a runtime modification is to do it via the REST
API (or MaxAdmin).
This commit is contained in:
Markus Mäkelä
2018-08-13 23:38:03 +03:00
parent 0c2bec9fba
commit 9538dbb37f
3 changed files with 21 additions and 37 deletions

View File

@ -828,7 +828,6 @@ int get_users_from_server(MYSQL *con, SERVER_REF *server_ref, SERVICE *service,
MYSQL_AUTH *instance = (MYSQL_AUTH*)listener->auth_instance;
sqlite3* handle = get_handle(instance);
bool anon_user = false;
int users = 0;
if (query)
@ -856,13 +855,6 @@ int get_users_from_server(MYSQL *con, SERVER_REF *server_ref, SERVICE *service,
add_mysql_user(handle, row[0], row[1], row[2],
row[3] && strcmp(row[3], "Y") == 0, row[4]);
users++;
if (row[0] && *row[0] == '\0')
{
/** Empty username is used for the anonymous user. This means
that localhost does not match wildcard host. */
anon_user = true;
}
}
mysql_free_result(result);
@ -876,12 +868,6 @@ int get_users_from_server(MYSQL *con, SERVER_REF *server_ref, SERVICE *service,
MXS_FREE(query);
}
/** Set the parameter if it is not configured by the user */
if (service->localhost_match_wildcard_host == SERVICE_PARAM_UNINIT)
{
service->localhost_match_wildcard_host = anon_user ? 0 : 1;
}
/** Load the list of databases */
if (mxs_mysql_query(con, "SHOW DATABASES") == 0)
{