Don't close connections to servers being drained

The connections to servers being drained should not be closed like they
should be for servers in maintenance mode. The change in functionality
between 2.3 and develop caused the connections to be discarded if the
server was in either maintenance or drain mode.
This commit is contained in:
Markus Mäkelä
2019-03-20 15:42:09 +02:00
parent 8ed192892a
commit 74eeb64fba

View File

@ -545,12 +545,14 @@ void RWSplitSession::close_stale_connections()
{
if (backend->in_use())
{
if (!backend->can_connect())
auto server = backend->server();
if (!server->is_usable())
{
MXS_INFO("Discarding connection to '%s': Server is in maintenance", backend->name());
backend->close();
}
else if (backend->server()->rank() != current_rank)
else if (server->rank() != current_rank)
{
MXS_INFO("Discarding connection to '%s': Server has rank %ld and current rank is %ld",
backend->name(), backend->server()->rank(), current_rank);