MXS-2521: Detect COM_STMT_EXECUTE without metadata

If a COM_STMT_EXECUTE has no metadata in it and it has more than one
parameter, it must be routed to the same backend where the previous
COM_STMT_EXECUTE with the same ID was routed to. This prevents MDEV-19811
that is triggered by MaxScale routing the queries to different backends.
This commit is contained in:
Markus Mäkelä
2019-06-26 12:33:46 +03:00
parent a6617f52fc
commit 5eba688c1b
4 changed files with 105 additions and 12 deletions

View File

@ -895,10 +895,8 @@ SRWBackend RWSplitSession::handle_slave_is_target(uint8_t cmd, uint32_t stmt_id)
int rlag_max = get_max_replication_lag();
SRWBackend target;
if (cmd == MXS_COM_STMT_FETCH)
if (m_qc.is_ps_continuation())
{
/** The COM_STMT_FETCH must be executed on the same server as the
* COM_STMT_EXECUTE was executed on */
ExecMap::iterator it = m_exec_map.find(stmt_id);
if (it != m_exec_map.end())

View File

@ -126,7 +126,7 @@ void RWSplitSession::process_sescmd_response(SRWBackend& backend, GWBUF** ppPack
{
/** Map the returned response to the internal ID */
MXS_INFO("PS ID %u maps to internal ID %lu", resp.id, id);
m_qc.ps_id_internal_put(resp.id, id);
m_qc.ps_store_response(id, *ppPacket);
}
// Discard any slave connections that did not return the same result