Always extract the current command from the buffer

As readwritesplit queues queries, it needs to extract the command from the
buffer when the queued queries are routed. It cannot rely on the client
protocol command when the rerouting is taking place.
This commit is contained in:
Markus Mäkelä
2017-06-28 21:57:57 +03:00
parent b0023e1689
commit dd05b44d38

View File

@ -1059,7 +1059,7 @@ bool handle_master_is_target(RWSplit *inst, RWSplitSession *rses,
return succp;
}
static inline bool query_creates_reply(mysql_server_cmd_t cmd)
static inline bool query_creates_reply(uint8_t cmd)
{
return cmd != MYSQL_COM_QUIT &&
cmd != MYSQL_COM_STMT_SEND_LONG_DATA &&
@ -1094,7 +1094,7 @@ bool handle_got_target(RWSplit *inst, RWSplitSession *rses,
ss_dassert(target->session_command_count() == 0);
mxs::Backend::response_type response = mxs::Backend::NO_RESPONSE;
mysql_server_cmd_t cmd = mxs_mysql_current_command(rses->client_dcb->session);
uint8_t cmd = mxs_mysql_get_command(querybuf);
if (rses->load_data_state != LOAD_DATA_ACTIVE &&
query_creates_reply(cmd))