dcb.c
dcb_write, if write failed, gwbuf wasn't freed. mysql_backend.c gw_MySQLWrite_backend, if dcb wasn'r in POLLING state then write was skpiped but gwbuf wasn't freed. mysql_client.c gw_MySQLWrite_client, disabled the use of dcb_write because it returns different values than the code it replaced. Also removed erroneous call of gwbuf_consume. mysql_common.c mysql_send_custom_error, removed erroneous call of gwbuf_free.
This commit is contained in:
@ -751,6 +751,7 @@ int w, saved_errno = 0;
|
|||||||
|
|
||||||
if (queue && (saved_errno != EAGAIN || saved_errno != EWOULDBLOCK))
|
if (queue && (saved_errno != EAGAIN || saved_errno != EWOULDBLOCK))
|
||||||
{
|
{
|
||||||
|
queue = gwbuf_consume(queue, gwbuf_length(queue));
|
||||||
skygw_log_write_flush(
|
skygw_log_write_flush(
|
||||||
LOGFILE_ERROR,
|
LOGFILE_ERROR,
|
||||||
"Error : Writing to %s socket failed due %d, %s.",
|
"Error : Writing to %s socket failed due %d, %s.",
|
||||||
|
|||||||
@ -472,6 +472,9 @@ gw_MySQLWrite_backend(DCB *dcb, GWBUF *queue)
|
|||||||
* Don't write to backend if backend_dcb is not in poll set anymore.
|
* Don't write to backend if backend_dcb is not in poll set anymore.
|
||||||
*/
|
*/
|
||||||
if (dcb->state != DCB_STATE_POLLING) {
|
if (dcb->state != DCB_STATE_POLLING) {
|
||||||
|
/** Free buffer memory */
|
||||||
|
gwbuf_consume(queue, GWBUF_LENGTH(queue));
|
||||||
|
|
||||||
skygw_log_write_flush(
|
skygw_log_write_flush(
|
||||||
LOGFILE_ERROR,
|
LOGFILE_ERROR,
|
||||||
"%lu [gw_MySQLWrite_backend] Write to backend failed. "
|
"%lu [gw_MySQLWrite_backend] Write to backend failed. "
|
||||||
|
|||||||
@ -433,7 +433,7 @@ static int gw_mysql_do_authentication(DCB *dcb, GWBUF *queue) {
|
|||||||
int
|
int
|
||||||
gw_MySQLWrite_client(DCB *dcb, GWBUF *queue)
|
gw_MySQLWrite_client(DCB *dcb, GWBUF *queue)
|
||||||
{
|
{
|
||||||
#if 1
|
#if 0
|
||||||
return dcb_write(dcb, queue);
|
return dcb_write(dcb, queue);
|
||||||
#else
|
#else
|
||||||
int w, saved_errno = 0;
|
int w, saved_errno = 0;
|
||||||
@ -762,8 +762,6 @@ int gw_read_client_event(DCB* dcb) {
|
|||||||
protocol->state = MYSQL_IDLE;
|
protocol->state = MYSQL_IDLE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/** Free buffer */
|
|
||||||
queue = gwbuf_consume(queue, len);
|
|
||||||
goto return_rc;
|
goto return_rc;
|
||||||
} /* MYSQL_IDLE */
|
} /* MYSQL_IDLE */
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -805,7 +805,6 @@ mysql_send_custom_error (DCB *dcb, int packet_number, int in_affected_rows, cons
|
|||||||
// writing data in the Client buffer queue
|
// writing data in the Client buffer queue
|
||||||
dcb->func.write(dcb, buf);
|
dcb->func.write(dcb, buf);
|
||||||
|
|
||||||
gwbuf_free(buf);
|
|
||||||
return sizeof(mysql_packet_header) + mysql_payload_size;
|
return sizeof(mysql_packet_header) + mysql_payload_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user