MXS-2266: Close prepared statements with internal ID
The ID used to store the prepared statements uses the internal ID and using the external ID caused unwanted memory use and a false warning.
This commit is contained in:
@ -390,8 +390,18 @@ uint32_t QueryClassifier::ps_get_type(std::string id) const
|
|||||||
|
|
||||||
void QueryClassifier::ps_erase(GWBUF* buffer)
|
void QueryClassifier::ps_erase(GWBUF* buffer)
|
||||||
{
|
{
|
||||||
m_ps_handles.erase(qc_mysql_extract_ps_id(buffer));
|
if (qc_mysql_is_ps_command(mxs_mysql_get_command(buffer)))
|
||||||
m_sPs_manager->erase(buffer);
|
{
|
||||||
|
// Erase the type of the statement stored with the internal ID
|
||||||
|
m_sPs_manager->erase(ps_id_internal_get(buffer));
|
||||||
|
// ... and then erase the external to internal ID mapping
|
||||||
|
m_ps_handles.erase(qc_mysql_extract_ps_id(buffer));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Not a PS command, we don't need the ID mapping
|
||||||
|
m_sPs_manager->erase(buffer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QueryClassifier::query_type_is_read_only(uint32_t qtype) const
|
bool QueryClassifier::query_type_is_read_only(uint32_t qtype) const
|
||||||
|
@ -451,6 +451,7 @@ bool RWSplitSession::route_session_write(GWBUF* querybuf, uint8_t command, uint3
|
|||||||
}
|
}
|
||||||
else if (qc_query_is_type(type, QUERY_TYPE_DEALLOC_PREPARE))
|
else if (qc_query_is_type(type, QUERY_TYPE_DEALLOC_PREPARE))
|
||||||
{
|
{
|
||||||
|
mxb_assert(!mxs_mysql_is_ps_command(m_qc.current_route_info().command()));
|
||||||
m_qc.ps_erase(querybuf);
|
m_qc.ps_erase(querybuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user