Commit b19760b8 authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

MDEV-21551 : Assertion `m_active_threads.size() >= m_long_tasks_count +...

MDEV-21551 :  Assertion `m_active_threads.size() >= m_long_tasks_count + 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.
parent 0e25a8b4
...@@ -441,6 +441,7 @@ bool thread_pool_generic::wait_for_tasks(std::unique_lock<std::mutex> &lk, ...@@ -441,6 +441,7 @@ bool thread_pool_generic::wait_for_tasks(std::unique_lock<std::mutex> &lk,
} }
} }
/** /**
Workers "get next task" routine. Workers "get next task" routine.
...@@ -489,6 +490,7 @@ bool thread_pool_generic::get_task(worker_data *thread_var, task **t) ...@@ -489,6 +490,7 @@ bool thread_pool_generic::get_task(worker_data *thread_var, task **t)
void thread_pool_generic::worker_end(worker_data* thread_data) void thread_pool_generic::worker_end(worker_data* thread_data)
{ {
std::lock_guard<std::mutex> lk(m_mtx); std::lock_guard<std::mutex> lk(m_mtx);
DBUG_ASSERT(!thread_data->is_long_task());
m_active_threads.erase(thread_data); m_active_threads.erase(thread_data);
m_thread_data_cache.put(thread_data); m_thread_data_cache.put(thread_data);
...@@ -549,14 +551,13 @@ void thread_pool_generic::maintainence() ...@@ -549,14 +551,13 @@ void thread_pool_generic::maintainence()
m_timestamp = std::chrono::system_clock::now(); m_timestamp = std::chrono::system_clock::now();
m_long_tasks_count = 0;
if (m_task_queue.empty()) if (m_task_queue.empty())
{ {
m_last_activity = m_tasks_dequeued + m_wakeups; m_last_activity = m_tasks_dequeued + m_wakeups;
return; return;
} }
m_long_tasks_count = 0;
for (auto thread_data = m_active_threads.front(); for (auto thread_data = m_active_threads.front();
thread_data; thread_data;
thread_data = thread_data->m_next) thread_data = thread_data->m_next)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment