Commit 1193a793 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-26674: Set innodb_use_native_aio=OFF when using io_uring on a potentially affected kernel

We have observed hangs of the io_uring subsystem when using a
Linux kernel newer than 5.10. Also 5.15-rc6 is affected by this.

The exact cause of the hangs has not been diagnosed yet.
As a safety measure, we will disable innodb_use_native_aio by default
when the server has been configured with io_uring and the kernel
version is between 5.11 and 5.15.

If the start-up parameter innodb_use_native_aio=ON is set, then
we will issue a warning to the server error log.
parent 1f022809
......@@ -150,6 +150,11 @@ void close_thread_tables(THD* thd);
#include "wsrep_sst.h"
#endif /* WITH_WSREP */
#ifdef HAVE_URING
/** The Linux kernel version if io_uring() is considered unsafe */
static const char *io_uring_may_be_unsafe;
#endif
#define INSIDE_HA_INNOBASE_CC
#define EQ_CURRENT_THD(thd) ((thd) == current_thd)
......@@ -4046,6 +4051,14 @@ static int innodb_init_params()
cases, we ignore the setting of innodb_use_native_aio. */
srv_use_native_aio = FALSE;
#endif
#ifdef HAVE_URING
if (srv_use_native_aio && io_uring_may_be_unsafe) {
sql_print_warning("innodb_use_native_aio may cause "
"hangs with this kernel %s; see "
"https://jira.mariadb.org/browse/MDEV-26674",
io_uring_may_be_unsafe);
}
#endif
#ifndef _WIN32
ut_ad(srv_file_flush_method <= SRV_O_DIRECT_NO_FSYNC);
......@@ -19393,10 +19406,29 @@ static MYSQL_SYSVAR_STR(version, innodb_version_str,
PLUGIN_VAR_NOCMDOPT | PLUGIN_VAR_READONLY,
"InnoDB version", NULL, NULL, INNODB_VERSION_STR);
#ifdef HAVE_URING
# include <sys/utsname.h>
static utsname uname_for_io_uring;
#endif
static bool innodb_use_native_aio_default()
{
#ifdef HAVE_URING
utsname &u= uname_for_io_uring;
if (!uname(&u) && u.release[0] == '5' && u.release[1] == '.' &&
u.release[2] == '1' && u.release[3] > '0' && u.release[3] < '6')
{
io_uring_may_be_unsafe= u.release;
return false; /* working around io_uring hangs (MDEV-26674) */
}
#endif
return true;
}
static MYSQL_SYSVAR_BOOL(use_native_aio, srv_use_native_aio,
PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
"Use native AIO if supported on this platform.",
NULL, NULL, TRUE);
NULL, NULL, innodb_use_native_aio_default());
#ifdef HAVE_LIBNUMA
static MYSQL_SYSVAR_BOOL(numa_interleave, srv_numa_interleave,
......
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