Commit graph

45 commits

Author SHA1 Message Date
Marko Mäkelä
0076eb3d4e Merge 10.5 into 10.6 2024-06-24 13:09:47 +03:00
Dave Gosselin
db0c28eff8 MDEV-33746 Supply missing override markings
Find and fix missing virtual override markings.  Updates cmake
maintainer flags to include -Wsuggest-override and
-Winconsistent-missing-override.
2024-06-20 11:32:13 -04:00
Marko Mäkelä
6aec87544c Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
Marko Mäkelä
c41c79650a Merge 10.4 into 10.5 2023-02-10 12:02:11 +02:00
Vicențiu Ciorbaru
08c852026d Apply clang-tidy to remove empty constructors / destructors
This patch is the result of running
run-clang-tidy -fix -header-filter=.* -checks='-*,modernize-use-equals-default' .

Code style changes have been done on top. The result of this change
leads to the following improvements:

1. Binary size reduction.
* For a -DBUILD_CONFIG=mysql_release build, the binary size is reduced by
  ~400kb.
* A raw -DCMAKE_BUILD_TYPE=Release reduces the binary size by ~1.4kb.

2. Compiler can better understand the intent of the code, thus it leads
   to more optimization possibilities. Additionally it enabled detecting
   unused variables that had an empty default constructor but not marked
   so explicitly.

   Particular change required following this patch in sql/opt_range.cc

   result_keys, an unused template class Bitmap now correctly issues
   unused variable warnings.

   Setting Bitmap template class constructor to default allows the compiler
   to identify that there are no side-effects when instantiating the class.
   Previously the compiler could not issue the warning as it assumed Bitmap
   class (being a template) would not be performing a NO-OP for its default
   constructor. This prevented the "unused variable warning".
