From 3278be565a0c45dce3e740dbd679d4ef2757d660 Mon Sep 17 00:00:00 2001 From: VilhoRaatikka Date: Wed, 5 Nov 2014 11:18:25 +0200 Subject: [PATCH] Fix to bug #609, http://bugs.mariadb.com/show_bug.cgi?id=609 If target can't be resolved, master is chosen. Bug cause master be chosen in most of the cases. --- server/modules/routing/readwritesplit/readwritesplit.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/modules/routing/readwritesplit/readwritesplit.c b/server/modules/routing/readwritesplit/readwritesplit.c index 8cf2dfb41..85b4aa32a 100644 --- a/server/modules/routing/readwritesplit/readwritesplit.c +++ b/server/modules/routing/readwritesplit/readwritesplit.c @@ -1356,7 +1356,7 @@ static route_target_t get_route_target ( hint = hint->next; } /*< while (hint != NULL) */ /** If nothing matches then choose the master */ - if ((target & (TARGET_ALL|TARGET_SLAVE|TARGET_MASTER)) == target) + if ((target & (TARGET_ALL|TARGET_SLAVE|TARGET_MASTER)) == 0) { target = TARGET_MASTER; } @@ -2050,9 +2050,9 @@ static int routeQuery( } succp = false; ret = 0; - } - } - + } + } + if (succp) /*< Have DCB of the target backend */ { backend_ref_t* bref;