MXS-2564: Reconnect only when necessary

By doing the reconnection only when a new query arrives, we prevent the
excessive reconnecting that is done when a server's actual and monitored
states are in conflict.
This commit is contained in:
Markus Mäkelä
2019-09-19 13:18:06 +03:00
parent 40d05e8278
commit fd0c156655
2 changed files with 14 additions and 29 deletions

View File

@ -293,6 +293,14 @@ private:
return !m_config.disable_sescmd_history || m_recv_sescmd == 0;
}
inline bool have_open_connections() const
{
return std::any_of(
m_backends.begin(), m_backends.end(), [](const mxs::SRWBackend& b) {
return b->in_use();
});
}
inline bool is_large_query(GWBUF* buf)
{
uint32_t buflen = gwbuf_length(buf);