Set current command when executing queued queries

When readwritesplit is routing any queued queries, the currently executed
command of the protocol modules needs to be adjusted by
readwritesplit. This is not a true fix but more of a workaround to fix the
problems of queued query execution.

The correct solution would be to move the queued query handling into the
client protocol module so that all components see the same state.
This commit is contained in:
Markus Mäkelä
2017-09-22 11:50:06 +03:00
parent bfeaceb070
commit 2d590308b6
3 changed files with 60 additions and 59 deletions

View File

@ -466,6 +466,11 @@ static bool route_stored_query(RWSplitSession *rses)
GWBUF *temp_storage = rses->query_queue;
rses->query_queue = NULL;
// TODO: Move the handling of queued queries to the client protocol
// TODO: module where the command tracking is done automatically.
uint8_t cmd = mxs_mysql_get_command(query_queue);
mysql_protocol_set_current_command(rses->client_dcb, (mxs_mysql_cmd_t)cmd);
if (!routeQuery((MXS_ROUTER*)rses->router, (MXS_ROUTER_SESSION*)rses, query_queue))
{
rval = false;
@ -917,6 +922,7 @@ static int routeQuery(MXS_ROUTER *instance, MXS_ROUTER_SESSION *router_session,
rses->query_queue = gwbuf_append(rses->query_queue, querybuf);
querybuf = NULL;
rval = 1;
ss_dassert(rses->expected_responses > 0);
if (rses->expected_responses == 0 && !route_stored_query(rses))
{