One server only in MySQL monitor config

One server only in MySQL monitor: it’s the Master.
Only one server in mysql monitor and in router sections
This commit is contained in:
MassimilianoPinto 2014-11-18 11:25:21 +01:00
parent 7ef54219a6
commit e2fd2c422e

View File

@ -690,9 +690,21 @@ size_t nrounds = 0;
ptr = ptr->next;
}
/* Compute the replication tree */
root_master = get_replication_tree(handle, num_servers);
ptr = handle->databases;
/* if only one server is configured, that's is Master */
if (num_servers == 1) {
if (SERVER_IS_RUNNING(ptr->server)) {
ptr->server->depth = 0;
monitor_set_pending_status(ptr, SERVER_MASTER);
ptr->server->depth = 0;
handle->master = ptr;
root_master = ptr;
}
} else {
/* Compute the replication tree */
root_master = get_replication_tree(handle, num_servers);
}
/* Update server status from monitor pending status on that server*/
@ -711,6 +723,8 @@ size_t nrounds = 0;
ptr->server->status = ptr->pending_status;
}
}
fprintf(stderr, "Server %p, %i, %i\n", ptr->server, ptr->server->depth, ptr->server->status);
ptr = ptr->next;
}