Merge branch '2.3' into develop

This commit is contained in:
Markus Mäkelä
2019-06-20 14:36:48 +03:00
3 changed files with 19 additions and 11 deletions

View File

@ -638,11 +638,19 @@ void QueryClassifier::log_transaction_status(GWBUF* querybuf, uint32_t qtype)
uint8_t* packet = GWBUF_DATA(querybuf); uint8_t* packet = GWBUF_DATA(querybuf);
unsigned char command = packet[4]; unsigned char command = packet[4];
int len = 0; int len = 0;
char* sql; std::string sqldata;
char* sql = (char*)"<non-SQL>";
char* qtypestr = qc_typemask_to_string(qtype); char* qtypestr = qc_typemask_to_string(qtype);
if (!modutil_extract_SQL(querybuf, &sql, &len))
if (qc_mysql_is_ps_command(command))
{ {
sql = (char*)"<non-SQL>"; sqldata = "ID: " + std::to_string(mysql_extract_ps_id(querybuf));
sql = (char*)sqldata.c_str();
len = sqldata.length();
}
else
{
modutil_extract_SQL(querybuf, &sql, &len);
} }
if (len > QC_TRACE_MSG_LEN) if (len > QC_TRACE_MSG_LEN)

View File

@ -1178,6 +1178,12 @@ bool RWSplitSession::handle_got_target(GWBUF* querybuf, RWBackend* target, bool
*/ */
bool success = target->write(send_buf, response); bool success = target->write(send_buf, response);
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 (success)
{ {
if (store) if (store)
@ -1219,12 +1225,6 @@ bool RWSplitSession::handle_got_target(GWBUF* querybuf, RWBackend* target, bool
} }
else 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."); MXS_ERROR("Routing query failed.");
} }

View File

@ -994,7 +994,7 @@ void RWSplitSession::handleError(GWBUF* errmsgbuf,
if (m_current_master && m_current_master->in_use() && m_current_master == backend) if (m_current_master && m_current_master->in_use() && m_current_master == backend)
{ {
MXS_INFO("Master '%s' failed", backend->name()); MXS_INFO("Master '%s' failed: %s", backend->name(), extract_error(errmsgbuf).c_str());
/** The connection to the master has failed */ /** The connection to the master has failed */
if (!backend->is_waiting_result()) if (!backend->is_waiting_result())
@ -1066,7 +1066,7 @@ void RWSplitSession::handleError(GWBUF* errmsgbuf,
} }
else else
{ {
MXS_INFO("Slave '%s' failed", backend->name()); MXS_INFO("Slave '%s' failed: %s", backend->name(), extract_error(errmsgbuf).c_str());
if (m_target_node && m_target_node == backend if (m_target_node && m_target_node == backend
&& session_trx_is_read_only(problem_dcb->session)) && session_trx_is_read_only(problem_dcb->session))
{ {