From 1eefb46e682d96239646a94f390e5456cd735585 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Tue, 10 Apr 2018 22:51:16 +0300 Subject: [PATCH] MXS-1773: Update internal state when LOAD DATA LOCAL INFILE fails When a LOAD DATA LOCAL INFILE is actively rejected by the server, the server sends an error to the client. This error was not detected and the router was stuck in the special mode that handles LOAD DATA LOCAL INFILE. --- server/modules/routing/readwritesplit/readwritesplit.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/server/modules/routing/readwritesplit/readwritesplit.cc b/server/modules/routing/readwritesplit/readwritesplit.cc index 1d08000b5..0897eae45 100644 --- a/server/modules/routing/readwritesplit/readwritesplit.cc +++ b/server/modules/routing/readwritesplit/readwritesplit.cc @@ -1150,6 +1150,12 @@ static void clientReply(MXS_ROUTER *instance, SRWBackend& backend = get_backend_from_dcb(rses, backend_dcb); + if (rses->load_data_state == LOAD_DATA_ACTIVE && mxs_mysql_is_err_packet(writebuf)) + { + // Server responded with an error to the LOAD DATA LOCAL INFILE + rses->load_data_state = LOAD_DATA_INACTIVE; + } + if (backend->get_reply_state() == REPLY_STATE_DONE) { /** If we receive an unexpected response from the server, the internal