From e36e506f32f1b37e99ad090131145b59361a98b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Mon, 8 Jan 2018 12:25:40 +0200 Subject: [PATCH] MXS-1418: Fix regression Removing a server from readconnroute caused the connection to be closed if it was a master server. --- .../routing/readconnroute/readconnroute.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/server/modules/routing/readconnroute/readconnroute.c b/server/modules/routing/readconnroute/readconnroute.c index daad7121f..fce187145 100644 --- a/server/modules/routing/readconnroute/readconnroute.c +++ b/server/modules/routing/readconnroute/readconnroute.c @@ -550,10 +550,25 @@ static inline bool connection_is_valid(ROUTER_INSTANCE* inst, ROUTER_CLIENT_SES* { if (inst->bitvalue & SERVER_MASTER) { - rval = router_cli_ses->backend == get_root_master(inst->service->dbref); + SERVER_REF* master = get_root_master(inst->service->dbref); + + if (master) + { + /** Check that the master we are connected to and the one we + * determined from the replication topology are one and the same */ + rval = router_cli_ses->backend == get_root_master(inst->service->dbref); + } + else + { + /** No master is available but the one we are connected to is + * still a master. This most likely means that the servers for + * the service have been modified at runtime. */ + rval = true; + } } else { + // Not a master and bitmask check is OK, everything is OK rval = true; } }