List:Commits« Previous MessageNext Message »
From:msvensson Date:April 30 2007 9:47am
Subject:bk commit into 5.0 tree (msvensson:1.2456) BUG#26664
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of msvensson. When msvensson 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@stripped, 2007-04-30 11:47:11+02:00, msvensson@stripped +10 -0
  Bug#26664 test suite times out on OS X 64bit
   - The "mysql client in mysqld"(which is used by
     replication and federated) should use alarms instead of setting
     socket timeout value if the rest of the server uses alarm. By
     always calling 'net_set_write_timeout'
     or 'net_set_read_timeout' when changing the timeout value(s), the
     selection whether to use alarms or timeouts will be handled by
     ifdef's in those two functions. 
   - Move declaration of 'vio_timeout' into "vio_priv.h"

  include/mysql_com.h@stripped, 2007-04-30 11:47:10+02:00, msvensson@stripped +3 -0
    Move the net_set_*_timeout function declarations to mysql_com.h

  include/violite.h@stripped, 2007-04-30 11:47:10+02:00, msvensson@stripped +0 -1
    Move declaration of 'vio_timeout' to vio_priv.h (to make
    the function as private as possible)

  libmysql/libmysql.c@stripped, 2007-04-30 11:47:10+02:00, msvensson@stripped +2 -4
    Use net_read_timeout or net_write_timeout when setting the timeouts
    Move the global variables for net_read/write_timeout
    into the only place where they are used. Thus removing them...

  server-tools/instance-manager/mysql_connection.cc@stripped, 2007-04-30 11:47:10+02:00, msvensson@stripped +2 -2
    Use net_read_timeout or net_write_timeout when setting the timeouts

  sql-common/client.c@stripped, 2007-04-30 11:47:10+02:00, msvensson@stripped +2 -4
    Use net_read_timeout or net_write_timeout when setting the timeouts

  sql/mysql_priv.h@stripped, 2007-04-30 11:47:10+02:00, msvensson@stripped +0 -3
    Move the net_set_*_timeout function declarations to mysql_com.h

  sql/net_serv.cc@stripped, 2007-04-30 11:47:10+02:00, msvensson@stripped +2 -2
    No need to cast the net->write_timeout value from "uint" to "uint"

  sql/sql_client.cc@stripped, 2007-04-30 11:47:10+02:00, msvensson@stripped +4 -2
    Use net_read_timeout or net_write_timeout when setting the timeouts

  vio/vio_priv.h@stripped, 2007-04-30 11:47:10+02:00, msvensson@stripped +1 -0
    Move declaration of 'vio_timeout' to vio_priv.h

  vio/viosocket.c@stripped, 2007-04-30 11:47:10+02:00, msvensson@stripped +24 -12
    Cleanup 'vio_timeout'
     - Use "const void*" on POSIX and "const char*" on windows for
       setsockopt
     - Add DBUG_PRINT's
     - Add comment about why we don't have an implementation of
      vio_timeout for platforms not supporting SO_SNDTIMEO or SO_RCVTIMEO  

# 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:	msvensson
# Host:	pilot.blaudden
# Root:	/home/msvensson/mysql/bug26664/my50-bug26664

