diff options
author | unknown <knielsen@knielsen-hq.org> | 2009-03-18 16:46:32 +0100 |
---|---|---|
committer | unknown <knielsen@knielsen-hq.org> | 2009-03-18 16:46:32 +0100 |
commit | ce956c8f2d851712a90d304458016221cc74130d (patch) | |
tree | ecfb8205b243f3984a3085cb2b9c1d8ba1e5ef26 /mysql-test/t | |
parent | 2611d3c002df6b37250a996752398c7262d6d8a3 (diff) | |
download | mariadb-git-ce956c8f2d851712a90d304458016221cc74130d.tar.gz |
Add testing of extra port for pool-of-threads.
The additional test uses up all threads in the pool with SELECT
SLEEP(), and tests that this makes normal connections block, but
connections on the extra port still work.
Also test connection limit on extra port with and without
pool-of-threads enabled.
Add --connect-timeout option to mysqltest program.
Add facility for --extra-port option to ConfigFactory.
Fix regexp typo in ConfigFactory.pm
Diffstat (limited to 'mysql-test/t')
-rw-r--r-- | mysql-test/t/connect.cnf | 8 | ||||
-rw-r--r-- | mysql-test/t/connect.test | 27 | ||||
-rw-r--r-- | mysql-test/t/pool_of_threads-master.opt | 1 | ||||
-rw-r--r-- | mysql-test/t/pool_of_threads.cnf | 14 | ||||
-rw-r--r-- | mysql-test/t/pool_of_threads.test | 75 |
5 files changed, 124 insertions, 1 deletions
diff --git a/mysql-test/t/connect.cnf b/mysql-test/t/connect.cnf new file mode 100644 index 00000000000..6c52a4b144d --- /dev/null +++ b/mysql-test/t/connect.cnf @@ -0,0 +1,8 @@ +!include include/default_my.cnf + +[mysqld.1] +extra-port= @mysqld.1.#extra-port +extra-max-connections=1 + +[ENV] +MASTER_EXTRA_PORT= @mysqld.1.extra-port diff --git a/mysql-test/t/connect.test b/mysql-test/t/connect.test index 0893bf9ad18..ce352046cba 100644 --- a/mysql-test/t/connect.test +++ b/mysql-test/t/connect.test @@ -288,6 +288,33 @@ let $wait_condition = --echo # -- End of Bug#35074. --echo +# Test connections to the extra port. + +connect(extracon,127.0.0.1,root,,test,$MASTER_EXTRA_PORT,); +connection extracon; +SELECT 'Connection on extra port ok'; + +connect(extracon2,127.0.0.1,root,,test,$MASTER_EXTRA_PORT,); +connection extracon2; +SELECT 'Connection on extra port 2 ok'; + +--disable_abort_on_error +--disable_result_log +--disable_query_log +connect(extracon3,127.0.0.1,root,,test,$MASTER_EXTRA_PORT,); +--enable_query_log +--enable_result_log +--enable_abort_on_error +let $error = $mysql_errno; +if (!$error) +{ + --echo # -- Error: managed to establish more than --extra-max-connections + 1 connections +} +if ($error) +{ + --echo # -- Success: more than --extra-max-connections + 1 normal connections not possible +} + --echo # ------------------------------------------------------------------ --echo # -- End of 5.1 tests --echo # ------------------------------------------------------------------ diff --git a/mysql-test/t/pool_of_threads-master.opt b/mysql-test/t/pool_of_threads-master.opt deleted file mode 100644 index f9ff28a98e9..00000000000 --- a/mysql-test/t/pool_of_threads-master.opt +++ /dev/null @@ -1 +0,0 @@ ---test-ignore-wrong-options --thread-handling=pool-of-threads diff --git a/mysql-test/t/pool_of_threads.cnf b/mysql-test/t/pool_of_threads.cnf new file mode 100644 index 00000000000..4ad94ab69d9 --- /dev/null +++ b/mysql-test/t/pool_of_threads.cnf @@ -0,0 +1,14 @@ +!include include/default_my.cnf + +[mysqld.1] +test-ignore-wrong-options +thread-handling= pool-of-threads +thread_pool_size= 2 +extra-port= @mysqld.1.#extra-port +extra-max-connections=1 + +[client] +connect-timeout= 2 + +[ENV] +MASTER_EXTRA_PORT= @mysqld.1.extra-port diff --git a/mysql-test/t/pool_of_threads.test b/mysql-test/t/pool_of_threads.test index 5978bab8eaa..7ddb003f6df 100644 --- a/mysql-test/t/pool_of_threads.test +++ b/mysql-test/t/pool_of_threads.test @@ -5,3 +5,78 @@ -- source include/common-tests.inc + +# Test that we cannot have more simultaneous connections than +# --thread-pool-size on the standard port, but _can_ have additional +# connections on the extra port. + +# First set two connections running, and check that extra connection +# on normal port fails due to--thread-pool-size=2 +connection default; +send SELECT sleep(5); + +connect(con2,localhost,root,,); +connection con2; +send SELECT sleep(5); +--sleep 1 + +--disable_abort_on_error +--disable_result_log +--disable_query_log +connect(con3,localhost,root,,); +--enable_query_log +--enable_result_log +--enable_abort_on_error +let $error = $mysql_errno; +if (!$error) +{ + --echo # -- Error: managed to establish more than --thread-pool-size connections +} +if ($error) +{ + --echo # -- Success: more than --thread-pool-size normal connections not possible +} + +connection default; +--reap +connection con2; +--reap + +# Now try again, but this time use the extra port to successfully connect. + +connection default; +send SELECT sleep(5); + +connection con2; +send SELECT sleep(5); +--sleep 1 + +connect(extracon,127.0.0.1,root,,test,$MASTER_EXTRA_PORT,); +connection extracon; +SELECT 'Connection on extra port ok'; + +connect(extracon2,127.0.0.1,root,,test,$MASTER_EXTRA_PORT,); +connection extracon2; +SELECT 'Connection on extra port 2 ok'; + +--disable_abort_on_error +--disable_result_log +--disable_query_log +connect(extracon3,127.0.0.1,root,,test,$MASTER_EXTRA_PORT,); +--enable_query_log +--enable_result_log +--enable_abort_on_error +let $error = $mysql_errno; +if (!$error) +{ + --echo # -- Error: managed to establish more than --extra-max-connections + 1 connections +} +if ($error) +{ + --echo # -- Success: more than --extra-max-connections + 1 normal connections not possible +} + +connection default; +--reap +connection con2; +--reap |