MXS-827: Add connection keepalive

The readwritesplit now sends COM_PING queries to backend servers that have
been idle for too long. The option is configured with the
`connection_keepalive` parameter.
This commit is contained in:
Markus Mäkelä
2017-03-24 05:22:25 +02:00
parent e3bae59e1a
commit 710012ac5d
10 changed files with 125 additions and 14 deletions

View File

@ -1321,3 +1321,26 @@ char* modutil_MySQL_bypass_whitespace(char* sql, size_t len)
return i;
}
bool modutil_ignorable_ping(DCB *dcb)
{
static uint8_t com_ping_packet[] =
{
0x01, 0x00, 0x00, 0x00, 0x0e
};
GWBUF *buf = gwbuf_alloc_and_load(sizeof(com_ping_packet), com_ping_packet);
bool rval = false;
if (buf)
{
gwbuf_set_type(buf, GWBUF_TYPE_IGNORABLE);
if (dcb->func.write(dcb, buf))
{
rval = true;
}
}
return rval;
}