summaryrefslogtreecommitdiff
path: root/sql-common
diff options
context:
space:
mode:
authorArun Kuruvila <arun.kuruvila@oracle.com>2014-11-10 16:21:59 +0530
committerArun Kuruvila <arun.kuruvila@oracle.com>2014-11-10 16:21:59 +0530
commita9b61b0029713c3b567ca33be50ad5b2a44045fb (patch)
treece3e102fd7943609a5802b3e2339a0d0b223e038 /sql-common
parent5a59bf7a8af7f8f8a45c98d6e7315ce081ee8f56 (diff)
downloadmariadb-git-a9b61b0029713c3b567ca33be50ad5b2a44045fb.tar.gz
Bug#17599258:- ERROR 1160 (08S01): GOT AN ERROR WRITING
COMMUNICATION PACKETS; FEDERATED TABLE Description:- Execution of FLUSH TABLES on a federated table which has been idle for wait_timeout (on the remote server) + tcp_keepalive_time, fails with an error, "ERROR 1160 (08S01): Got an error writing communication packets." Analysis:- During FLUSH TABLE execution the federated table is closed which will inturn close the federated connection. While closing the connection, federated server tries to communincate with the remote server. Since the connection was idle for wait_timeout(on the remote server)+ tcp_keepalive_time, the socket gets closed. So this communication fails because of broken pipe and the error is thrown. But federated connections are expected to reconnect silently. And also it cannot reconnect because the "auto_reconnect" variable is set to 0 in "mysql_close()". Fix:- Before closing the federated connection, in "ha_federated_close()", a check is added which will verify wheather the connection is alive or not. If the connection is not alive, then "mysql->net.error" is set to 2 which will indicate that the connetion is broken. Also the setting of "auto_reconnect" variable to 0 is delayed and is done after "COM_QUIT" command. NOTE:- For reproducing this issue, "tcp_keepalive_time" has to be set to a smaller value. This value is set in the "/proc/sys/net/ipv4/tcp_keepalive_time" file in Unix systems. So we need root permission for changing it, which can't be done through mtr test. So submitting the patch without mtr test.
Diffstat (limited to 'sql-common')
-rw-r--r--sql-common/client.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sql-common/client.c b/sql-common/client.c
index 850daa38750..c874086fc9c 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -3808,8 +3808,8 @@ void STDCALL mysql_close(MYSQL *mysql)
{
free_old_query(mysql);
mysql->status=MYSQL_STATUS_READY; /* Force command */
- mysql->reconnect=0;
simple_command(mysql,COM_QUIT,(uchar*) 0,0,1);
+ mysql->reconnect=0;
end_server(mysql); /* Sets mysql->net.vio= 0 */
}
mysql_close_free_options(mysql);