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

Partially Revert "MDEV-24270: Collect multiple completed events at a time"

This partially reverts commit 6479006e.

Remove the constant tpool::aio::N_PENDING, which has no
intrinsic meaning for the tpool.
parent 3dfeae0e
...@@ -1467,7 +1467,7 @@ bool buf_pool_t::create() ...@@ -1467,7 +1467,7 @@ bool buf_pool_t::create()
ut_d(lru_scan_itr.m_mutex= &mutex); ut_d(lru_scan_itr.m_mutex= &mutex);
io_buf.create((srv_n_read_io_threads + srv_n_write_io_threads) * io_buf.create((srv_n_read_io_threads + srv_n_write_io_threads) *
tpool::aio::N_PENDING); OS_AIO_N_PENDING_IOS_PER_THREAD);
/* FIXME: remove some of these variables */ /* FIXME: remove some of these variables */
srv_buf_pool_curr_size= curr_pool_size; srv_buf_pool_curr_size= curr_pool_size;
......
...@@ -264,6 +264,9 @@ struct os_file_size_t { ...@@ -264,6 +264,9 @@ struct os_file_size_t {
os_offset_t m_alloc_size; os_offset_t m_alloc_size;
}; };
/** Win NT does not allow more than 64 */
static const ulint OS_AIO_N_PENDING_IOS_PER_THREAD = 256;
extern ulint os_n_file_reads; extern ulint os_n_file_reads;
extern ulint os_n_file_writes; extern ulint os_n_file_writes;
extern ulint os_n_fsyncs; extern ulint os_n_fsyncs;
......
...@@ -4027,8 +4027,8 @@ static bool is_linux_native_aio_supported() ...@@ -4027,8 +4027,8 @@ static bool is_linux_native_aio_supported()
bool os_aio_init(ulint n_reader_threads, ulint n_writer_threads, ulint) bool os_aio_init(ulint n_reader_threads, ulint n_writer_threads, ulint)
{ {
int max_write_events= int(n_writer_threads * tpool::aio::N_PENDING); int max_write_events= int(n_writer_threads * OS_AIO_N_PENDING_IOS_PER_THREAD);
int max_read_events= int(n_reader_threads * tpool::aio::N_PENDING); int max_read_events= int(n_reader_threads * OS_AIO_N_PENDING_IOS_PER_THREAD);
int max_events = max_read_events + max_write_events; int max_events = max_read_events + max_write_events;
int ret; int ret;
......
...@@ -51,6 +51,8 @@ namespace tpool ...@@ -51,6 +51,8 @@ namespace tpool
{ {
#ifdef LINUX_NATIVE_AIO #ifdef LINUX_NATIVE_AIO
#define MAX_EVENTS 256
class aio_linux final : public aio class aio_linux final : public aio
{ {
thread_pool *m_pool; thread_pool *m_pool;
...@@ -60,10 +62,10 @@ class aio_linux final : public aio ...@@ -60,10 +62,10 @@ class aio_linux final : public aio
static void getevent_thread_routine(aio_linux *aio) static void getevent_thread_routine(aio_linux *aio)
{ {
io_event events[N_PENDING]; io_event events[MAX_EVENTS];
for (;;) for (;;)
{ {
switch (int ret= my_getevents(aio->m_io_ctx, 1, N_PENDING, events)) { switch (int ret= my_getevents(aio->m_io_ctx, 1, MAX_EVENTS, events)) {
case -EINTR: case -EINTR:
continue; continue;
case -EINVAL: case -EINVAL:
......
...@@ -155,8 +155,6 @@ struct aiocb ...@@ -155,8 +155,6 @@ struct aiocb
class aio class aio
{ {
public: public:
/** Maximum number of pending requests per thread */
static constexpr unsigned N_PENDING= 256;
/** /**
Submit asyncronous IO. Submit asyncronous IO.
On completion, cb->m_callback is executed. On completion, cb->m_callback is executed.
......
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