Fix debug assert on reconnection with session commands

When a query was routed to a server that must first be connected to, the
expected response count was not updated for the executed session commands.
This commit is contained in:
Markus Mäkelä
2018-06-13 10:41:23 +03:00
parent 9dd8043359
commit 3ed6411741
4 changed files with 12 additions and 11 deletions

View File

@ -117,6 +117,15 @@ bool RWSplitSession::prepare_target(SRWBackend& target, route_target_t route_tar
ss_dassert(target->can_connect() && can_recover_servers());
ss_dassert(!TARGET_IS_MASTER(route_target) || m_config.master_reconnection);
rval = target->connect(m_client->session, &m_sescmd_list);
MXS_INFO("Connected to '%s'", target->name());
if (rval && target->is_waiting_result())
{
ss_info_dassert(!m_sescmd_list.empty() && target->has_session_commands(),
"Session command list must not be empty and target "
"should have unfinished session commands.");
m_expected_responses++;
}
}
return rval;
@ -403,10 +412,6 @@ bool RWSplitSession::route_session_write(GWBUF *querybuf, uint8_t command, uint3
{
m_expected_responses++;
}
else
{
backend->ack_write();
}
MXS_INFO("Route query to %s: %s \t%s",
backend->is_master() ? "master" : "slave",
@ -1028,11 +1033,6 @@ bool RWSplitSession::handle_got_target(GWBUF* querybuf, SRWBackend& target, bool
m_qc.set_load_data_state(QueryClassifier::LOAD_DATA_INACTIVE);
}
}
else
{
// The server won't respond, mark it as done
target->ack_write();
}
}
m_qc.set_large_query(large_query);