Fix debug assert on master reconnection

If a master reconnection occurred after the session command history was
disabled due to the limit being exceeded, a debug assertion would be hit
in prepare_target. This assert makes sure that a connection can be safely
created to the server which means that in release mode builds the session
state would be inconsistent on the new master.

As this is an unrecoverable situation, the session should stop immediately
even if delayed_retry is enabled. Currently the session will continue
until the delayed retry timeout is hit. This happens due to the fact that
the delayed retry mechanism handles all errors in a similar way.
This commit is contained in:
Markus Mäkelä
2019-08-05 16:08:25 +03:00
parent 9f6efef67a
commit bb6f9213d4

View File

@ -721,7 +721,8 @@ SRWBackend RWSplitSession::get_master_backend()
if (master)
{
if (master->in_use() || (m_config.master_reconnection && master->can_connect()))
if (master->in_use()
|| (m_config.master_reconnection && master->can_connect() && can_recover_servers()))
{
if (master->is_master())
{
@ -736,7 +737,8 @@ SRWBackend RWSplitSession::get_master_backend()
}
else
{
MXS_ERROR("Server '%s' is not in use and can't be chosen as the master.",
MXS_ERROR("Cannot choose server '%s' as the master because it is not "
"in use and a new connection to it cannot be created.",
master->name());
}
}