MXS-1457: Ignore removed servers when loading users

When users are loaded, removed or deleted servers are ignored.
This commit is contained in:
Markus Mäkelä
2017-09-27 19:12:45 +03:00
parent 099c2f87bc
commit 395b445336
2 changed files with 24 additions and 3 deletions

View File

@ -855,15 +855,18 @@ static int get_users(SERV_LISTENER *listener, bool skip_local)
SERVER_REF *server = service->dbref;
int total_users = -1;
bool no_active_servers = true;
for (server = service->dbref; !service->svc_do_shutdown && server; server = server->next)
{
if (skip_local && server_is_mxs_service(server->server))
if (!SERVER_REF_IS_ACTIVE(server) || !SERVER_IS_ACTIVE(server->server) ||
(skip_local && server_is_mxs_service(server->server)))
{
total_users = 0;
continue;
}
no_active_servers = false;
MYSQL *con = gw_mysql_init();
if (con)
{
@ -897,7 +900,12 @@ static int get_users(SERV_LISTENER *listener, bool skip_local)
MXS_FREE(dpwd);
if (server == NULL && total_users == -1)
if (no_active_servers)
{
// This service has no servers or all servers are local MaxScale services
total_users = 0;
}
else if (server == NULL && total_users == -1)
{
MXS_ERROR("Unable to get user data from backend database for service [%s]."
" Failed to connect to any of the backend databases.", service->name);