From 4fe342500953e9cf337aae462fb512a7cec176f8 Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Fri, 13 Mar 2009 00:27:35 +0200 Subject: Added "pool-of-threads" handling (with libevent) This is a backport of code from MySQL 6.0 with cleanups and extensions The following new options are supported configure options: --with-libevent ; Enable use of libevent, which is needed for pool of threads mysqld options: --thread-handling=pool-of-threads ; Use a pool of threads to handle queries --thread-pool-size=# ; Define how many threads should be created to handle all queries --extra-port=# ; Extra tcp port that uses the old one-thread-per-connection method --extra-max-connections=# ; Number of connections to accept to 'extra-port' --test-ignore-wrong-options ; Ignore setting an enum value to a wrong option (for mysql-test-run) BUILD/SETUP.sh: Added libevents (and thus pool-of-threads) to max builds CMakeLists.txt: Added libevent Makefile.am: Added libevents config/ac-macros/libevent.m4: Libevent code for configure config/ac-macros/libevent_configure.m4: Libevent code for configure configure.in: Added libevents dbug/dbug.c: Added _db_is_pushed(); Needed for pool-of-threads code extra/Makefile.am: Added libevents extra/libevent: Libevent initial code extra/libevent/CMakeLists.txt: Libevent initial code extra/libevent/Makefile.am: Libevent initial code extra/libevent/README: Libevent initial code extra/libevent/WIN32-Code: Libevent initial code extra/libevent/WIN32-Code/config.h: Libevent initial code extra/libevent/WIN32-Code/misc.c: Libevent initial code extra/libevent/WIN32-Code/misc.h: Libevent initial code extra/libevent/WIN32-Code/tree.h: Libevent initial code extra/libevent/WIN32-Code/win32.c: Libevent initial code extra/libevent/buffer.c: Libevent initial code extra/libevent/compat: Libevent initial code extra/libevent/compat/sys: Libevent initial code extra/libevent/compat/sys/_time.h: Libevent initial code extra/libevent/compat/sys/queue.h: Libevent initial code extra/libevent/compat/sys/tree.h: Libevent initial code extra/libevent/devpoll.c: Libevent initial code extra/libevent/epoll.c: Libevent initial code extra/libevent/epoll_sub.c: Libevent initial code extra/libevent/evbuffer.c: Libevent initial code extra/libevent/evdns.c: Libevent initial code extra/libevent/evdns.h: Libevent initial code extra/libevent/event-config.h: Libevent initial code extra/libevent/event-internal.h: Libevent initial code extra/libevent/event.c: Libevent initial code extra/libevent/event.h: Libevent initial code extra/libevent/event_tagging.c: Libevent initial code extra/libevent/evhttp.h: Libevent initial code extra/libevent/evport.c: Libevent initial code extra/libevent/evrpc-internal.h: Libevent initial code extra/libevent/evrpc.c: Libevent initial code extra/libevent/evrpc.h: Libevent initial code extra/libevent/evsignal.h: Libevent initial code extra/libevent/evutil.c: Libevent initial code extra/libevent/evutil.h: Libevent initial code extra/libevent/http-internal.h: Libevent initial code extra/libevent/http.c: Libevent initial code extra/libevent/kqueue.c: Libevent initial code extra/libevent/log.c: Libevent initial code extra/libevent/log.h: Libevent initial code extra/libevent/min_heap.h: Libevent initial code extra/libevent/poll.c: Libevent initial code extra/libevent/select.c: Libevent initial code extra/libevent/signal.c: Libevent initial code extra/libevent/strlcpy-internal.h: Libevent initial code extra/libevent/strlcpy.c: Libevent initial code include/config-win.h: Libevent support include/my_dbug.h: ADded _db_is_pushed include/mysql.h.pp: Update to handle new prototypes include/typelib.h: Split find_type_or_exit() into two functions include/violite.h: Added vio_is_pending() libmysqld/Makefile.am: Added libevent mysql-test/include/have_pool_of_threads.inc: Added test for pool-of-threads mysql-test/mysql-test-run.pl: Don't abort based on time and don't retry test cases when run under --gdb or --debug mysql-test/r/crash_commit_before.result: USE GLOBAL for debug variable mysql-test/r/have_pool_of_threads.require: Added test for pool-of-threads mysql-test/r/pool_of_threads.result: Added test for pool-of-threads mysql-test/r/subselect_debug.result: USE GLOBAL for debug variable mysql-test/t/crash_commit_before.test: USE GLOBAL for debug variable mysql-test/t/merge-big.test: USE GLOBAL for debug variable mysql-test/t/pool_of_threads-master.opt: Added test for pool-of-threads mysql-test/t/pool_of_threads.test: Added test for pool-of-threads mysys/typelib.c: Split find_type_or_exit() into find_type_with_warning() sql/Makefile.am: Added libevent sql/handler.cc: Indentation fix. Fixed memory loss bug Fixed crash on exit when handler plugin failed sql/mysql_priv.h: Added extra_max_connections and mysqld_extra_port Added extern functions from sql_connect.cc sql/mysqld.cc: Added support for new mysqld options Added code for 'extra-port' and 'extra-max-connections' Split some functions into smaller pieces to be able to reuse code Added code for test-ignore-wrong-options sql/scheduler.cc: Updated schduler code from MySQL 6.0 sql/scheduler.h: Updated schduler code from MySQL 6.0 sql/set_var.cc: Added support for changing "extra_max_connections" sql/sql_class.cc: Iniitalize thread schduler options in THD sql/sql_class.h: Added to extra_port and scheduler to 'THD' sql/sql_connect.cc: Use thd->schduler to check number of connections and terminate connection Made some local functions global (for scheduler.cc) vio/viosocket.c: Added 'vio_pending', needed for scheduler..c --- vio/viosocket.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'vio') diff --git a/vio/viosocket.c b/vio/viosocket.c index 942f0330c57..f0cf5c50055 100644 --- a/vio/viosocket.c +++ b/vio/viosocket.c @@ -637,3 +637,21 @@ int vio_close_shared_memory(Vio * vio) } #endif /* HAVE_SMEM */ #endif /* __WIN__ */ + + +/** + Number of bytes in the read buffer. + + @return number of bytes in the read buffer or < 0 if error. +*/ + +ssize_t vio_pending(Vio *vio) +{ + if (vio->read_pos < vio->read_end) + return vio->read_end - vio->read_pos; +#ifdef HAVE_OPENSSL + if (vio->ssl_arg) + return SSL_pending((SSL*) vio->ssl_arg); +#endif + return 0; +} -- cgit v1.2.1 From d210e5fde6ea98e4d7363868e34733ab1c6cf00f Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Thu, 24 Sep 2009 23:42:43 -0700 Subject: Took care of mysql test suite failures on Windows. mysql-test/suite/rpl/t/rpl_binlog_corruption.test: Disabled the test for Windows (see bug #47639) mysql-test/suite/rpl/t/rpl_killed_ddl.test: Disabled the test for Windows (see bug #47638) vio/viosocket.c: Added an implementation of vio_poll_read for Windows. Winsock does not support the poll function. So the existing generic implementation of vio_poll_read could not be used for Windows. --- vio/viosocket.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'vio') diff --git a/vio/viosocket.c b/vio/viosocket.c index 4c6cc428c52..fead2ca7c1c 100644 --- a/vio/viosocket.c +++ b/vio/viosocket.c @@ -361,7 +361,20 @@ void vio_in_addr(Vio *vio, struct in_addr *in) my_bool vio_poll_read(Vio *vio,uint timeout) { #ifndef HAVE_POLL +#if __WIN__ + int res; + struct fd_set fds; + struct timeval tv; + DBUG_ENTER("vio_poll"); + fds.fd_count= 1; + fds.fd_array[0]= vio->sd; + tv.tv_sec= timeout; + tv.tv_usec= 0; + res= select(1, &fds, NULL, NULL, &tv) ? 0 : 1; + DBUG_RETURN(res); +#else return 0; +#endif #else struct pollfd fds; int res; -- cgit v1.2.1 From 961821d7aee482fcf4edb57a98fe9a2d580200ec Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 6 Dec 2009 18:34:54 +0100 Subject: Fix some compiler warnings. Fix bad merge causing error when specifying test case in non-default suite for mysql-test-run. Implement the ability to add extra flags and configure options when running BUILD/xxx scripts. Improve unclear help text in mysql-test-run BUILD/FINISH.sh: Implement the ability to add extra flags and configure options when running BUILD/xxx scripts. BUILD/SETUP.sh: Implement the ability to add extra flags and configure options when running BUILD/xxx scripts. extra/yassl/taocrypt/include/block.hpp: Fix some compiler warnings. mysql-test/lib/mtr_cases.pm: Fix bad merge causing error when specifying test case in non-default suite for mysql-test-run. Also remove some non-essential differences to mysql version to simplify future merges. mysql-test/mysql-test-run.pl: Improve help texts. plugin/fulltext/plugin_example.c: Fix some compiler warnings. vio/viosslfactories.c: Fix some compiler warnings. --- vio/viosslfactories.c | 1 - 1 file changed, 1 deletion(-) (limited to 'vio') diff --git a/vio/viosslfactories.c b/vio/viosslfactories.c index 51d049b18b9..d0a0a69f70b 100644 --- a/vio/viosslfactories.c +++ b/vio/viosslfactories.c @@ -19,7 +19,6 @@ static my_bool ssl_algorithms_added = FALSE; static my_bool ssl_error_strings_loaded= FALSE; -static int verify_depth = 0; static unsigned char dh512_p[]= { -- cgit v1.2.1 From 3e32ba3ff1068c19dbf0c69de991da426cf7f327 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 10 Mar 2010 11:32:14 +0100 Subject: Fix some compiler warnings seen in Buildbot. Add some extra error output and code cleanup in an attempt to fix/debug a rare random testsuite problem in check_warnings, where the exit code from mysqltest is somehow corrupted inside mysql-test-run.pl. include/my_global.h: Fix compiler warnings on some platforms. mysql-test/lib/My/SafeProcess.pm: Move dereference of $? subprocess exit code closer to where it is generated, to make the code more robust and on the chance that this will fix the occasional problems in check_warnings we see in Buildbot. mysql-test/mysql-test-run.pl: When check_warnings failed, also log the mysqld server for which it failed. sql/sql_lex.cc: Fix compiler warning about possibly uninitialised value, by rewriting a for() loop that is always executed at least once into a do .. while() loop with an assert. sql/table.cc: Fix compiler warning about uninitialised value. storage/federatedx/ha_federatedx.cc: Fix uninitialised variable. storage/maria/ma_delete.c: Fix compiler warning about uninitialised value. storage/maria/ma_loghandler.c: Fix compiler warning about uninitialised value. storage/myisam/ft_stopwords.c: Fix compiler warning. storage/myisam/mi_write.c: Fix compiler warning about possibly uninitialised value, by rewriting a while() loop that is always executed at least once into a do .. while() loop with an assert. storage/xtradb/btr/btr0cur.c: Fix compiler warning about possibly uninitialised value. support-files/compiler_warnings.supp: Fix warning suppression to cover all cases in yassl. vio/viossl.c: Fix compiler warning. --- vio/viossl.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'vio') diff --git a/vio/viossl.c b/vio/viossl.c index c7449c7feb2..61e4d9406a7 100644 --- a/vio/viossl.c +++ b/vio/viossl.c @@ -75,9 +75,11 @@ report_errors(SSL* ssl) if (ssl) { +#ifndef DBUG_OFF int error= SSL_get_error(ssl, l); DBUG_PRINT("error", ("error: %s (%d)", ERR_error_string(error, buf), error)); +#endif } DBUG_PRINT("info", ("socket_errno: %d", socket_errno)); -- cgit v1.2.1