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:
Markus Mäkelä 2019-01-16 11:22:26 +02:00
parent f5f6a12484
commit ba40916d4a
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19
2 changed files with 13 additions and 2 deletions

View File

@ -390,8 +390,18 @@ uint32_t QueryClassifier::ps_get_type(std::string id) const
void QueryClassifier::ps_erase(GWBUF* buffer)
{
m_ps_handles.erase(qc_mysql_extract_ps_id(buffer));
m_sPs_manager->erase(buffer);
if (qc_mysql_is_ps_command(mxs_mysql_get_command(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

View File

@ -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))
{
mxb_assert(!mxs_mysql_is_ps_command(m_qc.current_route_info().command()));
m_qc.ps_erase(querybuf);
}