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:
Markus Mäkelä
2019-01-14 13:14:20 +02:00
parent 8cef8b9472
commit 021d48f94c
4 changed files with 16 additions and 3 deletions

View File

@ -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());
}
}