summaryrefslogtreecommitdiff
path: root/sql/threadpool_win.cc
Commit message (Collapse)AuthorAgeFilesLines
* MDEV-24341 Innodb - do not block in foreground thread in log_write_up_to(Vladislav Vaintroub2021-02-141-0/+7
|
* MDEV-23224 better defaults for Windows native threadpool implementationVladislav Vaintroub2020-07-201-2/+27
|
* Merge branch '10.5' into 10.6Vladislav Vaintroub2020-07-041-4/+4
|\
| * Remove some trailing whitespaces.Vladislav Vaintroub2020-05-291-8/+8
| |
* | MDEV-22990 Threadpool : Optimize network/named pipe IO for WindowsVladislav Vaintroub2020-06-261-115/+48
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Merge 10.4 into 10.5Marko Mäkelä2020-03-301-2/+2
|\
| * num_worker_threads my_atomic to Atomic_counterSergey Vojtovich2020-03-271-2/+2
| |
* | Merge 10.4 into 10.5Marko Mäkelä2019-09-121-0/+1
|\ \ | |/
| * Merge 10.3 into 10.4Marko Mäkelä2019-09-121-0/+1
| |\
| | * Merge 10.2 into 10.3Marko Mäkelä2019-09-101-0/+1
| | |\
| | | * MDEV-20206 : Crash inside timer_callback()[threadpool_win.cc:419]Vladislav Vaintroub2019-09-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The most likely cause of the crash is that a timer fired, after it was closed. MSDN documents such a possibility, in the documentation for CloseThreadpoolTimer() function, and recommends disabling the timer before calling WaitForThreadpoolTimerCallbacks()/CloseThreadpoolTimer(). The fix follows this recommendation. Note, that 5.5-10.1 disabled the timer before close, but this code was lost in threadpool refactoring in 10.2
* | | | Fix compile warning/error on Windows.Vladislav Vaintroub2019-06-181-12/+6
| | | |
* | | | Windows related cleanups, remove old code.Vladislav Vaintroub2019-06-181-25/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Do not scan registry to check if TCPIP is supported. - Do not read registry under HKEY_LOCAL_MACHINE\SOFTWARE\MySQL anymore. - Do not load threadpool function dynamically, it is available since Win7. - simplify win32_init_tcp_ip(), and return error of WSAStartup() fails. - Correct comment in my_parameter_handler()
* | | | Merge 10.4 into 10.5Marko Mäkelä2019-05-231-1/+1
|\ \ \ \ | |/ / /
| * | | Merge branch '10.3' into 10.4Oleksandr Byelkin2019-05-191-1/+1
| |\ \ \ | | |/ /
| | * | Merge 10.2 into 10.3Marko Mäkelä2019-05-141-1/+1
| | |\ \ | | | |/
| | | * Merge 10.1 into 10.2Marko Mäkelä2019-05-131-1/+1
| | | |\
| | | | * Merge branch '5.5' into 10.1Vicențiu Ciorbaru2019-05-111-1/+1
| | | | |\
| | | | | * Update FSF addressMichal Schorm2019-05-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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' {} \;
| | | | * | MDEV-13179 main.errors fails with wrong errnoMonty2017-08-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The problem was that the introduction of max-thread-mem-used can cause an allocation error very early, even before mysql_parse() is called. As mysql_parse() calls thd->reset_for_next_command(), which called clear_error(), the error number was lost. Fixed by adding an option to have unique messages for each KILL signal and change max-thread-mem-used to use this new feature. This removes a lot of problems with the original approach, where one could get errors signaled silenty almost any time. ixed by moving clear_error() from reset_for_next_command() to do_command(), before any memory allocation for the thread. Related changes: - reset_for_next_command() now have an optional parameter if we should call clear_error() or not. By default it's called, but not anymore from dispatch_command() which was the original problem. - Added optional paramater to clear_error() to force calling of reset_diagnostics_area(). Before clear_error() only called reset_diagnostics_area() if there was no error, so we normally called reset_diagnostics_area() twice. - This change removed several duplicated calls to clear_error() when starting a query. - Reset max_mem_used on COM_QUIT, to protect against kill during quit. - Use fatal_error() instead of setting is_fatal_error (cleanup) - Set fatal_error if max_thead_mem_used is signaled. (Same logic we use for other places where we are out of resources)
* | | | | | Moved vio allocation to connection threadSergey Vojtovich2019-05-211-4/+3
|/ / / / / | | | | | | | | | | | | | | | Part of MDEV-19515 - Improve connect speed
* | | | | MDEV-10384 Windows : Refactor threading in mysqld startup.Vladislav Vaintroub2018-10-051-7/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove threads that are doing nothing but wait - main thread now handles the connections (if threadpool is used, also threadpool threads would wait for connections) - thread for socket and pipe connections are removed - shutdown thread is now removed, we wait for shutdown notification in main thread as well - kill_server() is also called inside the main thread, after connection loop finished.
* | | | | MDEV-16536 Remove shared memory transportVladislav Vaintroub2018-08-201-55/+8
|/ / / /
* | | | Add likely/unlikely to speed up executionMonty2018-05-071-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added to: - if (error) - Lex - sql_yacc.yy and sql_yacc_ora.yy - In header files to alloc() calls - Added thd argument to thd_net_is_killed()
* | | | Make possible to use clang on Windows (clang-cl)Vladislav Vaintroub2018-02-201-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | -DWITH_ASAN can be used as well now, on x64 Fix many clang-cl warnings.
* | | | Enusure that my_global.h is included firstMichael Widenius2017-08-241-1/+1
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | - Added sql/mariadb.h file that should be included first by files in sql directory, if sql_plugin.h is not used (sql_plugin.h adds SHOW variables that must be done before my_global.h is included) - Removed a lot of include my_global.h from include files - Removed include's of some files that my_global.h automatically includes - Removed duplicated include's of my_sys.h - Replaced include my_config.h with my_global.h
* | | Merge branch '10.1' into 10.2Sergei Golubchik2017-03-301-1/+1
|\ \ \ | |/ /
| * | Correct FSF addressiangilfillan2017-03-101-1/+1
| | |
* | | MDEV-10297 Add priorization to threadpoolVladislav Vaintroub2016-09-221-321/+229
| | | | | | | | | | | | Also MDEV-10385 Threadpool refactoring
* | | MDEV-9154 : Remove workarounds (mainly dynamic function loading)Vladislav Vaintroub2016-06-011-107/+0
| | | | | | | | | | | | for running obsolete versions of Windows
* | | Merge branch '10.1' into 10.2Sergei Golubchik2016-03-231-2/+2
|\ \ \ | |/ /
| * | Fix spelling: occurred, execute, which etcOtto Kekäläinen2016-03-041-2/+2
| | |
* | | Fix threadpool memory leak and connect2 testVladislav Vaintroub2016-03-091-0/+1
| | |
* | | Fix threadpool after it was broken by MDEV-6150Vladislav Vaintroub2016-03-081-16/+11
| | |
* | | Fix compilation10.2-sslVladislav Vaintroub2016-02-101-11/+1
| | |
* | | MDEV-6150 Speed up connection speed by moving creation of THD to new threadMonty2016-02-071-14/+26
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
* | MDEV-9156 : Fix tp_add_connection()'s error handlingVladislav Vaintroub2015-12-041-2/+2
| | | | | | | | Avoid possible my_thread_end() in the main polling thread.
* | merge with 5.5Sergei Golubchik2012-11-031-16/+0
|\ \ | |/
| * MDEV-531 : Warning: Forcing close of thread ... in rpl_binlog_indexVladislav Vaintroub2012-11-021-16/+0
| | | | | | | | | | | | 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.
* | Compile 10.0 on WindowsVladislav Vaintroub2012-08-301-2/+2
|/
* MDEV-246 - Aborted_clients incremented during ordinary connection closeVladislav Vaintroub2012-05-031-0/+4
| | | | | | The problem was increment of aborted_threads variable due to thd->killed which was set when threadpool connection was terminated . The fix is not to set thd->killed anymore, there is no real reason for doing it.. Added a test that checks that status variable aborted_clients does not grow for ordinary disconnects, and that successful KILL increments this variable.
* mdev-208 thread pool breaks the server on XPSergei Golubchik2012-04-051-0/+3
|
* Windows threadpool - always disassociate current thread from callback when ↵Vladislav Vaintroub2012-03-281-5/+5
| | | | | | | destroying connection prior to closing callbacks and calling DestroyThreadpoolEnvironment, to make sure callbacks do not wait for themselves to finish.
* Store callback instance in the connection structure, to call ↵Vladislav Vaintroub2012-02-171-4/+36
| | | | | | | | CallbackMayRunLong on long waits (currently binlog only) Also add copyright notice.
* Threadpool : Rest of monty's reviewVladislav Vaintroub2012-01-271-5/+6
|
* close callbacks prior to closing connection to avoid potential race when e.g ↵Vladislav Vaintroub2012-01-271-5/+5
| | | | timer callback and connection_destroy run in parallel
* Further review points and simplify Windows implementationVladislav Vaintroub2012-01-261-81/+44
|
* small cleanupsVladislav Vaintroub2012-01-241-6/+1
|
* Get rid of idle thread counter atomic variable.Vladislav Vaintroub2012-01-151-0/+10
| | | | | Instead, use function that loops over groups and calculates idle threads for "show status".
* Small adjustements to threadpoolVladislav Vaintroub2011-12-181-1/+0
|