MXS-1167: Skip loading of users for internal services at startup

When MaxScale is being started and the users are loaded, the MySQL
authenticator should not load the database users for internal services
abstracted as servers.

The loading of users at startup for internal services is avoided because
the startup is done in a single thread context and the internal services
have not yet been started.

The delayed loading of users will cause the authentication to fail when
the first client connect. This triggers the reloading of the users and the
second attempt at authentication will succeed. All of this is hidden from
the end user.
This commit is contained in:
Markus Mäkelä
2017-03-20 12:16:29 +02:00
parent 0b5d164855
commit ab4c738c3c
3 changed files with 18 additions and 8 deletions

View File

@ -613,8 +613,11 @@ static int mysql_auth_load_users(SERV_LISTENER *port)
return MXS_AUTH_LOADUSERS_FATAL;
}
bool skip_local = false;
if (instance->handle == NULL)
{
skip_local = true;
char path[PATH_MAX];
get_database_path(port, path, sizeof(path));
if (!open_instance_database(path, &instance->handle))
@ -623,7 +626,7 @@ static int mysql_auth_load_users(SERV_LISTENER *port)
}
}
int loaded = replace_mysql_users(port);
int loaded = replace_mysql_users(port, skip_local);
if (loaded < 0)
{
@ -641,7 +644,7 @@ static int mysql_auth_load_users(SERV_LISTENER *port)
}
}
if (loaded == 0)
if (loaded == 0 && !skip_local)
{
MXS_WARNING("[%s]: failed to load any user information. Authentication"
" will probably fail as a result.", service->name);