Fix server priority regression

Servers without priorities were chosen instead of servers with
priorities. This caused at least the server_weight test to fail.
This commit is contained in:
Markus Mäkelä
2018-05-11 09:19:46 +03:00
parent df1f3ca7c6
commit ee2c3e21c7

View File

@ -709,11 +709,9 @@ static MXS_MONITORED_SERVER *get_candidate_master(MXS_MONITOR* mon)
} }
} }
else if (moitor_servers->server->node_id >= 0 && else if (moitor_servers->server->node_id >= 0 &&
(!handle->use_priority || /** Server priority disabled*/ (!handle->use_priority || candidate_master == NULL))
candidate_master == NULL || /** No candidate chosen */
/** Candidate has no priority */
!server_get_parameter_nolock(moitor_servers->server, "priority", buf, sizeof(buf))))
{ {
// Server priorities are not in use or no candidate has been found
if (min_id < 0 || moitor_servers->server->node_id < min_id) if (min_id < 0 || moitor_servers->server->node_id < min_id)
{ {
min_id = moitor_servers->server->node_id; min_id = moitor_servers->server->node_id;