MXS-1828: Simplify LOAD DATA LOCAL INFILE handling

By relying on the server to tell us that it is requesting the loading of a
local infile, we can remove one state from the state machine that governs
the loading of local files. It also removes the need to handle error and
success cases separately.

A side-effect of this change is that execution of multi-statement LOAD
DATA LOCAL INFILE no longer hangs. This is done by checking whether the
completion of one command initiates a new load.

The current code recursively checks the reply state and clones the
buffers. Neither of these are required nor should they be done but
refactoring the code is to be done in a separate commit.

Added two helper functions that are used to detect requests for local
infiles and to extract the total packet length from a non-contiguous
GWBUF.
This commit is contained in:
Markus Mäkelä
2018-05-16 17:41:55 +03:00
parent 35f2382263
commit 91cc5b1e89
8 changed files with 67 additions and 27 deletions

View File

@ -1582,6 +1582,13 @@ bool mxs_mysql_is_result_set(GWBUF *buffer)
return rval;
}
bool mxs_mysql_is_local_infile(GWBUF *buffer)
{
uint8_t cmd = 0xff; // Default should differ from the OK packet
gwbuf_copy_data(buffer, MYSQL_HEADER_LEN, 1, &cmd);
return cmd == MYSQL_REPLY_LOCAL_INFILE;
}
bool mxs_mysql_is_prep_stmt_ok(GWBUF *buffer)
{
bool rval = false;