List:Internals« Previous MessageNext Message »
From:sergeyv Date:August 30 2005 5:19pm
Subject:bk commit into 4.0 tree (SergeyV:1.2140) BUG#5588
View as plain text  
Below is the list of changes that have just been committed into a local
4.0 repository of sergeyv. When sergeyv does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2140 05/08/30 19:19:28 SergeyV@selena. +6 -0
  Fixes bug #5588. vio_was_interrupted() function was added to detect
  read timeout properly on win32.

  vio/viosocket.c
    1.22 05/08/30 19:19:24 SergeyV@selena. +9 -0
    Added vio_was_interrupted function that returns true if operation was
    not completed due to timeout.

  vio/vio.c
    1.16 05/08/30 19:19:24 SergeyV@selena. +2 -0
    added initialization code for vio_was_interrupted() function.

  sql/net_serv.cc
    1.64 05/08/30 19:19:23 SergeyV@selena. +1 -1
    net->last_errno should be equal to ER_NET_READ_INTERRUPTED in case if read
    operation was not completed due to timeout.

  sql/mini_client.cc
    1.62 05/08/30 19:19:23 SergeyV@selena. +1 -1
    added a check that replication read was not completed due to timeout.

  include/violite.h
    1.33 05/08/30 19:19:23 SergeyV@selena. +4 -0
    Added vio_was_interrupted function that returns true if operation was
    not completed due to timeout.

  include/my_global.h
    1.73 05/08/30 19:19:23 SergeyV@selena. +3 -0
    Added win32 specific socket timeout error code.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	SergeyV
# Host:	selena.
# Root:	H:/MYSQL/src/#05588-mysql-4.0

--- 1.32/include/violite.h	2004-06-17 15:01:52 +04:00
+++ 1.33/include/violite.h	2005-08-30 19:19:23 +04:00
@@ -62,6 +62,8 @@
 int	vio_keepalive(Vio *vio, my_bool	onoff);
 /* Whenever we should retry the last read/write operation. */
 my_bool	vio_should_retry(Vio *vio);
+/* Check that operation was timed out */
+my_bool	vio_was_interrupted(Vio *vio);
 /* Short text description of the socket for those, who are curious.. */
 const char* vio_description(Vio *vio);
 /* Return the type of the connection */
@@ -134,6 +136,7 @@
 #define vio_fastsend(vio)			(vio)->fastsend(vio)
 #define vio_keepalive(vio, set_keep_alive)	(vio)->viokeepalive(vio, set_keep_alive)
 #define vio_should_retry(vio) 			(vio)->should_retry(vio)
+#define vio_was_interrupted(vio) 		(vio)->was_interrupted(vio)
 #define vio_close(vio)				((vio)->vioclose)(vio)
 #define vio_peer_addr(vio, buf, prt)		(vio)->peer_addr(vio, buf, prt)
 #define vio_in_addr(vio, in)			(vio)->in_addr(vio, in)
@@ -175,6 +178,7 @@
   my_bool (*peer_addr)(Vio*, char *, uint16*);
   void    (*in_addr)(Vio*, struct in_addr*);
   my_bool (*should_retry)(Vio*);
+  my_bool (*was_interrupted)(Vio*);
   int     (*vioclose)(Vio*);
   void	  (*timeout)(Vio*, unsigned int timeout);
   void	  *ssl_arg;

