From 21dfcb5648e3ff917c7cb9636a02c9b3a44912d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Wed, 10 Jul 2019 09:52:25 +0300 Subject: [PATCH] Fix COM_STMT_LONG_DATA routing The initial COM_STMT_LONG_DATA would not trigger the "pinning" of the statement to a known node. --- .../routing/readwritesplit/rwsplit_route_stmt.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc b/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc index 4a62c693e..53797d280 100644 --- a/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc +++ b/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc @@ -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