Add verbose backend status helper
This allows the same verbose information to be logged in the cases where it is of use. Mostly this information can be used to figure out why a certain session was closed.
This commit is contained in:
@ -591,16 +591,9 @@ bool RWSplitSession::route_session_write(GWBUF* querybuf, uint8_t command, uint3
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::string status;
|
MXS_ERROR("Could not route session command: %s. Connection status: %s",
|
||||||
for (const auto& a : m_backends)
|
|
||||||
{
|
|
||||||
status += "\n";
|
|
||||||
status += a->get_verbose_status();
|
|
||||||
}
|
|
||||||
|
|
||||||
MXS_ERROR("Could not route session command: %s. Connection information: %s",
|
|
||||||
attempted_write ? "Write to all backends failed" : "All connections have failed",
|
attempted_write ? "Write to all backends failed" : "All connections have failed",
|
||||||
status.c_str());
|
get_verbose_status().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
return nsucc;
|
return nsucc;
|
||||||
@ -739,7 +732,7 @@ SRWBackend RWSplitSession::get_master_backend()
|
|||||||
{
|
{
|
||||||
MXS_ERROR("Cannot choose server '%s' as the master because it is not "
|
MXS_ERROR("Cannot choose server '%s' as the master because it is not "
|
||||||
"in use and a new connection to it cannot be created. Connection status: %s",
|
"in use and a new connection to it cannot be created. Connection status: %s",
|
||||||
master->name(), master->get_verbose_status().c_str());
|
master->name(), get_verbose_status().c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1182,6 +1182,7 @@ bool RWSplitSession::handle_error_new_connection(DCB* backend_dcb, GWBUF* errmsg
|
|||||||
MXS_ERROR("Unable to continue session as all connections have failed and "
|
MXS_ERROR("Unable to continue session as all connections have failed and "
|
||||||
"new connections cannot be created. Last server to fail was '%s'.",
|
"new connections cannot be created. Last server to fail was '%s'.",
|
||||||
backend->name());
|
backend->name());
|
||||||
|
MXS_INFO("Connection status: %s", get_verbose_status().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
return ok;
|
return ok;
|
||||||
|
@ -301,6 +301,19 @@ private:
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string get_verbose_status()
|
||||||
|
{
|
||||||
|
std::string status;
|
||||||
|
|
||||||
|
for (const auto& a : m_backends)
|
||||||
|
{
|
||||||
|
status += "\n";
|
||||||
|
status += a->get_verbose_status();
|
||||||
|
}
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
inline bool is_large_query(GWBUF* buf)
|
inline bool is_large_query(GWBUF* buf)
|
||||||
{
|
{
|
||||||
uint32_t buflen = gwbuf_length(buf);
|
uint32_t buflen = gwbuf_length(buf);
|
||||||
|
Reference in New Issue
Block a user