--- 1.61/sql/mini_client.cc	2004-02-19 23:04:29 +03:00
+++ 1.62/sql/mini_client.cc	2005-08-30 19:19:23 +04:00
@@ -399,7 +399,7 @@
   {
     DBUG_PRINT("error",("Wrong connection or packet. fd: %s  len: %d",
 			vio_description(net->vio),len));
-    if (socket_errno != SOCKET_EINTR)
+    if (!vio_was_interrupted(net->vio))
     {
       mc_end_server(mysql);
       if (net->last_errno != ER_NET_PACKET_TOO_LARGE)

--- 1.63/sql/net_serv.cc	2005-03-04 13:07:54 +03:00
+++ 1.64/sql/net_serv.cc	2005-08-30 19:19:23 +04:00
@@ -700,7 +700,7 @@
 	  len= packet_error;
 	  net->error=2;				/* Close socket */
 #ifdef MYSQL_SERVER
-	  net->last_errno= (interrupted ? ER_NET_READ_INTERRUPTED :
+	  net->last_errno= (vio_was_interrupted(net->vio) ? ER_NET_READ_INTERRUPTED :
 			    ER_NET_READ_ERROR);
 #endif
 	  goto end;

--- 1.72/include/my_global.h	2005-06-08 20:07:23 +04:00
+++ 1.73/include/my_global.h	2005-08-30 19:19:23 +04:00
@@ -760,6 +760,7 @@
 #define socket_errno	WSAGetLastError()
 #define SOCKET_EINTR	WSAEINTR
 #define SOCKET_EAGAIN	WSAEINPROGRESS
+#define SOCKET_ETIMEDOUT WSAETIMEDOUT
 #define SOCKET_EWOULDBLOCK WSAEINPROGRESS
 #define SOCKET_ENFILE	ENFILE
 #define SOCKET_EMFILE	EMFILE
@@ -767,6 +768,7 @@
 #define socket_errno	sock_errno()
 #define SOCKET_EINTR	SOCEINTR
 #define SOCKET_EAGAIN	SOCEINPROGRESS
+#define SOCKET_ETIMEDOUT SOCKET_EINTR
 #define SOCKET_EWOULDBLOCK SOCEWOULDBLOCK
 #define SOCKET_ENFILE	SOCENFILE
 #define SOCKET_EMFILE	SOCEMFILE
@@ -776,6 +778,7 @@
 #define closesocket(A)	close(A)
 #define SOCKET_EINTR	EINTR
 #define SOCKET_EAGAIN	EAGAIN
+#define SOCKET_ETIMEDOUT SOCKET_EINTR
 #define SOCKET_EWOULDBLOCK EWOULDBLOCK
 #define SOCKET_ENFILE	ENFILE
 #define SOCKET_EMFILE	EMFILE

--- 1.15/vio/vio.c	2003-08-27 03:51:37 +04:00
+++ 1.16/vio/vio.c	2005-08-30 19:19:24 +04:00
@@ -50,6 +50,7 @@
     vio->fastsend	=vio_ssl_fastsend;
     vio->viokeepalive	=vio_ssl_keepalive;
     vio->should_retry	=vio_ssl_should_retry;
+    vio->was_interrupted=vio_was_interrupted;
     vio->vioclose	=vio_ssl_close;
     vio->peer_addr	=vio_ssl_peer_addr;
     vio->in_addr	=vio_ssl_in_addr;
@@ -67,6 +68,7 @@
     vio->fastsend	=vio_fastsend;
     vio->viokeepalive	=vio_keepalive;
     vio->should_retry	=vio_should_retry;
+    vio->was_interrupted=vio_was_interrupted;
     vio->vioclose	=vio_close;
     vio->peer_addr	=vio_peer_addr;
     vio->in_addr	=vio_in_addr;

--- 1.21/vio/viosocket.c	2005-02-15 15:42:11 +03:00
+++ 1.22/vio/viosocket.c	2005-08-30 19:19:24 +04:00
@@ -216,6 +216,15 @@
 }
 
 
+my_bool
+vio_was_interrupted(Vio * vio __attribute__((unused)))
+{
+  int en = socket_errno;
+  return (en == SOCKET_EAGAIN || en == SOCKET_EINTR ||
+	  en == SOCKET_EWOULDBLOCK || en == SOCKET_ETIMEDOUT);
+}
+
+
 int vio_close(Vio * vio)
 {
   int r;
Thread
bk commit into 4.0 tree (SergeyV:1.2140) BUG#5588sergeyv30 Aug