diff options
13 files changed, 361 insertions, 18 deletions
diff --git a/mysql-test/include/mysqld--help.inc b/mysql-test/include/mysqld--help.inc index 107f80ba125..a037f255a3e 100644 --- a/mysql-test/include/mysqld--help.inc +++ b/mysql-test/include/mysqld--help.inc @@ -18,11 +18,11 @@ perl; # their paths may vary: @skipvars=qw/basedir open-files-limit general-log-file log plugin-dir log-slow-queries pid-file slow-query-log-file log-basename - datadir slave-load-tmpdir tmpdir socket/; + datadir slave-load-tmpdir tmpdir socket /; # Plugins which may or may not be there: @plugins=qw/innodb ndb archive blackhole federated partition ndbcluster feedback debug temp-pool ssl des-key-file - xtradb thread-concurrency super-large-pages mutex-deadlock-detector null-audit maria aria pbxt oqgraph sphinx/; + xtradb thread-concurrency super-large-pages mutex-deadlock-detector null-audit maria aria pbxt oqgraph sphinx thread-handling thread-pool/; # And substitute the content some environment variables with their # names: diff --git a/mysql-test/r/mysqld--help-notwin.result b/mysql-test/r/mysqld--help-notwin.result index 8bd84ea7049..dfadcea7769 100644 --- a/mysql-test/r/mysqld--help-notwin.result +++ b/mysql-test/r/mysqld--help-notwin.result @@ -813,9 +813,6 @@ The following options may be given as the first argument: (Defaults to on; use --skip-thread-alarm to disable.) --thread-cache-size=# How many threads we should keep in a cache for reuse - --thread-handling=name - Define threads usage for handling queries, one of - one-thread-per-connection, no-threads --thread-stack=# The stack size for each thread --time-format=name The TIME format (ignored) --timed-mutexes Specify whether to time mutexes (only InnoDB mutexes are @@ -956,7 +953,7 @@ lower-case-table-names 1 master-info-file master.info master-retry-count 86400 master-verify-checksum FALSE -max-allowed-packet 1048576 +max-allowed-packet 8388608 max-binlog-cache-size 18446744073709547520 max-binlog-dump-events 0 max-binlog-size 1073741824 @@ -968,7 +965,7 @@ max-error-count 64 max-heap-table-size 16777216 max-join-size 18446744073709551615 max-length-for-sort-data 1024 -max-long-data-size 1048576 +max-long-data-size 8388608 max-prepared-stmt-count 16382 max-relay-log-size 0 max-seeks-for-key 18446744073709551615 @@ -1087,7 +1084,6 @@ table-open-cache 400 tc-heuristic-recover COMMIT thread-alarm TRUE thread-cache-size 0 -thread-handling one-thread-per-connection thread-stack 294912 time-format %H:%i:%s timed-mutexes FALSE diff --git a/mysql-test/suite/sys_vars/r/thread_pool_idle_timeout_basic.result b/mysql-test/suite/sys_vars/r/thread_pool_idle_timeout_basic.result new file mode 100644 index 00000000000..8dedbd0f2d2 --- /dev/null +++ b/mysql-test/suite/sys_vars/r/thread_pool_idle_timeout_basic.result @@ -0,0 +1,47 @@ +SET @start_global_value = @@global.thread_pool_idle_timeout; +select @@global.thread_pool_idle_timeout; +@@global.thread_pool_idle_timeout +60 +select @@session.thread_pool_idle_timeout; +ERROR HY000: Variable 'thread_pool_idle_timeout' is a GLOBAL variable +show global variables like 'thread_pool_idle_timeout'; +Variable_name Value +thread_pool_idle_timeout 60 +show session variables like 'thread_pool_idle_timeout'; +Variable_name Value +thread_pool_idle_timeout 60 +select * from information_schema.global_variables where variable_name='thread_pool_idle_timeout'; +VARIABLE_NAME VARIABLE_VALUE +THREAD_POOL_IDLE_TIMEOUT 60 +select * from information_schema.session_variables where variable_name='thread_pool_idle_timeout'; +VARIABLE_NAME VARIABLE_VALUE +THREAD_POOL_IDLE_TIMEOUT 60 +set global thread_pool_idle_timeout=60; +select @@global.thread_pool_idle_timeout; +@@global.thread_pool_idle_timeout +60 +set global thread_pool_idle_timeout=4294967295; +select @@global.thread_pool_idle_timeout; +@@global.thread_pool_idle_timeout +4294967295 +set session thread_pool_idle_timeout=1; +ERROR HY000: Variable 'thread_pool_idle_timeout' is a GLOBAL variable and should be set with SET GLOBAL +set global thread_pool_idle_timeout=1.1; +ERROR 42000: Incorrect argument type to variable 'thread_pool_idle_timeout' +set global thread_pool_idle_timeout=1e1; +ERROR 42000: Incorrect argument type to variable 'thread_pool_idle_timeout' +set global thread_pool_idle_timeout="foo"; +ERROR 42000: Incorrect argument type to variable 'thread_pool_idle_timeout' +set global thread_pool_idle_timeout=-1; +Warnings: +Warning 1292 Truncated incorrect thread_pool_idle_timeout value: '-1' +select @@global.thread_pool_idle_timeout; +@@global.thread_pool_idle_timeout +1 +set global thread_pool_idle_timeout=10000000000; +Warnings: +Warning 1292 Truncated incorrect thread_pool_idle_timeout value: '10000000000' +select @@global.thread_pool_idle_timeout; +@@global.thread_pool_idle_timeout +4294967295 +SET @@global.thread_pool_idle_timeout = @start_global_value; diff --git a/mysql-test/suite/sys_vars/r/thread_pool_max_threads_basic.result b/mysql-test/suite/sys_vars/r/thread_pool_max_threads_basic.result new file mode 100644 index 00000000000..87dc4295c11 --- /dev/null +++ b/mysql-test/suite/sys_vars/r/thread_pool_max_threads_basic.result @@ -0,0 +1,47 @@ +SET @start_global_value = @@global.thread_pool_max_threads; +select @@global.thread_pool_max_threads; +@@global.thread_pool_max_threads +500 +select @@session.thread_pool_max_threads; +ERROR HY000: Variable 'thread_pool_max_threads' is a GLOBAL variable +show global variables like 'thread_pool_max_threads'; +Variable_name Value +thread_pool_max_threads 500 +show session variables like 'thread_pool_max_threads'; +Variable_name Value +thread_pool_max_threads 500 +select * from information_schema.global_variables where variable_name='thread_pool_max_threads'; +VARIABLE_NAME VARIABLE_VALUE +THREAD_POOL_MAX_THREADS 500 +select * from information_schema.session_variables where variable_name='thread_pool_max_threads'; +VARIABLE_NAME VARIABLE_VALUE +THREAD_POOL_MAX_THREADS 500 +set global thread_pool_max_threads=1; +select @@global.thread_pool_max_threads; +@@global.thread_pool_max_threads +1 +set global thread_pool_max_threads=4294967295; +select @@global.thread_pool_max_threads; +@@global.thread_pool_max_threads +4294967295 +set session thread_pool_max_threads=1; +ERROR HY000: Variable 'thread_pool_max_threads' is a GLOBAL variable and should be set with SET GLOBAL +set global thread_pool_max_threads=1.1; +ERROR 42000: Incorrect argument type to variable 'thread_pool_max_threads' +set global thread_pool_max_threads=1e1; +ERROR 42000: Incorrect argument type to variable 'thread_pool_max_threads' +set global thread_pool_max_threads="foo"; +ERROR 42000: Incorrect argument type to variable 'thread_pool_max_threads' +set global thread_pool_max_threads=0; +Warnings: +Warning 1292 Truncated incorrect thread_pool_max_threads value: '0' +select @@global.thread_pool_max_threads; +@@global.thread_pool_max_threads +1 +set global thread_pool_max_threads=10000000000; +Warnings: +Warning 1292 Truncated incorrect thread_pool_max_threads value: '10000000000' +select @@global.thread_pool_max_threads; +@@global.thread_pool_max_threads +4294967295 +SET @@global.thread_pool_max_threads = @start_global_value; diff --git a/mysql-test/suite/sys_vars/r/thread_pool_size_basic.result b/mysql-test/suite/sys_vars/r/thread_pool_size_basic.result new file mode 100644 index 00000000000..f08f9625e9d --- /dev/null +++ b/mysql-test/suite/sys_vars/r/thread_pool_size_basic.result @@ -0,0 +1,41 @@ +SET @start_global_value = @@global.thread_pool_size; +select @@global.thread_pool_size; +@@global.thread_pool_size +1 +select @@session.thread_pool_size; +ERROR HY000: Variable 'thread_pool_size' is a GLOBAL variable +show global variables like 'thread_pool_size'; +Variable_name Value +thread_pool_size # +show session variables like 'thread_pool_size'; +Variable_name Value +thread_pool_size # +select * from information_schema.global_variables where variable_name='thread_pool_size'; +VARIABLE_NAME VARIABLE_VALUE +THREAD_POOL_SIZE # +select * from information_schema.session_variables where variable_name='thread_pool_size'; +VARIABLE_NAME VARIABLE_VALUE +THREAD_POOL_SIZE # +set global thread_pool_size=1; +select @@global.thread_pool_size; +@@global.thread_pool_size +1 +set global thread_pool_size=128; +select @@global.thread_pool_size; +@@global.thread_pool_size +128 +set session thread_pool_size=1; +ERROR HY000: Variable 'thread_pool_size' is a GLOBAL variable and should be set with SET GLOBAL +set global thread_pool_size=1.1; +ERROR 42000: Incorrect argument type to variable 'thread_pool_size' +set global thread_pool_size=1e1; +ERROR 42000: Incorrect argument type to variable 'thread_pool_size' +set global thread_pool_size="foo"; +ERROR 42000: Incorrect argument type to variable 'thread_pool_size' +set global thread_pool_size=-1; +Warnings: +Warning 1292 Truncated incorrect thread_pool_size value: '-1' +set global thread_pool_size=100000; +Warnings: +Warning 1292 Truncated incorrect thread_pool_size value: '100000' +SET @@global.thread_pool_size = @start_global_value; diff --git a/mysql-test/suite/sys_vars/r/thread_pool_stall_limit_basic.result b/mysql-test/suite/sys_vars/r/thread_pool_stall_limit_basic.result new file mode 100644 index 00000000000..552ac5f54f8 --- /dev/null +++ b/mysql-test/suite/sys_vars/r/thread_pool_stall_limit_basic.result @@ -0,0 +1,47 @@ +SET @start_global_value = @@global.thread_pool_stall_limit; +select @@global.thread_pool_stall_limit; +@@global.thread_pool_stall_limit +500 +select @@session.thread_pool_stall_limit; +ERROR HY000: Variable 'thread_pool_stall_limit' is a GLOBAL variable +show global variables like 'thread_pool_stall_limit'; +Variable_name Value +thread_pool_stall_limit 500 +show session variables like 'thread_pool_stall_limit'; +Variable_name Value +thread_pool_stall_limit 500 +select * from information_schema.global_variables where variable_name='thread_pool_stall_limit'; +VARIABLE_NAME VARIABLE_VALUE +THREAD_POOL_STALL_LIMIT 500 +select * from information_schema.session_variables where variable_name='thread_pool_stall_limit'; +VARIABLE_NAME VARIABLE_VALUE +THREAD_POOL_STALL_LIMIT 500 +set global thread_pool_stall_limit=60; +select @@global.thread_pool_stall_limit; +@@global.thread_pool_stall_limit +60 +set global thread_pool_stall_limit=4294967295; +select @@global.thread_pool_stall_limit; +@@global.thread_pool_stall_limit +4294967295 +set session thread_pool_stall_limit=1; +ERROR HY000: Variable 'thread_pool_stall_limit' is a GLOBAL variable and should be set with SET GLOBAL +set global thread_pool_stall_limit=1.1; +ERROR 42000: Incorrect argument type to variable 'thread_pool_stall_limit' +set global thread_pool_stall_limit=1e1; +ERROR 42000: Incorrect argument type to variable 'thread_pool_stall_limit' +set global thread_pool_stall_limit="foo"; +ERROR 42000: Incorrect argument type to variable 'thread_pool_stall_limit' +set global thread_pool_stall_limit=-1; +Warnings: +Warning 1292 Truncated incorrect thread_pool_stall_limit value: '-1' +select @@global.thread_pool_stall_limit; +@@global.thread_pool_stall_limit +60 +set global thread_pool_stall_limit=10000000000; +Warnings: +Warning 1292 Truncated incorrect thread_pool_stall_limit value: '10000000000' +select @@global.thread_pool_stall_limit; +@@global.thread_pool_stall_limit +4294967295 +set @@global.thread_pool_stall_limit = @start_global_value; diff --git a/mysql-test/suite/sys_vars/t/slow_launch_time_func.test b/mysql-test/suite/sys_vars/t/slow_launch_time_func.test index a5b429f81cb..4a4951535ac 100644 --- a/mysql-test/suite/sys_vars/t/slow_launch_time_func.test +++ b/mysql-test/suite/sys_vars/t/slow_launch_time_func.test @@ -29,10 +29,7 @@ # # Setup # ---source include/not_threadpool.inc ---source include/not_embedded.inc ---source include/not_threadpool.inc - +--source include/one_thread_per_connection.inc SET @global_slow_launch_time = @@GLOBAL.slow_launch_time; --echo ** Connection default ** diff --git a/mysql-test/suite/sys_vars/t/thread_cache_size_func.test b/mysql-test/suite/sys_vars/t/thread_cache_size_func.test index 9bffa32ca2b..7382fd671a9 100644 --- a/mysql-test/suite/sys_vars/t/thread_cache_size_func.test +++ b/mysql-test/suite/sys_vars/t/thread_cache_size_func.test @@ -27,9 +27,8 @@ # Setup # ---source include/not_embedded.inc ---source include/not_threadpool.inc +--source include/one_thread_per_connection.inc SET @global_thread_cache_size = @@GLOBAL.thread_cache_size; FLUSH STATUS; diff --git a/mysql-test/suite/sys_vars/t/thread_pool_idle_timeout_basic.test b/mysql-test/suite/sys_vars/t/thread_pool_idle_timeout_basic.test new file mode 100644 index 00000000000..9268d45cb55 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/thread_pool_idle_timeout_basic.test @@ -0,0 +1,42 @@ +# uint global + +SET @start_global_value = @@global.thread_pool_idle_timeout; + +# +# exists as global only +# +select @@global.thread_pool_idle_timeout; +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +select @@session.thread_pool_idle_timeout; +show global variables like 'thread_pool_idle_timeout'; +show session variables like 'thread_pool_idle_timeout'; +select * from information_schema.global_variables where variable_name='thread_pool_idle_timeout'; +select * from information_schema.session_variables where variable_name='thread_pool_idle_timeout'; + +# +# show that it's writable +# +set global thread_pool_idle_timeout=60; +select @@global.thread_pool_idle_timeout; +set global thread_pool_idle_timeout=4294967295; +select @@global.thread_pool_idle_timeout; +--error ER_GLOBAL_VARIABLE +set session thread_pool_idle_timeout=1; + +# +# incorrect types +# +--error ER_WRONG_TYPE_FOR_VAR +set global thread_pool_idle_timeout=1.1; +--error ER_WRONG_TYPE_FOR_VAR +set global thread_pool_idle_timeout=1e1; +--error ER_WRONG_TYPE_FOR_VAR +set global thread_pool_idle_timeout="foo"; + + +set global thread_pool_idle_timeout=-1; +select @@global.thread_pool_idle_timeout; +set global thread_pool_idle_timeout=10000000000; +select @@global.thread_pool_idle_timeout; + +SET @@global.thread_pool_idle_timeout = @start_global_value; diff --git a/mysql-test/suite/sys_vars/t/thread_pool_max_threads_basic.test b/mysql-test/suite/sys_vars/t/thread_pool_max_threads_basic.test new file mode 100644 index 00000000000..0544986acd5 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/thread_pool_max_threads_basic.test @@ -0,0 +1,42 @@ +# uint global + +SET @start_global_value = @@global.thread_pool_max_threads; + +# +# exists as global only +# +select @@global.thread_pool_max_threads; +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +select @@session.thread_pool_max_threads; +show global variables like 'thread_pool_max_threads'; +show session variables like 'thread_pool_max_threads'; +select * from information_schema.global_variables where variable_name='thread_pool_max_threads'; +select * from information_schema.session_variables where variable_name='thread_pool_max_threads'; + +# +# show that it's writable +# +set global thread_pool_max_threads=1; +select @@global.thread_pool_max_threads; +set global thread_pool_max_threads=4294967295; +select @@global.thread_pool_max_threads; +--error ER_GLOBAL_VARIABLE +set session thread_pool_max_threads=1; + +# +# incorrect types +# +--error ER_WRONG_TYPE_FOR_VAR +set global thread_pool_max_threads=1.1; +--error ER_WRONG_TYPE_FOR_VAR +set global thread_pool_max_threads=1e1; +--error ER_WRONG_TYPE_FOR_VAR +set global thread_pool_max_threads="foo"; + + +set global thread_pool_max_threads=0; +select @@global.thread_pool_max_threads; +set global thread_pool_max_threads=10000000000; +select @@global.thread_pool_max_threads; + +SET @@global.thread_pool_max_threads = @start_global_value; diff --git a/mysql-test/suite/sys_vars/t/thread_pool_size_basic.test b/mysql-test/suite/sys_vars/t/thread_pool_size_basic.test new file mode 100644 index 00000000000..8b43fc52a58 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/thread_pool_size_basic.test @@ -0,0 +1,46 @@ +# uint global + +SET @start_global_value = @@global.thread_pool_size; + +# +# exists as global only +# +--replace_column 2 # +select @@global.thread_pool_size; +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +select @@session.thread_pool_size; +--replace_column 2 # +show global variables like 'thread_pool_size'; +--replace_column 2 # +show session variables like 'thread_pool_size'; +--replace_column 2 # +select * from information_schema.global_variables where variable_name='thread_pool_size'; +--replace_column 2 # +select * from information_schema.session_variables where variable_name='thread_pool_size'; +--replace_column 2 # + +# +# show that it's writable +# +set global thread_pool_size=1; +select @@global.thread_pool_size; +set global thread_pool_size=128; +select @@global.thread_pool_size; +--error ER_GLOBAL_VARIABLE +set session thread_pool_size=1; + +# +# incorrect types +# +--error ER_WRONG_TYPE_FOR_VAR +set global thread_pool_size=1.1; +--error ER_WRONG_TYPE_FOR_VAR +set global thread_pool_size=1e1; +--error ER_WRONG_TYPE_FOR_VAR +set global thread_pool_size="foo"; + +set global thread_pool_size=-1; + +set global thread_pool_size=100000; + +SET @@global.thread_pool_size = @start_global_value; diff --git a/mysql-test/suite/sys_vars/t/thread_pool_stall_limit_basic.test b/mysql-test/suite/sys_vars/t/thread_pool_stall_limit_basic.test new file mode 100644 index 00000000000..0fcfcd1d663 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/thread_pool_stall_limit_basic.test @@ -0,0 +1,42 @@ +# uint global + +SET @start_global_value = @@global.thread_pool_stall_limit; + +# +# exists as global only +# +select @@global.thread_pool_stall_limit; +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +select @@session.thread_pool_stall_limit; +show global variables like 'thread_pool_stall_limit'; +show session variables like 'thread_pool_stall_limit'; +select * from information_schema.global_variables where variable_name='thread_pool_stall_limit'; +select * from information_schema.session_variables where variable_name='thread_pool_stall_limit'; + +# +# show that it's writable +# +set global thread_pool_stall_limit=60; +select @@global.thread_pool_stall_limit; +set global thread_pool_stall_limit=4294967295; +select @@global.thread_pool_stall_limit; +--error ER_GLOBAL_VARIABLE +set session thread_pool_stall_limit=1; + +# +# incorrect types +# +--error ER_WRONG_TYPE_FOR_VAR +set global thread_pool_stall_limit=1.1; +--error ER_WRONG_TYPE_FOR_VAR +set global thread_pool_stall_limit=1e1; +--error ER_WRONG_TYPE_FOR_VAR +set global thread_pool_stall_limit="foo"; + + +set global thread_pool_stall_limit=-1; +select @@global.thread_pool_stall_limit; +set global thread_pool_stall_limit=10000000000; +select @@global.thread_pool_stall_limit; + +set @@global.thread_pool_stall_limit = @start_global_value; diff --git a/sql/threadpool_unix.cc b/sql/threadpool_unix.cc index 0b5c151d93b..93094f599aa 100644 --- a/sql/threadpool_unix.cc +++ b/sql/threadpool_unix.cc @@ -1136,18 +1136,15 @@ static int change_group(connection_t *c, if (c->logged_in) io_poll_disassociate_fd(old_group->pollfd,fd); c->thread_group->connection_count--; - mysql_mutex_lock(&old_group->mutex); + mysql_mutex_unlock(&old_group->mutex); /* Add connection to the new group. */ mysql_mutex_lock(&new_group->mutex); - c->thread_group= new_group; new_group->connection_count++; - /* Ensure that there is a listener in the new group. */ if(!new_group->thread_count && !new_group->pending_thread_start_count) ret= create_worker(new_group); - mysql_mutex_unlock(&new_group->mutex); return ret; } |