Fix EOF packet calculation for large rows
The EOF packet calculation function in modutil.cc didn't handle the case where the payload exceeded maximum packet size and could mistake binary data for a ERR packet. The state of a multi-packet payload is now exposed by the modutil_count_signal_packets function. This allows proper handling of large multi-packet payloads. Added minor improvements to mxs1110_16mb to handle testing of this change.
This commit is contained in:
@ -523,8 +523,10 @@ bool reply_is_complete(SRWBackend backend, GWBUF *buffer)
|
||||
else
|
||||
{
|
||||
bool more = false;
|
||||
bool skip = backend->get_skip_packet();
|
||||
int old_eof = backend->get_reply_state() == REPLY_STATE_RSET_ROWS ? 1 : 0;
|
||||
int n_eof = modutil_count_signal_packets(buffer, old_eof, &more);
|
||||
int n_eof = modutil_count_signal_packets(buffer, old_eof, &more, &skip);
|
||||
backend->set_skip_packet(skip);
|
||||
|
||||
if (n_eof == 0)
|
||||
{
|
||||
|
@ -16,7 +16,8 @@
|
||||
|
||||
RWBackend::RWBackend(SERVER_REF* ref):
|
||||
mxs::Backend(ref),
|
||||
m_reply_state(REPLY_STATE_DONE)
|
||||
m_reply_state(REPLY_STATE_DONE),
|
||||
m_skip(false)
|
||||
{
|
||||
}
|
||||
|
||||
@ -34,6 +35,16 @@ void RWBackend::set_reply_state(reply_state_t state)
|
||||
m_reply_state = state;
|
||||
}
|
||||
|
||||
void RWBackend::set_skip_packet(bool state)
|
||||
{
|
||||
m_skip = state;
|
||||
}
|
||||
|
||||
bool RWBackend::get_skip_packet() const
|
||||
{
|
||||
return m_skip;
|
||||
}
|
||||
|
||||
bool RWBackend::execute_session_command()
|
||||
{
|
||||
bool expect_response = mxs_mysql_command_will_respond(next_session_command()->get_command());
|
||||
|
@ -50,9 +50,15 @@ public:
|
||||
bool execute_session_command();
|
||||
bool write(GWBUF* buffer, response_type type = EXPECT_RESPONSE);
|
||||
|
||||
void set_skip_packet(bool state);
|
||||
bool get_skip_packet() const;
|
||||
|
||||
private:
|
||||
reply_state_t m_reply_state;
|
||||
BackendHandleMap m_ps_handles; /**< Internal ID to backend PS handle mapping */
|
||||
bool m_skip; /**< Used to store the state of the EOF packet
|
||||
* calculation for result sets when the result
|
||||
* contains very large rows */
|
||||
};
|
||||
|
||||
typedef std::tr1::shared_ptr<RWBackend> SRWBackend;
|
||||
|
Reference in New Issue
Block a user