Skip to content

Commit b3f7d52

Browse files
committed
MDEV-10918 Innodb/Linux - Fallback to simulated aio if io_setup() fails, e.g due to insufficient resources
1 parent 098f0ae commit b3f7d52

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

mysql-test/mysql-test-run.pl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4396,9 +4396,8 @@ ($$)
43964396
qr|Aborted connection|,
43974397
qr|table.*is full|,
43984398
qr|Linux Native AIO|, # warning that aio does not work on /dev/shm
4399-
qr|Error: io_setup\(\) failed|,
4400-
qr|Warning: io_setup\(\) failed|,
4401-
qr|Warning: io_setup\(\) attempt|,
4399+
qr|InnoDB: io_setup\(\) attempt|,
4400+
qr|InnoDB: io_setup\(\) failed with EAGAIN|,
44024401
qr|setrlimit could not change the size of core files to 'infinity';|,
44034402
qr|feedback plugin: failed to retrieve the MAC address|,
44044403
qr|Plugin 'FEEDBACK' init function returned error|,

storage/innobase/os/os0file.cc

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6560,12 +6560,25 @@ AIO::init_linux_native_aio()
65606560

65616561
if (!linux_create_io_ctx(max_events, ctx)) {
65626562
/* If something bad happened during aio setup
6563-
we should call it a day and return right away.
6564-
We don't care about any leaks because a failure
6565-
to initialize the io subsystem means that the
6566-
server (or atleast the innodb storage engine)
6567-
is not going to startup. */
6568-
return(DB_IO_ERROR);
6563+
we disable linux native aio.
6564+
The disadvantage will be a small memory leak
6565+
at shutdown but that's ok compared to a crash
6566+
or a not working server.
6567+
This frequently happens when running the test suite
6568+
with many threads on a system with low fs.aio-max-nr!
6569+
*/
6570+
6571+
ib::warn()
6572+
<< "Warning: Linux Native AIO disabled "
6573+
<< "because _linux_create_io_ctx() "
6574+
<< "failed. To get rid of this warning you can "
6575+
<< "try increasing system "
6576+
<< "fs.aio-max-nr to 1048576 or larger or "
6577+
<< "setting innodb_use_native_aio = 0 in my.cnf";
6578+
ut_free(m_aio_ctx);
6579+
m_aio_ctx = 0;
6580+
srv_use_native_aio = FALSE;
6581+
return(DB_SUCCESS);
65696582
}
65706583
}
65716584

0 commit comments

Comments
 (0)