mirror of
https://github.com/MariaDB/server.git
synced 2025-09-02 09:41:40 +03:00
Fix pool_of_threads test case
This commit is contained in:
@@ -2084,7 +2084,7 @@ fld6 char(4) latin1_swedish_ci NO #
|
||||
show full columns from t2 from test like 's%';
|
||||
Field Type Collation Null Key Default Extra Privileges Comment
|
||||
show keys from t2;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
|
||||
t2 0 PRIMARY 1 auto A 1199 NULL NULL BTREE
|
||||
t2 0 fld1 1 fld1 A 1199 NULL NULL BTREE
|
||||
t2 1 fld3 1 fld3 A NULL NULL NULL BTREE
|
||||
@@ -2153,7 +2153,7 @@ Warning 1052 Column 'kundentyp' in group statement is ambiguous
|
||||
drop table t1;
|
||||
SELECT sleep(5);
|
||||
SELECT sleep(5);
|
||||
# -- Success: more than --thread-pool-size normal connections not possible
|
||||
# -- Success: more than --thread_pool_max_threads normal connections not possible
|
||||
sleep(5)
|
||||
0
|
||||
sleep(5)
|
||||
|
@@ -2,7 +2,8 @@
|
||||
|
||||
[mysqld.1]
|
||||
loose-thread-handling= pool-of-threads
|
||||
loose-thread_pool_size= 2
|
||||
loose-thread_pool_size= 1
|
||||
loose-thread_pool_max_threads= 2
|
||||
extra-port= @ENV.MASTER_EXTRA_PORT
|
||||
extra-max-connections=1
|
||||
|
||||
|
@@ -13,7 +13,7 @@
|
||||
# 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
|
||||
# on normal port fails due to--thread-pool-max_threads=2
|
||||
connection default;
|
||||
send SELECT sleep(5);
|
||||
|
||||
@@ -32,11 +32,11 @@ connect(con3,localhost,root,,);
|
||||
let $error = $mysql_errno;
|
||||
if (!$error)
|
||||
{
|
||||
--echo # -- Error: managed to establish more than --thread-pool-size connections
|
||||
--echo # -- Error: managed to establish more than --thread_pool_max_threads connections
|
||||
}
|
||||
if ($error)
|
||||
{
|
||||
--echo # -- Success: more than --thread-pool-size normal connections not possible
|
||||
--echo # -- Success: more than --thread_pool_max_threads normal connections not possible
|
||||
}
|
||||
|
||||
connection default;
|
||||
|
@@ -624,14 +624,22 @@ static pool_event_t * listener(worker_thread_t *current_thread,
|
||||
|
||||
|
||||
|
||||
/* Creates a new worker thread. thread_mutex must be held when calling this function */
|
||||
/*
|
||||
Creates a new worker thread.
|
||||
thread_mutex must be held when calling this function
|
||||
|
||||
NOTE: in rare cases, the number of threads can exceed
|
||||
threadpool_max_threads, because we need at least 2 threads
|
||||
per group to prevent deadlocks (one listener + one worker)
|
||||
*/
|
||||
|
||||
static int create_worker(thread_group_t *thread_group)
|
||||
{
|
||||
pthread_t thread_id;
|
||||
int err;
|
||||
DBUG_ENTER("create_worker");
|
||||
if (tp_stats.num_worker_threads >= (int)threadpool_max_threads)
|
||||
if (tp_stats.num_worker_threads >= (int)threadpool_max_threads
|
||||
&& thread_group->thread_count >= 2)
|
||||
{
|
||||
DBUG_PRINT("info",
|
||||
("Cannot create new thread (maximum allowed threads reached)"));
|
||||
@@ -667,6 +675,9 @@ static int wake_or_create_thread(thread_group_t *thread_group)
|
||||
if (thread_group->pending_thread_start_count > 0)
|
||||
DBUG_RETURN(-1);
|
||||
|
||||
if (thread_group->thread_count > thread_group->connection_count)
|
||||
DBUG_RETURN(-1);
|
||||
|
||||
if (thread_group->thread_count < 4)
|
||||
{
|
||||
DBUG_RETURN(create_worker(thread_group));
|
||||
|
Reference in New Issue
Block a user