MXS-1901: Route related PS commands to same server

All COM_STMT_SEND_LONG_DATA commands and the COM_STMT_EXECUTE that follows
it must be sent to the same server. This implicitly works for masters but
with multiple slave servers the data could be sent to the wrong server.

By using the code added for MXS-2521, this problem can now be easily
solved by checking what the previous command was.
This commit is contained in:
Markus Mäkelä 2019-07-02 09:23:19 +03:00
parent 847d673f07
commit be8f4fe055
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19

View File

@ -956,8 +956,15 @@ QueryClassifier::current_target_t QueryClassifier::handle_multi_temp_and_load(
bool QueryClassifier::query_continues_ps(uint8_t cmd, uint32_t stmt_id, GWBUF* buffer)
{
bool rval = false;
uint8_t prev_cmd = m_route_info.command();
if (cmd == COM_STMT_FETCH)
if (prev_cmd == MXS_COM_STMT_SEND_LONG_DATA
&& (cmd == MXS_COM_STMT_EXECUTE || cmd == MXS_COM_STMT_SEND_LONG_DATA))
{
// PS execution must be sent to the same server where the data was sent
rval = true;
}
else if (cmd == COM_STMT_FETCH)
{
// COM_STMT_FETCH should always go to the same target as the COM_STMT_EXECUTE
rval = true;