--- 1.112/include/mysql_com.h	2006-12-23 20:04:05 +01:00
+++ 1.113/include/mysql_com.h	2007-04-30 11:47:10 +02:00
@@ -345,6 +345,9 @@ my_bool	net_write_command(NET *net,unsig
 int	net_real_write(NET *net,const char *packet,unsigned long len);
 unsigned long my_net_read(NET *net);
 
+void net_set_write_timeout(NET *net, uint timeout);
+void net_set_read_timeout(NET *net, uint timeout);
+
 /*
   The following function is not meant for normal usage
   Currently it's used internally by manager.c

--- 1.50/include/violite.h	2007-03-28 15:34:51 +02:00
+++ 1.51/include/violite.h	2007-04-30 11:47:10 +02:00
@@ -88,7 +88,6 @@ my_bool	vio_peer_addr(Vio* vio, char *bu
 /* Remotes in_addr */
 void	vio_in_addr(Vio *vio, struct in_addr *in);
 my_bool	vio_poll_read(Vio *vio,uint timeout);
-void	vio_timeout(Vio *vio,uint which, uint timeout);
 
 #ifdef HAVE_OPENSSL
 #include <openssl/opensslv.h>

--- 1.254/libmysql/libmysql.c	2007-03-06 23:35:58 +01:00
+++ 1.255/libmysql/libmysql.c	2007-04-30 11:47:10 +02:00
@@ -67,8 +67,6 @@
 
 ulong 		net_buffer_length=8192;
 ulong		max_allowed_packet= 1024L*1024L*1024L;
-ulong		net_read_timeout=  CLIENT_NET_READ_TIMEOUT;
-ulong		net_write_timeout= CLIENT_NET_WRITE_TIMEOUT;
 
 
 #ifdef EMBEDDED_LIBRARY
@@ -1528,8 +1526,8 @@ my_bool STDCALL mysql_embedded(void)
 void my_net_local_init(NET *net)
 {
   net->max_packet=   (uint) net_buffer_length;
-  net->read_timeout= (uint) net_read_timeout;
-  net->write_timeout=(uint) net_write_timeout;
+  net_set_read_timeout(net, CLIENT_NET_READ_TIMEOUT);
+  net_set_write_timeout(net, CLIENT_NET_WRITE_TIMEOUT);
   net->retry_count=  1;
   net->max_packet_size= max(net_buffer_length, max_allowed_packet);
 }

--- 1.441/sql/mysql_priv.h	2007-04-05 08:29:08 +02:00
+++ 1.442/sql/mysql_priv.h	2007-04-30 11:47:10 +02:00
@@ -89,9 +89,6 @@ void kill_one_thread(THD *thd, ulong id,
 bool net_request_file(NET* net, const char* fname);
 char* query_table_status(THD *thd,const char *db,const char *table_name);
 
-void net_set_write_timeout(NET *net, uint timeout);
-void net_set_read_timeout(NET *net, uint timeout);
-
 #define x_free(A)	{ my_free((gptr) (A),MYF(MY_WME | MY_FAE | MY_ALLOW_ZERO_PTR)); }
 #define safeFree(x)	{ if(x) { my_free((gptr) x,MYF(0)); x = NULL; } }
 #define PREV_BITS(type,A)	((type) (((type) 1 << (A)) -1))

--- 1.99/sql/net_serv.cc	2007-02-21 12:05:01 +01:00
+++ 1.100/sql/net_serv.cc	2007-04-30 11:47:10 +02:00
@@ -609,7 +609,7 @@ net_real_write(NET *net,const char *pack
 #ifndef NO_ALARM
   thr_alarm_init(&alarmed);
   if (net_blocking)
-    thr_alarm(&alarmed,(uint) net->write_timeout,&alarm_buff);
+    thr_alarm(&alarmed, net->write_timeout, &alarm_buff);
 #else
   alarmed=0;
   /* Write timeout is set in net_set_write_timeout */
@@ -624,7 +624,7 @@ net_real_write(NET *net,const char *pack
 #if (!defined(__WIN__) && !defined(__EMX__) && !defined(OS2))
       if ((interrupted || length==0) && !thr_alarm_in_use(&alarmed))
       {
-        if (!thr_alarm(&alarmed,(uint) net->write_timeout,&alarm_buff))
+        if (!thr_alarm(&alarmed, net->write_timeout, &alarm_buff))
         {                                       /* Always true for client */
 	  my_bool old_mode;
 	  while (vio_blocking(net->vio, TRUE, &old_mode) < 0)

--- 1.111/sql-common/client.c	2007-03-27 19:26:00 +02:00
+++ 1.112/sql-common/client.c	2007-04-30 11:47:10 +02:00
@@ -2047,13 +2047,11 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,cons
 
   /* If user set read_timeout, let it override the default */
   if (mysql->options.read_timeout)
-    net->read_timeout= mysql->options.read_timeout;
-  vio_timeout(net->vio, 0, net->read_timeout);
+    net_set_read_timeout(net, mysql->options.read_timeout);
 
   /* If user set write_timeout, let it override the default */
   if (mysql->options.write_timeout)
-    net->write_timeout= mysql->options.write_timeout;
-  vio_timeout(net->vio, 1, net->write_timeout);
+    net_set_write_timeout(net, mysql->options.write_timeout);
 
   if (mysql->options.max_allowed_packet)
     net->max_packet_size= mysql->options.max_allowed_packet;

--- 1.8/sql/sql_client.cc	2006-12-30 21:02:07 +01:00
+++ 1.9/sql/sql_client.cc	2007-04-30 11:47:10 +02:00
@@ -28,8 +28,10 @@ void my_net_local_init(NET *net)
 {
 #ifndef EMBEDDED_LIBRARY
   net->max_packet=   (uint) global_system_variables.net_buffer_length;
-  net->read_timeout= (uint) global_system_variables.net_read_timeout;
-  net->write_timeout=(uint) global_system_variables.net_write_timeout;
+
+  net_set_read_timeout(net, (uint)global_system_variables.net_read_timeout);
+  net_set_write_timeout(net, (uint)global_system_variables.net_write_timeout);
+
   net->retry_count=  (uint) global_system_variables.net_retry_count;
   net->max_packet_size= max(global_system_variables.net_buffer_length,
 			    global_system_variables.max_allowed_packet);

--- 1.8/vio/vio_priv.h	2007-01-26 11:30:51 +01:00
+++ 1.9/vio/vio_priv.h	2007-04-30 11:47:10 +02:00
@@ -23,6 +23,7 @@
 #include <violite.h>
 
 void	vio_ignore_timeout(Vio *vio, uint which, uint timeout);
+void	vio_timeout(Vio *vio,uint which, uint timeout);
 
 #ifdef HAVE_OPENSSL
 #include "my_net.h"			/* needed because of struct in_addr */

--- 1.19/server-tools/instance-manager/mysql_connection.cc	2007-02-22 15:59:54 +01:00
+++ 1.20/server-tools/instance-manager/mysql_connection.cc	2007-04-30 11:47:10 +02:00
@@ -112,8 +112,8 @@ C_MODE_START
 void my_net_local_init(NET *net)
 {
   net->max_packet= net_buffer_length;
-  net->read_timeout= net_read_timeout;
-  net->write_timeout= net_write_timeout;
+  net_set_read_timeout(net, (uint)net_read_timeout);
+  net_set_write_timeout(net, (uint)net_write_timeout);
   net->retry_count= net_retry_count;
   net->max_packet_size= max_allowed_packet;
 }

--- 1.44/vio/viosocket.c	2006-12-23 20:04:31 +01:00
+++ 1.45/vio/viosocket.c	2007-04-30 11:47:10 +02:00
@@ -380,28 +380,40 @@ my_bool vio_poll_read(Vio *vio,uint time
 
 void vio_timeout(Vio *vio, uint which, uint timeout)
 {
-/* TODO: some action should be taken if socket timeouts are not supported. */
 #if defined(SO_SNDTIMEO) && defined(SO_RCVTIMEO)
+  int r;
+  DBUG_ENTER("vio_timeout");
 
+  {
 #ifdef __WIN__
 
-  /* Windows expects time in milliseconds as int. */
+  /* Windows expects time in milliseconds as int */
   int wait_timeout= (int) timeout * 1000;
-
-#else  /* ! __WIN__ */
+  r= setsockopt(vio->sd, SOL_SOCKET, which ? SO_SNDTIMEO : SO_RCVTIMEO,
+                (const char*)&wait_timeout, sizeof(wait_timeout));
+#else
 
   /* POSIX specifies time as struct timeval. */
   struct timeval wait_timeout;
   wait_timeout.tv_sec= timeout;
   wait_timeout.tv_usec= 0;
-
-#endif /* ! __WIN__ */
-
-  /* TODO: return value should be checked. */
-  (void) setsockopt(vio->sd, SOL_SOCKET, which ? SO_SNDTIMEO : SO_RCVTIMEO,
-                    (char*) &wait_timeout, sizeof(wait_timeout));
-
-#endif /* defined(SO_SNDTIMEO) && defined(SO_RCVTIMEO) */
+  r= setsockopt(vio->sd, SOL_SOCKET, which ? SO_SNDTIMEO : SO_RCVTIMEO,
+                (const void*)&wait_timeout, sizeof(wait_timeout));
+#endif
+  }
+
+#ifndef DBUG_OFF
+  if (r != 0)
+    DBUG_PRINT("error", ("setsockopt failed: %d, errno: %d", r, socket_errno));
+#endif
+
+  DBUG_VOID_RETURN;
+#else
+/*
+  Platforms not suporting setting of socket timeout should either use
+  thr_alarm or just run without read/write timeout(s)
+*/
+#endif
 }
 
 
Thread
bk commit into 5.0 tree (msvensson:1.2456) BUG#26664msvensson30 Apr