Commit 0b8b84d8 authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

MDEV-21501 Innodb AIO: release IO slots early in io_callback

prevent potential stalls for when all slots are used up, and all io threads
are used up, and io callbacks are slow.
parent c32fd509
...@@ -4184,15 +4184,13 @@ fil_io( ...@@ -4184,15 +4184,13 @@ fil_io(
/**********************************************************************/ /**********************************************************************/
/** Callback for AIO completion */ /** Callback for AIO completion */
void fil_aio_callback(const tpool::aiocb *cb) void fil_aio_callback(os_aio_userdata_t *data)
{ {
os_aio_userdata_t *data=(os_aio_userdata_t *)cb->m_userdata;
fil_node_t* node= data->node; fil_node_t* node= data->node;
void* message = data->message; void* message = data->message;
ut_ad(fil_validate_skip()); ut_ad(fil_validate_skip());
ut_a(cb->m_err == DB_SUCCESS);
if (node == NULL) { if (node == NULL) {
ut_ad(srv_shutdown_state == SRV_SHUTDOWN_EXIT_THREADS); ut_ad(srv_shutdown_state == SRV_SHUTDOWN_EXIT_THREADS);
......
...@@ -3872,12 +3872,12 @@ os_file_get_status( ...@@ -3872,12 +3872,12 @@ os_file_get_status(
} }
extern void fil_aio_callback(const tpool::aiocb *cb); extern void fil_aio_callback(os_aio_userdata_t *data);
static void io_callback(tpool::aiocb* cb) static void io_callback(tpool::aiocb* cb)
{ {
fil_aio_callback(cb); ut_a(cb->m_err == DB_SUCCESS);
os_aio_userdata_t data = *(os_aio_userdata_t*)cb->m_userdata;
/* Return cb back to cache*/ /* Return cb back to cache*/
if (cb->m_opcode == tpool::aio_opcode::AIO_PREAD) { if (cb->m_opcode == tpool::aio_opcode::AIO_PREAD) {
if (read_slots->contains(cb)) { if (read_slots->contains(cb)) {
...@@ -3890,6 +3890,8 @@ static void io_callback(tpool::aiocb* cb) ...@@ -3890,6 +3890,8 @@ static void io_callback(tpool::aiocb* cb)
ut_ad(write_slots->contains(cb)); ut_ad(write_slots->contains(cb));
write_slots->release(cb); write_slots->release(cb);
} }
fil_aio_callback(&data);
} }
#ifdef LINUX_NATIVE_AIO #ifdef LINUX_NATIVE_AIO
......
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