MXS-2490: Always restore original statement ID

By always restoring the ID, we are guaranteed to only store the query in
the form that it was originally sent in. This should be changed so that
the ID that the client sends can be used as-is in the backends.
This commit is contained in:
Markus Mäkelä
2019-06-20 13:47:54 +03:00
parent 805be70a78
commit be429c2c57

View File

@ -1237,6 +1237,12 @@ bool RWSplitSession::handle_got_target(GWBUF* querybuf, SRWBackend& target, bool
target->write(send_buf, response) :
target->continue_write(send_buf);
if (orig_id)
{
// Put the original ID back in case we try to route the query again
replace_binary_ps_id(querybuf, orig_id);
}
if (success)
{
if (store)
@ -1280,12 +1286,6 @@ bool RWSplitSession::handle_got_target(GWBUF* querybuf, SRWBackend& target, bool
}
else
{
if (orig_id)
{
// Put the original ID back in case we try to route the query again
replace_binary_ps_id(querybuf, orig_id);
}
MXS_ERROR("Routing query failed.");
}