Fix COM_STMT_LONG_DATA routing

The initial COM_STMT_LONG_DATA would not trigger the "pinning" of the
statement to a known node.
This commit is contained in:
Markus Mäkelä 2019-07-10 09:52:25 +03:00
parent a91726100c
commit 21dfcb5648
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19

View File

@ -333,13 +333,14 @@ bool RWSplitSession::route_single_stmt(GWBUF* querybuf)
// Target server was found and is in the correct state
succp = handle_got_target(querybuf, target, store_stmt);
if (succp && command == MXS_COM_STMT_EXECUTE && !is_locked_to_master())
if (succp && !is_locked_to_master()
&& (command == MXS_COM_STMT_EXECUTE || command == MXS_COM_STMT_SEND_LONG_DATA))
{
/** Track the targets of the COM_STMT_EXECUTE statements. This
* information is used to route all COM_STMT_FETCH commands
* to the same server where the COM_STMT_EXECUTE was done. */
m_exec_map[stmt_id] = target;
MXS_INFO("COM_STMT_EXECUTE on %s: %s", target->name(), target->uri());
MXS_INFO("%s on %s: %s", STRPACKETTYPE(command), target->name(), target->uri());
}
}
}
@ -904,18 +905,18 @@ SRWBackend RWSplitSession::handle_slave_is_target(uint8_t cmd, uint32_t stmt_id)
if (it->second->in_use())
{
target = it->second;
MXS_INFO("COM_STMT_FETCH on %s", target->name());
MXS_INFO("%s on %s", STRPACKETTYPE(cmd), target->name());
}
else
{
MXS_ERROR("Old COM_STMT_EXECUTE target %s not in use, cannot "
"proceed with COM_STMT_FETCH",
it->second->name());
"proceed with %s",
it->second->name(), STRPACKETTYPE(cmd));
}
}
else
{
MXS_WARNING("Unknown statement ID %u used in COM_STMT_FETCH", stmt_id);
MXS_WARNING("Unknown statement ID %u used in %s", stmt_id, STRPACKETTYPE(cmd));
}
}
else