Merge branch '2.2' into develop
This commit is contained in:
@ -1276,8 +1276,6 @@ static void clientReply(MXS_ROUTER *instance,
|
||||
*/
|
||||
if (backend->session_command_count())
|
||||
{
|
||||
check_session_command_reply(writebuf, backend);
|
||||
|
||||
/** This discards all responses that have already been sent to the client */
|
||||
bool rconn = false;
|
||||
process_sescmd_response(rses, backend, &writebuf, &rconn);
|
||||
|
||||
@ -283,34 +283,6 @@ void closed_session_reply(GWBUF *querybuf)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Uses MySQL specific mechanisms
|
||||
*/
|
||||
/**
|
||||
* @brief Check the reply from a backend server to a session command
|
||||
*
|
||||
* If the reply is an error, a message is logged.
|
||||
*
|
||||
* @param buffer Query buffer containing reply data
|
||||
* @param backend Router session data for a backend server
|
||||
*/
|
||||
void check_session_command_reply(GWBUF *buffer, SRWBackend& backend)
|
||||
{
|
||||
if (MYSQL_IS_ERROR_PACKET(((uint8_t *)GWBUF_DATA(buffer))))
|
||||
{
|
||||
size_t replylen = MYSQL_GET_PAYLOAD_LEN(GWBUF_DATA(buffer));
|
||||
char replybuf[replylen];
|
||||
gwbuf_copy_data(buffer, 0, gwbuf_length(buffer), (uint8_t*)replybuf);
|
||||
std::string err;
|
||||
std::string msg;
|
||||
err.append(replybuf + 8, 5);
|
||||
msg.append(replybuf + 13, replylen - 4 - 5);
|
||||
|
||||
MXS_ERROR("Failed to execute session command in %s. Error was: %s %s",
|
||||
backend->uri(), err.c_str(), msg.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Send an error message to the client telling that the server is in read only mode
|
||||
*
|
||||
|
||||
@ -1045,11 +1045,17 @@ static void log_master_routing_failure(RWSplitSession *rses, bool found,
|
||||
sprintf(errmsg, "Session is in read-only mode because it was created "
|
||||
"when no master was available");
|
||||
}
|
||||
else if (old_master && !old_master->in_use())
|
||||
{
|
||||
sprintf(errmsg, "Was supposed to route to master but the master connection is %s",
|
||||
old_master->is_closed() ? "closed" : "not in a suitable state");
|
||||
ss_dassert(old_master->is_closed());
|
||||
}
|
||||
else
|
||||
{
|
||||
ss_dassert(false); // A session should always have a master reference
|
||||
sprintf(errmsg, "Was supposed to route to master but couldn't "
|
||||
"find master in a suitable state");
|
||||
"find original master connection");
|
||||
ss_dassert(!true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -76,9 +76,10 @@ void process_sescmd_response(RWSplitSession* rses, SRWBackend& backend,
|
||||
|
||||
if (rses->sescmd_responses[id] != cmd)
|
||||
{
|
||||
MXS_ERROR("Slave server '%s': response differs from master's response. "
|
||||
"Closing connection due to inconsistent session state.",
|
||||
backend->name());
|
||||
MXS_WARNING("Slave server '%s': response (0x%02hhx) differs "
|
||||
"from master's response(0x%02hhx). Closing slave "
|
||||
"connection due to inconsistent session state.",
|
||||
backend->name(), cmd, rses->sescmd_responses[id]);
|
||||
backend->close(mxs::Backend::CLOSE_FATAL);
|
||||
*pReconnect = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user