MDEV-24883 add io_uring support for tpool

liburing is a new optional dependency (WITH_URING=auto|yes|no)
that replaces libaio when it is available.

aio_uring: class which wraps io_uring stuff

aio_uring::bind()/unbind(): optional optimization

aio_uring::submit_io(): mutex prevents data race. liburing calls are
thread-unsafe. But if you look into it's implementation you'll see
atomic operations. They're used for synchronization between kernel and
user-space only. That's why our own synchronization is still needed.

For systemd, we add LimitMEMLOCK=524288 (ulimit -l 524288)
because the io_uring_setup system call that is invoked
by io_uring_queue_init() requests locked memory. The value
was found empirically; with 262144, we would occasionally
fail to enable io_uring when using the maximum values of
innodb_read_io_threads=64 and innodb_write_io_threads=64.

aio_uring::thread_routine(): Tolerate -EINTR return from
io_uring_wait_cqe(), because it may occur on shutdown
on Ubuntu 20.10 (Groovy Gorilla).

This was mostly implemented by Eugene Kosov. Systemd integration
and improved startup/shutdown error handling by Marko Mäkelä.
This commit is contained in:
Marko Mäkelä 2021-03-15 11:30:17 +02:00
commit 783625d78f
17 changed files with 263 additions and 23 deletions

View file

@ -1,5 +1,5 @@
# Copyright (c) 2006, 2016, Oracle and/or its affiliates.
# Copyright (c) 2012, 2017, MariaDB
# Copyright (c) 2012, 2021, MariaDB
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

View file

@ -144,7 +144,7 @@ TimeoutStopSec=900
# Number of files limit. previously [mysqld_safe] open-files-limit
LimitNOFILE=16384
@SYSTEMD_LIMIT@
# Maximium core size. previously [mysqld_safe] core-file-size
# LimitCore=

View file

@ -269,7 +269,7 @@ Group=mysql
# Number of files limit. previously [mysqld_safe] open-files-limit
LimitNOFILE=16384
@SYSTEMD_LIMIT@
# Maximium core size. previously [mysqld_safe] core-file-size
# LimitCore=