Merge branch '2.3' into develop

This commit is contained in:
Markus Mäkelä
2019-05-17 14:39:30 +03:00
5 changed files with 47 additions and 1 deletions

View File

@ -235,7 +235,12 @@ bool RWSplitSession::route_single_stmt(GWBUF* querybuf)
RWBackend* target = nullptr;
if (TARGET_IS_ALL(route_target))
if (command == MXS_COM_STMT_EXECUTE && stmt_id == 0)
{
// Unknown prepared statement ID
succp = send_unknown_ps_error(extract_binary_ps_id(querybuf));
}
else if (TARGET_IS_ALL(route_target))
{
succp = handle_target_is_all(route_target, querybuf, command, qtype);
}

View File

@ -193,6 +193,14 @@ bool RWSplitSession::route_stored_query()
auto query = std::move(m_query_queue.front());
m_query_queue.pop_front();
if (!query.get())
{
MXS_ALERT("MXS-2464: Query in query queue unexpectedly null. Queue has %lu queries left.",
m_query_queue.size());
mxb_assert(!true);
continue;
}
/** Store the query queue locally for the duration of the routeQuery call.
* This prevents recursive calls into this function. */
decltype(m_query_queue) temp_storage;
@ -1267,3 +1275,11 @@ bool RWSplitSession::supports_hint(HINT_TYPE hint_type) const
return rv;
}
bool RWSplitSession::send_unknown_ps_error(uint32_t stmt_id)
{
std::stringstream ss;
ss << "Unknown prepared statement handler (" << stmt_id << ") given to MaxScale";
GWBUF* err = modutil_create_mysql_err_msg(1, 0, ER_UNKNOWN_STMT_HANDLER, "HY000", ss.str().c_str());
return m_client->func.write(m_client, err);
}

View File

@ -175,6 +175,9 @@ private:
mxs::RWBackend* old_master,
mxs::RWBackend* curr_master);
// Send unknown prepared statement ID error to client
bool send_unknown_ps_error(uint32_t stmt_id);
GWBUF* handle_causal_read_reply(GWBUF* writebuf, mxs::RWBackend* backend);
GWBUF* add_prefix_wait_gtid(SERVER* server, GWBUF* origin);
void correct_packet_sequence(GWBUF* buffer);