Assign master status only to root level masters

If a relay master server is found in the replication tree, it should not
get the master status. Previously all master servers were assigned the
master status regardless of their depth in the replication tree.

By comparing the depth value of each potential master, the monitor can
find the right master at the root of the replication tree.
This commit is contained in:
Markus Makela
2016-09-06 12:45:14 +03:00
parent 46c8a6f66b
commit 506ef1b9f6
3 changed files with 32 additions and 1 deletions

View File

@ -619,7 +619,7 @@ server_status(SERVER *server)
{
char *status = NULL;
if (NULL == server || (status = (char *)MXS_MALLOC(256)) == NULL)
if (NULL == server || (status = (char *)MXS_MALLOC(512)) == NULL)
{
return NULL;
}
@ -632,6 +632,10 @@ server_status(SERVER *server)
{
strcat(status, "Master, ");
}
if (server->status & SERVER_RELAY_MASTER)
{
strcat(status, "Relay Master, ");
}
if (server->status & SERVER_SLAVE)
{
strcat(status, "Slave, ");