Commit graph

35 commits

Author SHA1 Message Date
Daniel Black
623c3f6731 thread_group_close: release mutex in all branches
Found by Coverity scan - id 92087
2017-07-03 12:51:30 +04:00
Sergey Vojtovich
2db724c8d2 MDEV-10218 - rpl.rpl_binlog_errors fails in buildbot with valgrind warnings -
bytes are possibly lost

Timer thread of threadpool is created "joinable", but they're not "joined" on
completion. This causes memory leaks around thread local storage.

Fixed by joining timer thread.
2016-06-13 16:05:45 +04:00
Sergey Vojtovich
a588de1fe8 MDEV-5205 - MariaDB does not start if more than 128 cpu's are available
An addition to fix for MDEV-5205, fixes server crash on shutdown.

Thread groups are destroyed asynchronously, that is kill server
thread sends shutdown request to all thread groups without waiting
for compeltion.

It means all_groups array must not be freed until all thread groups
are down. This patch suggests that all_groups is freed when last
thread group is destroyed.

Note 1: threadpool code doesn't surround atomic ops with atomic locks,
thus no locks for shutdown_group_count.
Note 2: this patch preserves old behaviour, but we may need to wait
until all thread groups are down before returning from tp_end().
2013-11-06 22:53:39 +04:00
Sergey Vojtovich
fd9f1638ea MDEV-5205 - MariaDB does not start if more than 128 cpu's are available
- thread_pool_size command line option upper limit increased to 100 000
  (same as for max_connections)
- thread_pool_size system variable upper limit is maximum of 128 or
  the value given at command line
- thread groups are now allocated dynamically

Different limit for command line option and system variable was done to
avoid additional mutex for all_groups and threadpool_max_size.
2013-11-05 09:18:59 +04:00
Sergei Golubchik
7c61679c4e MDEV-4685 Compile error on LFS
fix the code to compile w/o perfomance schema
2013-06-22 14:02:03 +02:00
Vladislav Vaintroub
ef1e767ae3 MDEV-4553 - Fixes for compilation under NetBSD. 2013-05-27 16:35:42 +02:00
Vladislav Vaintroub
2c37ace131 MDEV-4174 - Use kqueue for threadpool implementation on more BSD variants than just FreeBSD
or OSX - i.e NetBSD, OpenBSD, DragonFly, etc.
2013-02-19 23:46:52 +01:00
Vladislav Vaintroub
1701ee3357 MDEV-4113: Assertion (group->connection_count > 0) fails with Percona server in replication test.
Assertion happens in replication thread during THD destruction, when thread calls my_sync(), which in turn calls  thd_wait_begin() callback. Connection count can be 0, because the counter was decremented before THD destructor. 
This assertion currently reproducible only in Percona server  and not in MariaDB, due to differences in replication code.

Fixed by moving  code to decrement connection counter after the THD destructor.
2013-01-30 17:25:02 +01:00
Vladislav Vaintroub
4ffc9c3b01 MDEV-531 : Warning: Forcing close of thread ... in rpl_binlog_index
Use post_kill_notification in for one_thread_per_connection scheduler, 
the same as already used in threadpool, to reliably wake a thread  stuck in 
read() or in different poll() variations.
2012-11-02 10:43:52 +01:00
Vladislav Vaintroub
85a025f30c Threadpool - use EV_ONESHOT with kevent, to prevent race condition when 2
threads are retrieving events at the same time.
2012-04-12 01:40:44 +02:00
Vladislav Vaintroub
2a5d8ea9a2 Added copiright, some more comments 2012-02-17 23:27:15 +01:00
Vladislav Vaintroub
cfa56f900a address second round review comments 2012-02-16 16:59:04 +01:00
Vladislav Vaintroub
4d1c7b7947 some more whitespace, remove pending_thread_start_count. increment counters (thread_group->count, thread_group->active_thread_count) whenever mysql_create_thread returns success. 2012-01-28 01:09:28 +01:00
Vladislav Vaintroub
804f3bfeaf Threadpool : Rest of monty's review 2012-01-27 19:52:53 +01:00
Vladislav Vaintroub
57b6cb39aa Further review points and simplify Windows implementation 2012-01-26 04:35:54 +01:00
Vladislav Vaintroub
d50649ecf7 small cleanups 2012-01-24 03:23:14 +01:00
Vladislav Vaintroub
c492296127 ensure that lock is held, whenever active thread counter changes.
It was not the case inside listener routine.
2012-01-18 21:12:04 +01:00
Vladislav Vaintroub
6909311028 Threadpool : address some of the monty's review points
Also, print message when pool blocks.
2012-01-17 18:50:40 +01:00
Vladislav Vaintroub
1f8cbf168c Fix threadpool on BSD and Solaris 2012-01-16 02:18:24 +01:00
Vladislav Vaintroub
d212991e89 Get rid of idle thread counter atomic variable.
Instead, use function that loops over groups and 
calculates  idle threads for  "show status".
2012-01-15 15:41:25 +01:00
Vladislav Vaintroub
18c9b345b4 Threadpool -address review comments 2012-01-15 11:17:45 +01:00
Vladislav Vaintroub
c216c9f0f0 Allow for faster creation of threads in corner cases where pool would be overloaded with long non-yielding queries.
To allow it, change minimum of thread_pool_stall_limit to be 10 milliseconds.

Also introduce a new parameter to oversubscribe a group . Number of threads running in  parallel would be higher than it normally should, leading to thrashing, but it may improving preemptiveness, which is useful for the described corner case.
2011-12-31 05:24:11 +01:00
Vladislav Vaintroub
bb0a0c52a6 Make threadpool_stall_limit variable really dynamic 2011-12-29 21:11:06 +01:00
Vladislav Vaintroub
539a7ebe10 LP909537: Ensure thd_wait_begin/thd_wait_end callbacks are called. 2011-12-29 19:37:26 +01:00
Vladislav Vaintroub
bee1d88abf LP909512: Fix crash on tp_set_threadpool_size if threadpool is not used(thread_handling != pool-of-threads) 2011-12-29 12:53:07 +01:00
Vladislav Vaintroub
b9f2fb84f6 Fix LP#909414: Valgrind warnings in threadpool code 2011-12-29 12:17:30 +01:00
Vladislav Vaintroub
54b61b8b44 LP9091416: destroy timer mutex when threadpool scheduler shuts down.
Fixes valgrind warning.
2011-12-29 01:59:05 +01:00
Vladislav Vaintroub
ecad00bc4e use performance-schema friendly mysql_thread_create() instead of pthread_create() 2011-12-28 16:23:46 +01:00
Vladislav Vaintroub
7da4229f2e Fix build on old 32 bit Centos (kernel 2.6.18) 2011-12-26 01:08:46 +01:00
Vladislav Vaintroub
96041f8e1d make sys_vars suite pass 2011-12-20 22:49:24 +01:00
Vladislav Vaintroub
df48c9bf20 allow changing thread_pool_size without server restart 2011-12-19 13:28:30 +01:00
Vladislav Vaintroub
2e4bde4c0f Fix pool_of_threads test case 2011-12-18 23:03:35 +01:00
Vladislav Vaintroub
a5a22e9f64 Small adjustements to threadpool 2011-12-18 20:40:38 +01:00
Vladislav Vaintroub
c439494942 Fix Unix build 2011-12-10 19:35:44 +01:00
Vladislav Vaintroub
e91bbca5fb Initial threadpool implementation for MariaDB 5.5 2011-12-08 19:17:49 +01:00