MXS-1418: Fix regression

Removing a server from readconnroute caused the connection to be closed if
it was a master server.
This commit is contained in:
Markus Mäkelä 2018-01-08 12:25:40 +02:00
parent 5fda35a998
commit e36e506f32

View File

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