summaryrefslogtreecommitdiff
path: root/tpool
Commit message (Collapse)AuthorAgeFilesLines
* Fix compilation error due to type mismatch in tpool_generic.ccVicențiu Ciorbaru2020-02-131-1/+1
| | | | size_t compared to int
* MDEV-21674 purge_sys.stop() fails to wait for purge workers to completeMarko Mäkelä2020-02-072-6/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since commit 5e62b6a5e06eb02cbde1e34e95e26f42d87fce02 (MDEV-16264), purge_sys_t::stop() no longer waited for all purge activity to stop. This caused problems on FLUSH TABLES...FOR EXPORT because of purge running concurrently with the buffer pool flush. The assertion at the end of buf_flush_dirty_pages() could fail. The, implemented by Vladislav Vaintroub, aims to eliminate race conditions when stopping or resuming purge: waitable_task::disable(): Wait for the task to complete, then replace the task callback function with noop. waitable_task::enable(): Restore the original task callback function after disable(). purge_sys_t::stop(): Invoke purge_coordinator_task.disable(). purge_sys_t::resume(): Invoke purge_coordinator_task.enable(). purge_sys_t::running(): Add const qualifier, and clarify the comment. The purge coordinator task will remain active as long as any purge worker task is active. purge_worker_callback(): Assert purge_sys.running(). srv_purge_wakeup(): Merge with the only caller purge_sys_t::resume(). purge_coordinator_task: Use static linkage.
* MDEV-21551 : Assertion `m_active_threads.size() >= m_long_tasks_count + ↵Vladislav Vaintroub2020-01-231-2/+3
| | | | | | | | | m_waiting_task_count' failed" Happened when running innodb_fts.sync_ddl m_long_task_count could be wrongly reset to 0, if m_task_queue is empty.
* MDEV-21551 Fix race condition in thread_pool_generic::wait_begin()Vladislav Vaintroub2020-01-221-2/+14
| | | | | | | | While waiting for mutex, thread_pool_generic::wait_begin(), current task can be marked long-running. This is done by periodic mantainence task, that runs in parallel. Fix to recheck is_long_task() after the mutex acquisition.
* MDEV-21551: Fix -Wsign-compareMarko Mäkelä2020-01-221-3/+3
| | | | | An assertion added in commit c20bf8fd494edd4e4931557395b8a2bdf6cc48ab includes a sign mismatch. Make the affected data members unsigned.
* MDEV-21551 Fix calculation of current concurrency level inVladislav Vaintroub2020-01-221-0/+2
| | | | | | | | | | | | | | | | | maybe_wake_or_create_thread() A task that is executed,could be counted as waiting (after wait_begin() before wait_end()) or as long-running (callback runs for a long time). If task is both marked waiting and long running, then calculation of current concurrency (# of executing tasks - # of long tasks - #of waiting tasks) is wrong, as task is counted twice. Thus current concurrency could go negative, but with unsigned arithmetic it will become a huge number. As a result, maybe_wake_or_create_thread() would neither wake or create a thread, when it should. Which may result in a deadlock.
* tpool - misc fixesVladislav Vaintroub2020-01-122-6/+7
|
* MDEV-21326 : Address TSAN warnings in tpool.Vladislav Vaintroub2020-01-123-7/+27
| | | | | | | | | | | | | | | | | 1. Fix places where data race warnings were relevant. tls_worker_data::m_state should be modified under mutex protection, since both maintainence timer and current worker set this flag. 2. Suppress warnings that are legitimate, yet harmless. Apparently, the dirty reads in waitable_task::get_ref_count() or write_slots->pending_io_count() Avoiding race entirely without side-effects here is tricky, and the effects of race is harmless. The worst thing that can happen due to race is an extra wait notification, under rare circumstances.
* tpool - implement post-task callback (for Innodb debugging)Vladislav Vaintroub2020-01-125-1/+32
|
* MDEV-16264 - some improvementsVladislav Vaintroub2019-12-095-34/+97
| | | | | | | - wait notification, tpool_wait_begin/tpool_wait_end - to notify the threadpool that current thread is going to wait Use it to wait for IOs to complete and also when purge waits for workers.
* MDEV-16264: Minor cleanupMarko Mäkelä2019-12-033-11/+12
| | | | | | | aio_linux::m_max_io_count: Unused data member; remove. aiocb::m_ret_len: Declare as the more compatible type size_t. Unfortunately, ssize_t is not available on Microsoft Visual Studio.
* MDEV-16264 - Fix assertion `m_queue.empty() && !m_tasks_running' in ↵Vladislav Vaintroub2019-11-251-1/+16
| | | | | | | | | | | | | | | tpool::task_group destructor This particular assertion happened when shutting down Innodb IO.IO shutdown properly waits for all IOs to finish However there is a race condition - right after releasing last IO slot and before decrementing task count in group, pending_io_count will be 0, but tasks_running will be 1, leading to assertion. The fix is to make task_group destructor to wait for last running task to finish.
* Fix compile error on centos6. it does not like std::this_thread::sleep()Vladislav Vaintroub2019-11-151-9/+3
| | | | | Simplify task_group destructor. No tasks must be running or queued into task group is being destroyed.
* MDEV-16264: Fix some white spaceMarko Mäkelä2019-11-155-48/+31
|
* MDEV-16264: Add threadpool libraryVladislav Vaintroub2019-11-1510-0/+2317
The library is capable of - asynchronous execution of tasks (and optionally waiting for them) - asynchronous file IO This is implemented using libaio on Linux and completion ports on Windows. Elsewhere, async io is "simulated", which means worker threads are performing synchronous IO. - timers, scheduling work asynchronously in some point of the future. Also periodic timers are implemented.