Fix OK packet status extraction in readwritesplit

As the row count and last insert ID are length-encoded integers, they need
to be handled with the correct functions.
This commit is contained in:
Markus Mäkelä 2017-10-09 13:38:12 +03:00 committed by Johan Wikman
parent 36dfcd4319
commit c70e1431e3

View File

@ -30,6 +30,7 @@
#include <maxscale/query_classifier.h>
#include <maxscale/router.h>
#include <maxscale/spinlock.h>
#include <maxscale/mysql_utils.h>
#include "rwsplit_internal.hh"
#include "rwsplitsession.hh"
@ -531,7 +532,13 @@ static inline bool more_results_exist(GWBUF* buffer)
{
ss_dassert(is_eof(buffer, gw_mysql_get_byte3(GWBUF_DATA(buffer))) ||
mxs_mysql_is_ok_packet(buffer));
uint16_t status = gw_mysql_get_byte2(GWBUF_DATA(buffer) + MYSQL_HEADER_LEN + 1 + 2);
ss_dassert(GWBUF_IS_CONTIGUOUS(buffer));
uint8_t* ptr = GWBUF_DATA(buffer) + MYSQL_HEADER_LEN + 1;
ptr += mxs_leint_bytes(ptr);
ptr += mxs_leint_bytes(ptr);
uint16_t status = gw_mysql_get_byte2(ptr);
return status & SERVER_MORE_RESULTS_EXIST;
}