2023-02-09 16:09:08 +02:00
Vladislav Vaintroub
4df0249b9a MDEV-24341 Innodb - do not block in foreground thread in log_write_up_to( 2021-02-14 18:30:39 +01:00
Marko Mäkelä
9a7948e3f6 Merge 10.5 into 10.6 2020-08-04 07:55:16 +03:00
Marko Mäkelä
50a11f396a Merge 10.4 into 10.5 2020-08-01 14:42:51 +03:00
Marko Mäkelä
9216114ce7 Merge 10.3 into 10.4 2020-07-31 18:09:08 +03:00
Vladislav Vaintroub
71015d844e MDEV-21101 unexpected wait_timeout with pool-of-threads
Due to restricted size of the threadpool, execution of client queries can
be delayed (queued) for a while. This delay was interpreted as client
inactivity, and connection is closed, if client idle time + queue time
exceeds wait_timeout.

But users did not expect queue time to be included into wait_timeout.

This patch changes the behavior. We don't close connection anymore,
if there is some unread data present on connection,
even if wait_timeout is exceeded. Unread data means that client
was not idle, it sent a query, which we did not have time to process yet.
2020-07-30 10:17:45 +02:00
Vladislav Vaintroub
272828a171 Merge branch '10.5' into 10.6 2020-07-04 11:53:26 +02:00
Vladislav Vaintroub
d15c839c0d MDEV-22990 Threadpool : Optimize network/named pipe IO for Windows
This patch reduces the overhead of system calls prior to a query, for
threadpool.  Previously, 3 system calls were done

1. WSARecv() to get notification of input data from client, asynchronous
equivalent of select() in one-thread-per-connection

2. recv(4 bytes) - reading packet header length
3. recv(packet payload)

Now there will be usually, just WSARecv(), which pre-reads user data into
a buffer, so we spared 2 syscalls

Profiler shows the most expensive call WSARecv(16%CPU) becomes 4% CPU,
after the patch, benchmark results (network heavy ones like point-select)
improve by ~20%

The buffer management was rather carefully done to keep
buffers together, as Windows would keeps the pages pinned
in memory for the duration of async calls.
At most 1MB memory is used for the buffers, and overhead per-connection is
only 256 bytes, which should cover most of the uses.

SSL does not yet use the optmization, so far it does not properly use
VIO for reads and writes. Neither one-thread-per-connection would get any
benefit, but that should be fine, it is not even default on Windows.
2020-06-26 14:44:36 +02:00
Vladislav Vaintroub
32dd58e04b Removed function declaration of a non-existing function 2020-05-29 13:05:35 +02:00
Vladislav Vaintroub
213265130e Remove some trailing whitespaces. 2020-05-29 13:05:35 +02:00
Marko Mäkelä
37c14690fc Merge 10.4 into 10.5 2020-03-30 19:07:25 +03:00
Sergey Vojtovich
9eae063e79 num_worker_threads my_atomic to Atomic_counter 2020-03-27 11:41:46 +04:00
Vladislav Vaintroub
daeaa600ef MDEV-19312 Make throttling interval depend on thread_pool_stall_limit
A thread_pool_stall_limit which is smaller than default would result
in quicker creation of threads.
2019-05-31 15:04:11 +02:00
Vladislav Vaintroub
307ca69356 Add some variables to the generic threadpool, that could help to analyze
stalls etc better.

- thread_pool_exact_stats -  uses high precision timestamp for
the time when connection was added to the queue. This timestamp helps
calculating queuing time shown in I_S.THREADPOOL_QUEUES entries.

- If thread_pool_dedicated_listener is on, then each group will have its
own dedicated listener, that does not convert to worker.
With this variable on, the queueing time in I_S.THREADPOOL_QUEUES , and
actual queue size in I_S.THREADPOOOL_GROUPS will be more exact, since
IO request are immediately dequeued from poll, without delay.


Part of MDEV-19313.
2019-05-26 19:20:35 +02:00
Vladislav Vaintroub
2fc13d04d1 MDEV-19313 Threadpool : provide information schema tables for internals of generic threadpool
Added thread_pool_groups, thread_pool_queues, thread_pool_waits and
thread_pool_stats tables to information_schema.
2019-05-26 19:20:35 +02:00
Oleksandr Byelkin
c07325f932 Merge branch '10.3' into 10.4 2019-05-19 20:55:37 +02:00
Marko Mäkelä
26a14ee130 Merge 10.1 into 10.2 2019-05-13 17:54:04 +03:00
Vicențiu Ciorbaru
f177f125d4 Merge branch '5.5' into 10.1 2019-05-11 19:15:57 +03:00
Michal Schorm
17b4f99928 Update FSF address
This commit is based on the work of Michal Schorm, rebased on the
earliest MariaDB version.

Th command line used to generate this diff was:

find ./ -type f \
  -exec sed -i -e 's/Foundation, Inc., 59 Temple Place, Suite 330, Boston, /Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, /g' {} \; \
  -exec sed -i -e 's/Foundation, Inc. 59 Temple Place.* Suite 330, Boston, /Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, /g' {} \; \
  -exec sed -i -e 's/MA.*.....-1307.*USA/MA 02110-1335 USA/g' {} \; \
  -exec sed -i -e 's/Foundation, Inc., 59 Temple/Foundation, Inc., 51 Franklin/g' {} \; \
  -exec sed -i -e 's/Place, Suite 330, Boston, MA.*02111-1307.*USA/Street, Fifth Floor, Boston, MA 02110-1335 USA/g' {} \; \
  -exec sed -i -e 's/MA.*.....-1307/MA 02110-1335/g' {} \;
2019-05-10 20:52:00 +03:00
Vladislav Vaintroub
6812fb7971 MDEV-19274 mariadb does not build on OSes that do not have HAVE_POOL_OF_THREADS
Do not try to compile threadpool_common.cc, if threadpool is not available
on current OS.

Also introduced undocumented/uncached CMake variable DISABLE_THREADPOOL,
to emulate builds on exotic OSes.
2019-04-18 07:37:05 +01:00
Sergei Golubchik
da4d71d10d Merge branch '10.1' into 10.2 2017-03-30 12:48:42 +02:00
iangilfillan
f0ec34002a Correct FSF address 2017-03-10 18:21:29 +01:00
Vladislav Vaintroub
f7a7c0c2fe MDEV-10297 Add priorization to threadpool
Also MDEV-10385 Threadpool refactoring
2016-09-22 17:01:28 +00:00
Vladislav Vaintroub
35e713dcca Fix leak from missing my_thread_end 2016-03-09 16:42:45 +01:00
Vladislav Vaintroub
1a3db0e24f Fix threadpool after it was broken by MDEV-6150 2016-03-08 10:28:26 +01:00
Vladislav Vaintroub
b436db98fe Fix compilation 2016-02-10 00:20:23 +01:00
Monty
3d4a7390c1 MDEV-6150 Speed up connection speed by moving creation of THD to new thread
Creating a CONNECT object on client connect and pass this to the working thread which creates the THD.
Split LOCK_thread_count to different mutexes
Added LOCK_thread_start to syncronize threads
Moved most usage of LOCK_thread_count to dedicated functions
Use next_thread_id() instead of thread_id++

Other things:
- Thread id now starts from 1 instead of 2
- Added cast for thread_id as thread id is now of type my_thread_id
- Made THD->host const (To ensure it's not changed)
- Removed some DBUG_PRINT() about entering/exiting mutex as these was already logged by mutex code
- Fixed that aborted_connects and connection_errors_internal are counted in all cases
- Don't take locks for current_linfo when we set it (not needed as it was 0 before)
2016-02-07 10:34:03 +02:00
Sergei Golubchik
a2bcee626d Merge branch '10.0' into 10.1 2015-12-21 21:24:22 +01:00
Vladislav Vaintroub
50160216ea MDEV-9156 : Fix tp_add_connection()'s error handling
Avoid possible my_thread_end() in the main polling thread.
2015-12-04 18:16:04 +01:00
Monty
0ee879ff8a Improve performance for calculating memory allocation
Extend interface for 'show variables' with current scope
2015-02-01 15:24:22 +02: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
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
d50649ecf7 small cleanups 2012-01-24 03:23:14 +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
df48c9bf20 allow changing thread_pool_size without server restart 2011-12-19 13:28:30 +01:00
Vladislav Vaintroub
a5a22e9f64 Small adjustements to threadpool 2011-12-18 20:40:38 +01:00
Vladislav Vaintroub
e91bbca5fb Initial threadpool implementation for MariaDB 5.5 2011-12-08 19:17:49 +01:00