From c4c88307091cb16886562e9e7b77f5fd077d34b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 17 Mar 2022 12:00:00 +0200 Subject: [PATCH 1/2] MDEV-28111 Redo log writes are being buffered on Linux for no good reason In commit 685d958e38b825ad9829be311f26729cccf37c46 (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 a635c40648519fd6c3729c9657872a16a0a20821 (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. --- storage/innobase/os/os0file.cc | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc index f37e239fc8b..ab7ed7ab061 100644 --- a/storage/innobase/os/os0file.cc +++ b/storage/innobase/os/os0file.cc @@ -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 @@ use_o_direct: 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); From bf8dc0be9e4bc26a57223ea1d642470980dc4bc4 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 17 Mar 2022 12:13:19 +0100 Subject: [PATCH 2/2] fix columnstore compilation after 33c30da16550 normally, one has to include my_global.h before including psi/psi*.h files. ColumnStore cannot do it, so it needs a workaround. --- storage/columnstore/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/storage/columnstore/CMakeLists.txt b/storage/columnstore/CMakeLists.txt index f2af02c2366..ebb138c70f0 100644 --- a/storage/columnstore/CMakeLists.txt +++ b/storage/columnstore/CMakeLists.txt @@ -5,6 +5,10 @@ if("NO" STREQUAL "${PLUGIN_COLUMNSTORE}") endif() add_definitions(-DBOOST_BIND_GLOBAL_PLACEHOLDERS) +IF(NOT PLUGIN_PERFSCHEMA STREQUAL NO) + add_definitions(-DHAVE_PSI_INTERFACE=) +ENDIF() + # this does everything, gets the var from the correct scope, appends new # values, sets in the correct scope