MXS-2144: Treat server shutdown as a network error

If the server where a query is being executed is shutting down,
readwritesplit should treat it as an error to make retrying of the query
possible.

By treating server shutdowns as network errors, the same code path that is
used for actual network errors can be taken. This removes the need for any
extra retrying logic for this particular case.
This commit is contained in:
Markus Mäkelä
2018-11-13 17:20:50 +02:00
parent 37d38593d5
commit cab8a4bde8
3 changed files with 38 additions and 0 deletions

View File

@ -1171,6 +1171,21 @@ bool mxs_mysql_is_err_packet(GWBUF* buffer)
return cmd == MYSQL_REPLY_ERR;
}
uint16_t mxs_mysql_get_mysql_errno(GWBUF* buffer)
{
uint16_t rval = 0;
if (mxs_mysql_is_err_packet(buffer))
{
uint8_t buf[2];
// First two bytes after the 0xff byte are the error code
gwbuf_copy_data(buffer, MYSQL_HEADER_LEN + 1, 2, buf);
rval = gw_mysql_get_byte2(buf);
}
return rval;
}
bool mxs_mysql_is_result_set(GWBUF* buffer)
{
bool rval = false;