Add result set buffering to MySQLBackend

The backend MySQL protocol module now supports a new routing capability
which allows result sets to be gathered into one buffer before they are
routed onward. This should not be used by modules that expect large
result sets as the result set is buffered in memory.

Adding a limit on how large of a result set could be buffered would allow
relatively safe use of this routing capability without compromising the
stability of the system.
This commit is contained in:
Markus Makela
2016-12-11 12:24:25 +02:00
parent d543ecb483
commit 106f482f45
5 changed files with 52 additions and 3 deletions

View File

@ -1559,3 +1559,31 @@ bool mxs_mysql_is_ok_packet(GWBUF *buffer)
return rval;
}
bool mxs_mysql_is_result_set(GWBUF *buffer)
{
bool rval = false;
uint8_t cmd;
if (gwbuf_copy_data(buffer, MYSQL_HEADER_LEN, 1, &cmd))
{
switch (cmd)
{
case MYSQL_REPLY_OK:
case MYSQL_REPLY_ERR:
case MYSQL_REPLY_LOCAL_INFILE:
case MYSQL_REPLY_EOF:
/** Not a result set */
break;
default:
if (gwbuf_copy_data(buffer, MYSQL_HEADER_LEN + 1, 1, &cmd) && cmd > 1)
{
rval = true;
}
break;
}
}
return rval;
}