MXS-3106: Always write the final COM_QUIT
This seems to help with a regression that was introduced in 2.4.11.
This commit is contained in:
@ -206,6 +206,11 @@ struct DCB : public MXB_POLL_DATA
|
|||||||
bool high_water_reached = false; /** High water mark reached, to determine whether we need to
|
bool high_water_reached = false; /** High water mark reached, to determine whether we need to
|
||||||
* release
|
* release
|
||||||
* throttle */
|
* throttle */
|
||||||
|
|
||||||
|
// Enable this to prevent write errors from being logged. Helps reduce false errors when writes to
|
||||||
|
// potentially closed DCBs are done.
|
||||||
|
bool silence_write_errors = false;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
DCB* next = nullptr; /**< Next DCB in owning thread's list */
|
DCB* next = nullptr; /**< Next DCB in owning thread's list */
|
||||||
|
@ -340,7 +340,6 @@ typedef struct
|
|||||||
bool collect_result; /*< Collect the next result set as one buffer */
|
bool collect_result; /*< Collect the next result set as one buffer */
|
||||||
bool changing_user;
|
bool changing_user;
|
||||||
bool track_state; /*< Track session state */
|
bool track_state; /*< Track session state */
|
||||||
bool send_com_quit;
|
|
||||||
uint32_t num_eof_packets; /*< Encountered eof packet number, used for check
|
uint32_t num_eof_packets; /*< Encountered eof packet number, used for check
|
||||||
* packet type */
|
* packet type */
|
||||||
bool large_query; /*< Whether to ignore the command byte of the next
|
bool large_query; /*< Whether to ignore the command byte of the next
|
||||||
|
@ -822,7 +822,7 @@ static int dcb_log_errors_SSL(DCB* dcb, int ret)
|
|||||||
unsigned long ssl_errno;
|
unsigned long ssl_errno;
|
||||||
|
|
||||||
ssl_errno = ERR_get_error();
|
ssl_errno = ERR_get_error();
|
||||||
if (0 == ssl_errno)
|
if (0 == ssl_errno || dcb->silence_write_errors)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1806,7 +1806,8 @@ static int gw_write(DCB* dcb, GWBUF* writeq, bool* stop_writing)
|
|||||||
if (written < 0)
|
if (written < 0)
|
||||||
{
|
{
|
||||||
*stop_writing = true;
|
*stop_writing = true;
|
||||||
if (saved_errno != EAGAIN && saved_errno != EWOULDBLOCK && saved_errno != EPIPE)
|
if (saved_errno != EAGAIN && saved_errno != EWOULDBLOCK && saved_errno != EPIPE
|
||||||
|
&& !dcb->silence_write_errors)
|
||||||
{
|
{
|
||||||
MXS_ERROR("Write to %s %s in state %s failed: %d, %s",
|
MXS_ERROR("Write to %s %s in state %s failed: %d, %s",
|
||||||
dcb->type(),
|
dcb->type(),
|
||||||
|
@ -1291,12 +1291,6 @@ static int gw_MySQLWrite_backend(DCB* dcb, GWBUF* queue)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
if (cmd == MXS_COM_QUIT)
|
|
||||||
{
|
|
||||||
backend_protocol->send_com_quit = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GWBUF_IS_IGNORABLE(queue))
|
if (GWBUF_IS_IGNORABLE(queue))
|
||||||
{
|
{
|
||||||
/** The response to this command should be ignored */
|
/** The response to this command should be ignored */
|
||||||
@ -1409,11 +1403,9 @@ static int gw_backend_close(DCB* dcb)
|
|||||||
mxb_assert(dcb->session || dcb->persistentstart);
|
mxb_assert(dcb->session || dcb->persistentstart);
|
||||||
MySQLProtocol* proto = (MySQLProtocol*)dcb->protocol;
|
MySQLProtocol* proto = (MySQLProtocol*)dcb->protocol;
|
||||||
|
|
||||||
if (proto->send_com_quit && proto->protocol_auth_state == MXS_AUTH_STATE_COMPLETE)
|
// Always send a COM_QUIT to the backend being closed. This causes the connection to be closed faster.
|
||||||
{
|
dcb->silence_write_errors = true;
|
||||||
// Send a COM_QUIT to the backend being closed, we haven't routed one to it yet.
|
dcb_write(dcb, mysql_create_com_quit(NULL, 0));
|
||||||
dcb_write(dcb, mysql_create_com_quit(NULL, 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Free protocol data */
|
/** Free protocol data */
|
||||||
mysql_protocol_done(dcb);
|
mysql_protocol_done(dcb);
|
||||||
|
@ -64,7 +64,6 @@ MySQLProtocol* mysql_protocol_init(DCB* dcb, int fd)
|
|||||||
p->num_eof_packets = 0;
|
p->num_eof_packets = 0;
|
||||||
p->large_query = false;
|
p->large_query = false;
|
||||||
p->track_state = false;
|
p->track_state = false;
|
||||||
p->send_com_quit = true;
|
|
||||||
/*< Assign fd with protocol */
|
/*< Assign fd with protocol */
|
||||||
p->fd = fd;
|
p->fd = fd;
|
||||||
p->owner_dcb = dcb;
|
p->owner_dcb = dcb;
|
||||||
|
Reference in New Issue
Block a user