MXS-3425: Fix handling of LOAD DATA LOCAL INFILE
The LOAD DATA LOCAL INFILE is handled in a way where it returns two results that both are complete: the first one with the file being requested and the second one with the final OK packet. Readwritesplit called session_book_server_response for both statements which caused the current query index to drop to -1 which in turn was unconditionally used as the buffer offset. The new check for the invalid index value will help prevent crashes in production while still allowing it to be detected while testing.
This commit is contained in:
parent
88baaeffd3
commit
19066ae383
@ -1484,6 +1484,14 @@ void Session::book_server_response(SERVER* pServer, bool final_response)
|
||||
if (m_retain_last_statements && !m_last_queries.empty())
|
||||
{
|
||||
mxb_assert(m_current_query >= 0);
|
||||
|
||||
if (m_current_query < 0)
|
||||
{
|
||||
MXS_ALERT("Internal logic error, disabling retain_last_statements.");
|
||||
m_retain_last_statements = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
// If enough queries have been sent by the client, without it waiting
|
||||
// for the responses, then at this point it may be so that the query
|
||||
// object has been popped from the size limited queue. That's apparent
|
||||
|
@ -734,7 +734,7 @@ void RWSplitSession::clientReply(GWBUF* writebuf, DCB* backend_dcb)
|
||||
/** Got a complete reply, decrement expected response count */
|
||||
m_expected_responses--;
|
||||
|
||||
if (!backend->is_replaying_history())
|
||||
if (!backend->is_replaying_history() && !backend->local_infile_requested())
|
||||
{
|
||||
session_book_server_response(m_pSession, backend->backend()->server, m_expected_responses == 0);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user