MXS-1203: Fix response tracking of LOAD DATA LOCAL INFILE

When responses are being tracked, the execution of a LOAD DATA LOCAL
INFILE requires special handling. The readwritesplit now has a simple
state machine for the handling of the LOAD DATA LOCAL INFILE command. This
should also make the code a bit more readable.
This commit is contained in:
Markus Mäkelä
2017-04-03 16:12:04 +03:00
parent ea38d511e3
commit 673631084a
4 changed files with 46 additions and 15 deletions

View File

@ -334,6 +334,15 @@ typedef struct prep_stmt_st
#endif /*< PREP_STMT_CACHING */
/** States of a LOAD DATA LOCAL INFILE */
enum ld_state
{
LOAD_DATA_INACTIVE, /**< Not active */
LOAD_DATA_START, /**< Current query starts a load */
LOAD_DATA_ACTIVE, /**< Load is active */
LOAD_DATA_END /**< Current query contains an empty packet that ends the load */
};
/**
* The client session structure used within this router.
*/
@ -349,7 +358,7 @@ struct router_client_session
rwsplit_config_t rses_config; /*< copied config info from router instance */
int rses_nbackends;
int rses_nsescmd; /*< Number of executed session commands */
bool rses_load_active; /*< If LOAD DATA LOCAL INFILE is being currently executed */
enum ld_state load_data_state; /*< Current load data state */
bool have_tmp_tables;
uint64_t rses_load_data_sent; /*< How much data has been sent */
DCB* client_dcb;