MXS-1625 Move internal/external id map to QueryClassifier

This commit is contained in:
Johan Wikman
2018-04-06 15:20:09 +03:00
parent 304499bd36
commit 300de4ecc6
5 changed files with 70 additions and 23 deletions

View File

@ -613,7 +613,7 @@ route_target_t get_target_type(RWSplitSession *rses, GWBUF *buffer,
}
else if (mxs_mysql_is_ps_command(*command))
{
*stmt_id = get_internal_ps_id(rses, buffer);
*stmt_id = rses->qc().ps_id_internal_get(buffer);
*type = rses->qc().ps_get_type(*stmt_id);
}

View File

@ -111,7 +111,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_ps_handles[resp.id] = id;
m_qc.ps_id_internal_put(resp.id, id);
}
// Discard any slave connections that did not return the same result

View File

@ -737,24 +737,3 @@ void RWSplitSession::handle_error_reply_client(DCB *backend_dcb, GWBUF *errmsg)
m_client->func.write(m_client, gwbuf_clone(errmsg));
}
}
uint32_t get_internal_ps_id(RWSplitSession* rses, GWBUF* buffer)
{
uint32_t rval = 0;
// All COM_STMT type statements store the ID in the same place
uint32_t id = mxs_mysql_extract_ps_id(buffer);
ClientHandleMap::iterator it = rses->m_ps_handles.find(id);
if (it != rses->m_ps_handles.end())
{
rval = it->second;
}
else
{
MXS_WARNING("Client requests unknown prepared statement ID '%u' that "
"does not map to an internal ID", id);
}
return rval;
}