Dump queue contents on unexpectedly NULL buffer

When the query queue does not contain a complete packet
(i.e. modutil_get_next_MySQL_packet return NULL), an informative dump of
how many bytes and what is stored is logged.
This commit is contained in:
Markus Mäkelä
2018-07-23 13:00:02 +03:00
parent ea5c5f3a07
commit 4b7cd7a281
3 changed files with 14 additions and 5 deletions

View File

@ -473,6 +473,14 @@ static bool route_stored_query(RWSplitSession *rses)
query_queue = gwbuf_make_contiguous(query_queue);
ss_dassert(query_queue);
if (query_queue == NULL)
{
MXS_ALERT("Queued query unexpectedly empty. Bytes queued: %d Hexdump: ",
gwbuf_length(rses->query_queue));
gwbuf_hexdump(rses->query_queue, LOG_ALERT);
return true;
}
/** Store the query queue locally for the duration of the routeQuery call.
* This prevents recursive calls into this function. */
GWBUF *temp_storage = rses->query_queue;