Below is the list of changes that have just been committed into a local
4.1 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-01-19 16:59:20+01:00, msvensson@neptunus.(none) +7 -0
Bug#22943 syscall pruning in libmysql
- Avoid calling 'setsockopt' too often by checking if the timeout value
has really changed before setting it.
- Remove 'vio_ssl_timeout' and use 'vio_timeout' also for SSL connections
include/violite.h@stripped, 2007-01-19 16:59:18+01:00, msvensson@neptunus.(none) +1 -0
Add variable for keeping track of current timeout value
sql-common/client.c@stripped, 2007-01-19 16:59:19+01:00, msvensson@neptunus.(none) +5 -1
Improve comments
sql/sql_parse.cc@stripped, 2007-01-19 16:59:19+01:00, msvensson@neptunus.(none) +13 -3
Improve comments
vio/vio.c@stripped, 2007-01-19 16:59:19+01:00, msvensson@neptunus.(none) +1 -1
Use 'vio_timeout' instead of the removed 'vio_ssl_timeout'
vio/vio_priv.h@stripped, 2007-01-19 16:59:19+01:00, msvensson@neptunus.(none) +0 -1
Remove 'vio_ssl_timeout' function
vio/viosocket.c@stripped, 2007-01-19 16:59:19+01:00, msvensson@neptunus.(none) +17 -10
Avoid calling 'setsockopt' too often by checking if timeout value has changed
vio/viossl.c@stripped, 2007-01-19 16:59:19+01:00, msvensson@neptunus.(none) +0 -12
Remove 'vio_ssl_timeout'
# 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: neptunus.(none)
# Root: /home/msvensson/mysql/bug22943/my41-bug22943
--- 1.41/include/violite.h 2007-01-19 16:59:25 +01:00
+++ 1.42/include/violite.h 2007-01-19 16:59:25 +01:00
@@ -207,6 +207,7 @@ struct st_vio
char *shared_memory_pos;
NET *net;
#endif /* HAVE_SMEM */
+ uint current_timeout[2];
#endif /* HAVE_VIO */
};
#endif /* vio_violite_h_ */
--- 1.488/sql/sql_parse.cc 2007-01-19 16:59:25 +01:00
+++ 1.489/sql/sql_parse.cc 2007-01-19 16:59:25 +01:00
@@ -1287,8 +1287,15 @@ bool do_command(THD *thd)
thd->lex->current_select= 0;
packet=0;
- old_timeout=net->read_timeout;
- // Wait max for 8 hours
+
+ /*
+ This thread will do a blocking read from the client which
+ will be interrupted when one of the following occurs:
+ - the next command is received from the client
+ - the connection is closed
+ - "net_wait_timeout" number of seconds has passed
+ */
+ old_timeout= net->read_timeout;
net->read_timeout=(uint) thd->variables.net_wait_timeout;
thd->clear_error(); // Clear error message
@@ -1318,7 +1325,10 @@ bool do_command(THD *thd)
vio_description(net->vio), command,
command_name[command]));
}
- net->read_timeout=old_timeout; // restore it
+
+ /* Restore read timeout value */
+ net->read_timeout= old_timeout;
+
/*
packet_length contains length of data, as it was stored in packet
header. In case of malformed header, packet_length can be zero.
--- 1.93/sql-common/client.c 2007-01-19 16:59:25 +01:00
+++ 1.94/sql-common/client.c 2007-01-19 16:59:25 +01:00
@@ -1879,11 +1879,15 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,cons
goto error;
}
vio_keepalive(net->vio,TRUE);
- /* Override local client variables */
+
+ /* If user set read_timeout, let it override the default */
if (mysql->options.read_timeout)
net->read_timeout= 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;
+
if (mysql->options.max_allowed_packet)
net->max_packet_size= mysql->options.max_allowed_packet;
--- 1.5/vio/vio_priv.h 2007-01-19 16:59:25 +01:00
+++ 1.6/vio/vio_priv.h 2007-01-19 16:59:25 +01:00
@@ -30,7 +30,6 @@ void vio_ignore_timeout(Vio *vio, uint w
int vio_ssl_read(Vio *vio,gptr buf, int size);
int vio_ssl_write(Vio *vio,const gptr buf,int size);
-void vio_ssl_timeout(Vio *vio, uint which, uint timeout);
/* setsockopt TCP_NODELAY at IPPROTO_TCP level, when possible. */
int vio_ssl_fastsend(Vio *vio);
--- 1.25/vio/vio.c 2007-01-19 16:59:25 +01:00
+++ 1.26/vio/vio.c 2007-01-19 16:59:25 +01:00
@@ -96,7 +96,7 @@ void vio_reset(Vio* vio, enum enum_vio_t
vio->in_addr =vio_ssl_in_addr;
vio->vioblocking =vio_ssl_blocking;
vio->is_blocking =vio_is_blocking;
- vio->timeout =vio_ssl_timeout;
+ vio->timeout =vio_timeout;
}
else /* default is VIO_TYPE_TCPIP */
#endif /* HAVE_OPENSSL */
--- 1.28/vio/viossl.c 2007-01-19 16:59:25 +01:00
+++ 1.29/vio/viossl.c 2007-01-19 16:59:25 +01:00
@@ -415,16 +415,4 @@ int vio_ssl_blocking(Vio * vio __attribu
return set_blocking_mode ? 0 : 1;
}
-
-void vio_ssl_timeout(Vio *vio __attribute__((unused)),
- uint which __attribute__((unused)),
- uint timeout __attribute__((unused)))
-{
-#ifdef __WIN__
- ulong wait_timeout= (ulong) timeout * 1000;
- (void) setsockopt(vio->sd, SOL_SOCKET,
- which ? SO_SNDTIMEO : SO_RCVTIMEO, (char*) &wait_timeout,
- sizeof(wait_timeout));
-#endif /* __WIN__ */
-}
#endif /* HAVE_OPENSSL */
--- 1.36/vio/viosocket.c 2007-01-19 16:59:25 +01:00
+++ 1.37/vio/viosocket.c 2007-01-19 16:59:25 +01:00
@@ -338,24 +338,31 @@ void vio_timeout(Vio *vio, uint which, u
/* TODO: some action should be taken if socket timeouts are not supported. */
#if defined(SO_SNDTIMEO) && defined(SO_RCVTIMEO)
+ /* Check if timeout value has changed */
+ DBUG_ASSERT(which == 0 || which == 1);
+ if (vio->current_timeout[which] == timeout)
+ return;
+ vio->current_timeout[which]= timeout;
+
+ {
#ifdef __WIN__
- /* Windows expects time in milliseconds as int. */
- int wait_timeout= (int) timeout * 1000;
+ /* Windows expects time in milliseconds as int. */
+ int wait_timeout= (int) timeout * 1000;
#else /* ! __WIN__ */
- /* POSIX specifies time as struct timeval. */
- struct timeval wait_timeout;
- wait_timeout.tv_sec= timeout;
- wait_timeout.tv_usec= 0;
+ /* 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));
-
+ /* 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) */
}
| Thread |
|---|
| • bk commit into 4.1 tree (msvensson:1.2554) BUG#22943 | msvensson | 19 Jan |