From 5384162fb1930f601c9083111af0fc97d14703eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Thu, 29 Jun 2017 09:33:42 +0300 Subject: [PATCH] Fix slave server candidate ordering The return value of the comparison was misinterpreted so that the selection process preferred the new candidate over the current one if both were equal. This was not an intended change and only a better candidate should be chosen over the current candidate. --- server/modules/routing/readwritesplit/rwsplit_route_stmt.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc b/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc index a563660e0..9c9a196de 100644 --- a/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc +++ b/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc @@ -58,7 +58,7 @@ static SRWBackend compare_backends(SRWBackend a, SRWBackend b, select_criteria_t return a; } - return p(a, b) < 0 ? a : b; + return p(a, b) <= 0 ? a : b; } void handle_connection_keepalive(RWSplit *inst, RWSplitSession *rses,