MXS-2273 Deal with master being drained at RWS connect
If a master is found but it is being drained, the connection attempt is rejected if the master failure mode is fail_instantly. In that case the logged message makes it plain that it is the draining that is the reason for the connection attempt to fail.
This commit is contained in:
@ -374,9 +374,18 @@ bool RWSplit::select_connect_backend_servers(MXS_SESSION* session,
|
||||
RWBackend* master = get_root_master(backends);
|
||||
const Config& cnf {config()};
|
||||
|
||||
if (!master && cnf.master_failure_mode == RW_FAIL_INSTANTLY)
|
||||
if ((!master || !master->can_connect()) && cnf.master_failure_mode == RW_FAIL_INSTANTLY)
|
||||
{
|
||||
MXS_ERROR("Couldn't find suitable Master from %lu candidates.", backends.size());
|
||||
if (!master)
|
||||
{
|
||||
MXS_ERROR("Couldn't find suitable Master from %lu candidates.", backends.size());
|
||||
}
|
||||
else
|
||||
{
|
||||
MXS_ERROR("Master exists (%s), but it is being drained and cannot be used.",
|
||||
master->server()->address);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user