From 7d2a5b2c13a600101dcec8c448927ce43272a960 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Tue, 25 Sep 2018 22:59:24 +0300 Subject: [PATCH] Fix readwritesplit debug assertion The debug assertion is wrong as the code was changed to prioritize hints over the router target selection. Also removed the superficial check for master, slave and relay master states as they are implied by the fact that the connection is in use. --- .../routing/readwritesplit/rwsplit_route_stmt.cc | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc b/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc index 7eba4e858..d9d1f5105 100644 --- a/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc +++ b/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc @@ -477,21 +477,14 @@ SRWBackend get_target_backend(RWSplitSession *rses, backend_type_t btype, if (name) /*< Choose backend by name from a hint */ { - ss_dassert(btype != BE_MASTER); /*< Master dominates and no name should be passed with it */ - for (SRWBackendList::iterator it = rses->backends.begin(); it != rses->backends.end(); it++) { SRWBackend& backend = *it; - /** The server must be a valid slave, relay server, or master */ - - if (backend->in_use() && - (strcasecmp(name, backend->name()) == 0) && - (backend->is_slave() || - backend->is_relay() || - backend->is_master())) + if (backend->in_use() && strcasecmp(name, backend->name()) == 0) { + /** The server is in use */ return backend; } }