summaryrefslogtreecommitdiff
path: root/sql/protocol.cc
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2016-08-21 20:38:47 +0300
committerMonty <monty@mariadb.org>2016-08-21 20:38:47 +0300
commit5932fa789043fad1602a5ebb335adf4e7c860cdf (patch)
tree9a278b5cc085391c49fbd033dd5396a4a073fa78 /sql/protocol.cc
parent6f31dd093a245a21a69fd990f947611a5dcfb77b (diff)
downloadmariadb-git-5932fa789043fad1602a5ebb335adf4e7c860cdf.tar.gz
Fixed "Packets out of order" warning message on stdout in clients,
compiled for debugging, when the server goes down This happens in the following scenario: - Server gets a shutdown message - Servers sends error ER_CONNECTION_KILLED to the clients connection - The client sends a query to the server, before the server has time to close the connection to the client - Client reads the ER_CONNECTION_KILLED error message In the above case, the packet number for the reply is one less than what the client expected and the client prints "Packets out of order". Fixed the following way: - The client accepts now error packages with a packet number one less than expected. - To ensure that this issue can be detected early in my_real_read(), error messages sent to the client are not compressed, even when compressed protocol is used.
Diffstat (limited to 'sql/protocol.cc')
-rw-r--r--sql/protocol.cc15
1 files changed, 12 insertions, 3 deletions
diff --git a/sql/protocol.cc b/sql/protocol.cc
index c1614f4e7e4..777f124f502 100644
--- a/sql/protocol.cc
+++ b/sql/protocol.cc
@@ -373,7 +373,8 @@ bool net_send_error_packet(THD *thd, uint sql_errno, const char *err,
uint error;
char converted_err[MYSQL_ERRMSG_SIZE];
char buff[2+1+SQLSTATE_LENGTH+MYSQL_ERRMSG_SIZE], *pos;
-
+ my_bool ret;
+ uint8 save_compress;
DBUG_ENTER("send_error_packet");
if (net->vio == 0)
@@ -401,8 +402,16 @@ bool net_send_error_packet(THD *thd, uint sql_errno, const char *err,
/* Converted error message is always null-terminated. */
length= (uint) (strmake(pos, converted_err, MYSQL_ERRMSG_SIZE - 1) - buff);
- DBUG_RETURN(net_write_command(net,(uchar) 255, (uchar*) "", 0, (uchar*) buff,
- length));
+ /*
+ Ensure that errors are not compressed. This is to ensure we can
+ detect out of bands error messages in the client
+ */
+ if ((save_compress= net->compress))
+ net->compress= 2;
+ ret= net_write_command(net,(uchar) 255, (uchar*) "", 0, (uchar*) buff,
+ length);
+ net->compress= save_compress;
+ DBUG_RETURN(ret);
}
#endif /* EMBEDDED_LIBRARY */