summaryrefslogtreecommitdiff
path: root/sql-common
diff options
context:
space:
mode:
authorunknown <konstantin@mysql.com>2005-03-06 00:10:08 +0300
committerunknown <konstantin@mysql.com>2005-03-06 00:10:08 +0300
commite904d0e750c9624981444b6dff7ee62186e82fd9 (patch)
tree431745f4c1466da5a5fa719302ab3a443eb8f819 /sql-common
parent18f16edff75ed64fb8c726a5f912cbaf8a09fe2c (diff)
downloadmariadb-git-e904d0e750c9624981444b6dff7ee62186e82fd9.tar.gz
Porting of "buffered read" patch to 5.0 and post-review fixes.
The patch implements the idea suggested by Olaf van der Spek in thread "Client: many small reads?" (internals@lists.mysql.com). Now small reads performed by the client library are buffered. The buffering gives up to 2 times speedup when retrieving one-column tables. BUILD/SETUP.sh: Remove --with-vio option which no longer exist. BUILD/compile-pentium64-valgrind-max: Remove --with-vio option which no longer exist. config/ac-macros/misc.m4: Removed --with-vio configure switch: we always use VIO. The switch, in fact, only saved us one pointer dereferencing per call in case we had only one transport type in VIO enabled. config/ac-macros/openssl.m4: Removed HAVE_VIO. include/config-win.h: Removed HAVE_VIO (not needed anymore) Added HAVE_VIO_READ_BUFF (define buffered client reads for Windows clients). include/violite.h: Removed HAVE_VIO, as currently VIO is always in use. Added declaration for vio_read_buff and related members in struct VIO. sql-common/client.c: Use flags to set up vio read buffering in mysql_real_connect. sql/mysqld.cc: Use flags to disable vio read buffering when creating a server connection. vio/vio.c: Optionally set up vio read buffer when creating a new VIO structure. vio/viosocket.c: Implementation of client-side buffered reads in VIO: the idea is to buffer small reads in a client buffer to save amount of syscalls per retrieved result set. The implementation relies on the fact that read/recv will return as soon as there is some data in the kernel buffer, no matter how big the given user's buffer is. To be able to disable it in case recv/read don't have such semantics, the new calls are guarded with #define HAVE_VIO_READ_BUFF. Currently buffered reading is switched on only for BSD sockets and named pipes, both on Windows and UNIXes.
Diffstat (limited to 'sql-common')
-rw-r--r--sql-common/client.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sql-common/client.c b/sql-common/client.c
index aece4230fe0..2c73cb4d07c 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -1681,7 +1681,8 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
ER(net->last_errno),socket_errno);
goto error;
}
- net->vio = vio_new(sock, VIO_TYPE_SOCKET, TRUE);
+ net->vio= vio_new(sock, VIO_TYPE_SOCKET,
+ VIO_LOCALHOST | VIO_BUFFERED_READ);
bzero((char*) &UNIXaddr,sizeof(UNIXaddr));
UNIXaddr.sun_family = AF_UNIX;
strmake(UNIXaddr.sun_path, unix_socket, sizeof(UNIXaddr.sun_path)-1);
@@ -1756,7 +1757,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
ER(net->last_errno),socket_errno);
goto error;
}
- net->vio = vio_new(sock,VIO_TYPE_TCPIP,FALSE);
+ net->vio= vio_new(sock, VIO_TYPE_TCPIP, VIO_BUFFERED_READ);
bzero((char*) &sock_addr,sizeof(sock_addr));
sock_addr.sin_family = AF_INET;