Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
2e4bde4c
Commit
2e4bde4c
authored
Dec 18, 2011
by
Vladislav Vaintroub
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix pool_of_threads test case
parent
a5a22e9f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
11 deletions
+23
-11
mysql-test/r/pool_of_threads.result
mysql-test/r/pool_of_threads.result
+5
-5
mysql-test/t/pool_of_threads.cnf
mysql-test/t/pool_of_threads.cnf
+2
-1
mysql-test/t/pool_of_threads.test
mysql-test/t/pool_of_threads.test
+3
-3
sql/threadpool_unix.cc
sql/threadpool_unix.cc
+13
-2
No files found.
mysql-test/r/pool_of_threads.result
View file @
2e4bde4c
...
...
@@ -2084,10 +2084,10 @@ 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
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
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
drop table t4, t3, t2, t1;
CREATE TABLE t1 (
cont_nr int(11) NOT NULL auto_increment,
...
...
@@ -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)
...
...
mysql-test/t/pool_of_threads.cnf
View file @
2e4bde4c
...
...
@@ -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
...
...
mysql-test/t/pool_of_threads.test
View file @
2e4bde4c
...
...
@@ -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
;
...
...
sql/threadpool_unix.cc
View file @
2e4bde4c
...
...
@@ -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
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment