Log low-level reason and idle time on master failure
If the connection to the master is lost, knowing what type of an error caused the call to handleError helps deduce what was the real reason for it. Logging the idle time of the connection helps detect when the wait_timeout of a connection is exceeded.
This commit is contained in:
@ -424,3 +424,12 @@ SRWBackendVector::iterator find_best_backend(SRWBackendVector& backends,
|
||||
* The following are implemented in rwsplit_tmp_table_multi.c
|
||||
*/
|
||||
void close_all_connections(mxs::SRWBackendList& backends);
|
||||
|
||||
/**
|
||||
* Utility function for extracting error messages from buffers
|
||||
*
|
||||
* @param buffer Buffer containing an error
|
||||
*
|
||||
* @return String representation of the error
|
||||
*/
|
||||
std::string extract_error(GWBUF* buffer);
|
||||
|
@ -29,7 +29,7 @@ using namespace maxscale;
|
||||
*/
|
||||
|
||||
|
||||
static std::string extract_error(GWBUF* buffer)
|
||||
std::string extract_error(GWBUF* buffer)
|
||||
{
|
||||
std::string rval;
|
||||
|
||||
|
@ -943,7 +943,10 @@ void RWSplitSession::handleError(GWBUF* errmsgbuf,
|
||||
}
|
||||
else
|
||||
{
|
||||
MXS_ERROR("Lost connection to the master server, closing session.%s", errmsg.c_str());
|
||||
int64_t idle = mxs_clock() - backend->dcb()->last_read;
|
||||
MXS_ERROR("Lost connection to the master server, closing session.%s "
|
||||
"Connection has been idle for %.1f seconds. Error caused by: %s",
|
||||
errmsg.c_str(), (float)idle / 10.f, extract_error(errmsgbuf).c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user