Commit c4c88307 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-28111 Redo log writes are being buffered on Linux for no good reason

In commit 685d958e (MDEV-14425)
we ended up not enabling O_DIRECT writes on the redo log
by default, because back then, it was slightly slower on
some systems.

With commit a635c406 (MDEV-27774)
the situation changed. A new test on a NVMe device shows 9%
improvement in throughput and over 15% reduction of latency
when O_DIRECT writes are enabled.

With this change, all the following settings will use O_DIRECT
on InnoDB data and log files:

innodb_flush_method=O_DIRECT
innodb_flush_method=O_DIRECT_NO_FSYNC
innodb_flush_method=O_DSYNC

Before MDEV-14425, log writes were always buffered on Linux.
Between MDEV-14425 and this change, unbuffered log writes
were only enabled for innodb_flush_method=O_DSYNC.
parent 86820837
......@@ -1290,13 +1290,13 @@ os_file_create_func(
#if (defined(UNIV_SOLARIS) && defined(DIRECTIO_ON)) || defined O_DIRECT
if (type == OS_DATA_FILE) {
# ifdef __linux__
use_o_direct:
# endif
switch (srv_file_flush_method) {
case SRV_O_DSYNC:
case SRV_O_DIRECT:
case SRV_O_DIRECT_NO_FSYNC:
# ifdef __linux__
use_o_direct:
# endif
os_file_set_nocache(file, name, mode_str);
break;
default:
......@@ -1349,9 +1349,7 @@ os_file_create_func(
goto skip_o_direct;
}
log_sys.set_block_size(uint32_t(s));
if (srv_file_flush_method == SRV_O_DSYNC) {
goto use_o_direct;
}
goto use_o_direct;
} else {
skip_o_direct:
log_sys.set_block_size(0);
......
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