Merge branch '2.3' into develop

This commit is contained in:
Markus Mäkelä
2018-12-18 00:00:00 +02:00
12 changed files with 88 additions and 19 deletions

View File

@ -675,24 +675,25 @@ static inline bool complete_ps_response(GWBUF* buffer)
if (mxs_mysql_extract_ps_response(buffer, &resp))
{
int expected_eof = 0;
int expected_packets = 1;
if (resp.columns > 0)
{
expected_eof++;
// Column definition packets plus one for the EOF
expected_packets += resp.columns + 1;
}
if (resp.parameters > 0)
{
expected_eof++;
// Parameter definition packets plus one for the EOF
expected_packets += resp.parameters + 1;
}
bool more;
int n_eof = modutil_count_signal_packets(buffer, 0, &more, NULL);
int n_packets = modutil_count_packets(buffer);
MXS_DEBUG("Expecting %u EOF, have %u", n_eof, expected_eof);
MXS_DEBUG("Expecting %u packets, have %u", n_packets, expected_packets);
rval = n_eof == expected_eof;
rval = n_packets == expected_packets;
}
return rval;

View File

@ -103,6 +103,10 @@ bool RWBackend::write(GWBUF* buffer, response_type type)
// Any non-zero flag value means that we have an open cursor
m_opening_cursor = flags != 0;
}
else if (cmd == MXS_COM_STMT_CLOSE)
{
m_ps_handles.erase(it);
}
else if (cmd == MXS_COM_STMT_FETCH)
{
// Number of rows to fetch is a 4 byte integer after the ID

View File

@ -412,6 +412,13 @@ bool RWSplitSession::route_session_write(GWBUF* querybuf, uint8_t command, uint3
{
if (mxs_mysql_is_ps_command(m_qc.current_route_info().command()))
{
if (command == MXS_COM_STMT_CLOSE)
{
// Remove the command from the PS mapping
m_qc.ps_erase(querybuf);
m_exec_map.erase(m_qc.current_route_info().stmt_id());
}
/**
* Replace the ID with our internal one, the backends will replace it with their own ID
* when the packet is being written. We use the internal ID when we store the command
@ -519,6 +526,11 @@ bool RWSplitSession::route_session_write(GWBUF* querybuf, uint8_t command, uint3
{
m_sescmd_responses.erase(m_sescmd_responses.begin(), it);
}
else
{
// All responses processed
m_sescmd_responses.clear();
}
}
else
{

View File

@ -287,7 +287,6 @@ private:
uint64_t m_sent_sescmd; /**< ID of the last sent session command*/
uint64_t m_recv_sescmd; /**< ID of the most recently completed session
* command */
ClientHandleMap m_ps_handles; /**< Client PS handle to internal ID mapping */
ExecMap m_exec_map; /**< Map of COM_STMT_EXECUTE statement IDs to
* Backends */
std::string m_gtid_pos; /**< Gtid position for causal read */