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.
This commit is contained in:
Markus Mäkelä
2018-09-25 22:59:24 +03:00
parent 1a41f1a8e2
commit 7d2a5b2c13

View File

@ -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;
}
}