mirror of
https://github.com/MariaDB/server.git
synced 2025-08-26 01:44:06 +03:00
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
83 lines
3.0 KiB
Plaintext
83 lines
3.0 KiB
Plaintext
#
|
|
# Test of MERGE tables with multisession and many waits.
|
|
#
|
|
# This test takes rather long time so let us run it only in --big-test mode
|
|
--source include/big_test.inc
|
|
# We use some debug-only features in this test
|
|
--source include/have_debug.inc
|
|
# We use INFORMATION_SCHEMA.PROCESSLIST in this test
|
|
--source include/not_embedded.inc
|
|
|
|
--disable_warnings
|
|
drop table if exists t1,t2,t3,t4,t5,t6;
|
|
--enable_warnings
|
|
|
|
--echo #
|
|
--echo # Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE
|
|
--echo # corrupts a MERGE table
|
|
--echo # Problem #3
|
|
--echo #
|
|
# Two FLUSH TABLES within a LOCK TABLES segment could invalidate the lock.
|
|
# This did *not* require a MERGE table.
|
|
#
|
|
# To increase reproducibility it was necessary to enter a sleep of 2
|
|
# seconds at the end of wait_for_tables() after unlock of LOCK_open. In
|
|
# 5.0 and 5.1 the sleep must be inserted in open_and_lock_tables() after
|
|
# open_tables() instead. wait_for_tables() is not used in this case. The
|
|
# problem was that FLUSH TABLES releases LOCK_open while having unlocked
|
|
# and closed all tables. When this happened while a thread was in the
|
|
# loop in mysql_lock_tables() right after wait_for_tables()
|
|
# (open_tables()) and before retrying to lock, the thread got the lock.
|
|
# And it did not notice that the table needed a refresh after the
|
|
# [re-]open. So it executed its statement on the table.
|
|
#
|
|
# The first FLUSH TABLES kicked the INSERT out of thr_multi_lock() and
|
|
# let it wait in wait_for_tables() (open_table()). The second FLUSH
|
|
# TABLES must happen while the INSERT was on its way from
|
|
# wait_for_tables() (open_table()) to the next call of thr_multi_lock().
|
|
# This needed to be supported by a sleep to make it repeatable.
|
|
#
|
|
CREATE TABLE t1 (c1 INT) ENGINE= MyISAM;
|
|
LOCK TABLE t1 WRITE;
|
|
#SELECT NOW();
|
|
--echo # connection con1
|
|
connect (con1,localhost,root,,);
|
|
let $con1_id= `SELECT CONNECTION_ID()`;
|
|
SET GLOBAL debug="+d,sleep_open_and_lock_after_open";
|
|
send INSERT INTO t1 VALUES (1);
|
|
--echo # connection default
|
|
connection default;
|
|
--echo # Let INSERT go into thr_multi_lock().
|
|
#--sleep 8
|
|
#SELECT ID,STATE,INFO FROM INFORMATION_SCHEMA.PROCESSLIST;
|
|
let $wait_condition= SELECT 1 FROM INFORMATION_SCHEMA.PROCESSLIST
|
|
WHERE ID = $con1_id AND STATE = 'Locked';
|
|
--source include/wait_condition.inc
|
|
#SELECT NOW();
|
|
--echo # Kick INSERT out of thr_multi_lock().
|
|
FLUSH TABLES;
|
|
#SELECT NOW();
|
|
--echo # Let INSERT go through open_tables() where it sleeps.
|
|
#--sleep 8
|
|
#SELECT ID,STATE,INFO FROM INFORMATION_SCHEMA.PROCESSLIST;
|
|
let $wait_condition= SELECT 1 FROM INFORMATION_SCHEMA.PROCESSLIST
|
|
WHERE ID = $con1_id AND STATE = 'Waiting for table';
|
|
--source include/wait_condition.inc
|
|
#SELECT NOW();
|
|
--echo # Unlock and close table and wait for con1 to close too.
|
|
FLUSH TABLES;
|
|
#SELECT NOW();
|
|
--echo # This should give no result.
|
|
SELECT * FROM t1;
|
|
#SELECT NOW();
|
|
UNLOCK TABLES;
|
|
--echo # connection con1
|
|
connection con1;
|
|
reap;
|
|
SET GLOBAL debug="-d,sleep_open_and_lock_after_open";
|
|
disconnect con1;
|
|
--echo # connection default
|
|
connection default;
|
|
DROP TABLE t1;
|
|
|