Commit 78bd7d86 authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

MDEV-25953 Tpool - prevent potential deadlock in simulated AIO

Do not execute user callback just after pwrite. Instead, submit user
function as task into thread pool. This way, the IO thread would not hog
aiocb, which is a limited (in Innodb) resource
parent 48938c57
......@@ -159,7 +159,9 @@ class simulated_aio : public aio
#endif
cb->m_ret_len = ret_len;
cb->m_err = err;
cb->m_callback(cb);
cb->m_internal_task.m_func= cb->m_callback;
thread_pool *pool= (thread_pool *)cb->m_internal;
pool->submit_task(&cb->m_internal_task);
}
virtual int submit_io(aiocb *aiocb) override
......@@ -167,6 +169,7 @@ class simulated_aio : public aio
aiocb->m_internal_task.m_func = simulated_aio_callback;
aiocb->m_internal_task.m_arg = aiocb;
aiocb->m_internal_task.m_group = aiocb->m_group;
aiocb->m_internal = m_pool;
m_pool->submit_task(&aiocb->m_internal_task);
return 0;
}
......
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