Don't use closed backends

Only use backends that are still in use. The COM_STMT_EXECUTE and
COM_STMT_FETCH relationship caused unused backends to be used.
This commit is contained in:
Markus Mäkelä 2018-06-26 12:45:08 +03:00
parent d5bdc3febd
commit f97f422379
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19
2 changed files with 13 additions and 2 deletions

View File

@ -196,6 +196,7 @@ bool Backend::connect(MXS_SESSION* session)
bool Backend::write(GWBUF* buffer, response_type type)
{
ss_dassert(in_use());
bool rval = m_dcb->func.write(m_dcb, buffer) != 0;
if (rval && type == EXPECT_RESPONSE)
@ -208,6 +209,7 @@ bool Backend::write(GWBUF* buffer, response_type type)
bool Backend::auth(GWBUF* buffer)
{
ss_dassert(in_use());
bool rval = false;
if (m_dcb->func.auth(m_dcb, NULL, m_dcb->session, buffer) == 1)
@ -232,6 +234,7 @@ void Backend::store_command(GWBUF* buffer)
bool Backend::write_stored_command()
{
ss_dassert(in_use());
bool rval = false;
if (m_pending_cmd.length())

View File

@ -999,8 +999,15 @@ SRWBackend handle_slave_is_target(RWSplit *inst, RWSplitSession *rses,
if (it != rses->exec_map.end())
{
target = it->second;
MXS_INFO("COM_STMT_FETCH on %s", target->uri());
if (it->second->in_use())
{
target = it->second;
MXS_INFO("COM_STMT_FETCH on %s", target->uri());
}
else
{
MXS_INFO("Old target not in use, cannot proceed");
}
}
else
{
@ -1016,6 +1023,7 @@ SRWBackend handle_slave_is_target(RWSplit *inst, RWSplitSession *rses,
if (target)
{
atomic_add_uint64(&inst->stats().n_slave, 1);
ss_dassert(target->in_use());
}
else
{