summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@mariadb.com>2020-01-23 14:27:49 +0100
committerVladislav Vaintroub <wlad@mariadb.com>2020-01-23 15:23:46 +0100
commitb19760b8436c91c9333cc2744f238d45b993d366 (patch)
tree2ecfc97413170770afc201a072a5bbe28e9684db
parent0e25a8b4a6a01e3c09407f2f697983dacbcb5cdb (diff)
downloadmariadb-git-b19760b8436c91c9333cc2744f238d45b993d366.tar.gz
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.
-rw-r--r--tpool/tpool_generic.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/tpool/tpool_generic.cc b/tpool/tpool_generic.cc
index 70325cf9e56..47c19e39baa 100644
--- a/tpool/tpool_generic.cc
+++ b/tpool/tpool_generic.cc
@@ -441,6 +441,7 @@ bool thread_pool_generic::wait_for_tasks(std::unique_lock<std::mutex> &lk,
}
}
+
/**
Workers "get next task" routine.
@@ -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)
{
std::lock_guard<std::mutex> lk(m_mtx);
+ DBUG_ASSERT(!thread_data->is_long_task());
m_active_threads.erase(thread_data);
m_thread_data_cache.put(thread_data);
@@ -549,14 +551,13 @@ void thread_pool_generic::maintainence()
m_timestamp = std::chrono::system_clock::now();
- m_long_tasks_count = 0;
-
if (m_task_queue.empty())
{
m_last_activity = m_tasks_dequeued + m_wakeups;
return;
}
+ m_long_tasks_count = 0;
for (auto thread_data = m_active_threads.front();
thread_data;
thread_data = thread_data->m_next)