MXS-1363: Fix server selection algorithm in readconnroute
Servers with zero weight are now considered as valid servers by the readconnroute connection logic.
This commit is contained in:
@ -310,7 +310,7 @@ newSession(MXS_ROUTER *instance, MXS_SESSION *session)
|
|||||||
*/
|
*/
|
||||||
for (SERVER_REF *ref = inst->service->dbref; ref; ref = ref->next)
|
for (SERVER_REF *ref = inst->service->dbref; ref; ref = ref->next)
|
||||||
{
|
{
|
||||||
if (!SERVER_REF_IS_ACTIVE(ref) || SERVER_IN_MAINT(ref->server) || ref->weight == 0)
|
if (!SERVER_REF_IS_ACTIVE(ref) || SERVER_IN_MAINT(ref->server))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -368,6 +368,10 @@ newSession(MXS_ROUTER *instance, MXS_SESSION *session)
|
|||||||
{
|
{
|
||||||
candidate = ref;
|
candidate = ref;
|
||||||
}
|
}
|
||||||
|
else if (ref->weight == 0 || candidate->weight == 0)
|
||||||
|
{
|
||||||
|
candidate = ref->weight ? ref : candidate;
|
||||||
|
}
|
||||||
else if (((ref->connections + 1) * 1000) / ref->weight <
|
else if (((ref->connections + 1) * 1000) / ref->weight <
|
||||||
((candidate->connections + 1) * 1000) / candidate->weight)
|
((candidate->connections + 1) * 1000) / candidate->weight)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user