mariadb/include
Marko Mäkelä 6acada713a MDEV-34062: Implement innodb_log_file_mmap on 64-bit systems
When using the default innodb_log_buffer_size=2m, mariadb-backup --backup
would spend a lot of time re-reading and re-parsing the log. For reads,
it would be beneficial to memory-map the entire ib_logfile0 to the
address space (typically 48 bits or 256 TiB) and read it from there,
both during --backup and --prepare.

We will introduce the Boolean read-only parameter innodb_log_file_mmap
that will be OFF by default on most platforms, to avoid aggressive
read-ahead of the entire ib_logfile0 in when only a tiny portion would be
accessed. On Linux and FreeBSD the default is innodb_log_file_mmap=ON,
because those platforms define a specific mmap(2) option for enabling
such read-ahead and therefore it can be assumed that the default would
be on-demand paging. This parameter will only have impact on the initial
InnoDB startup and recovery. Any writes to the log will use regular I/O,
except when the ib_logfile0 is stored in a specially configured file system
that is backed by persistent memory (Linux "mount -o dax").

We also experimented with allowing writes of the ib_logfile0 via a
memory mapping and decided against it. A fundamental problem would be
unnecessary read-before-write in case of a major page fault, that is,
when a new, not yet cached, virtual memory page in the circular
ib_logfile0 is being written to. There appears to be no way to tell
the operating system that we do not care about the previous contents of
the page, or that the page fault handler should just zero it out.

Many references to HAVE_PMEM have been replaced with references to
HAVE_INNODB_MMAP.

The predicate log_sys.is_pmem() has been replaced with
log_sys.is_mmap() && !log_sys.is_opened().

Memory-mapped regular files differ from MAP_SYNC (PMEM) mappings in the
way that an open file handle to ib_logfile0 will be retained. In both
code paths, log_sys.is_mmap() will hold. Holding a file handle open will
allow log_t::clear_mmap() to disable the interface with fewer operations.

It should be noted that ever since
commit 685d958e38 (MDEV-14425)
most 64-bit Linux platforms on our CI platforms
(s390x a.k.a. IBM System Z being a notable exception) read and write
/dev/shm/*/ib_logfile0 via a memory mapping, pretending that it is
persistent memory (mount -o dax). So, the memory mapping based log
parsing that this change is enabling by default on Linux and FreeBSD
has already been extensively tested on Linux.

::log_mmap(): If a log cannot be opened as PMEM and the desired access
is read-only, try to open a read-only memory mapping.

xtrabackup_copy_mmap_snippet(), xtrabackup_copy_mmap_logfile():
Copy the InnoDB log in mariadb-backup --backup from a memory
mapped file.
2024-09-26 18:47:12 +03:00
..
atomic MDEV-19696 - Cleanup gcc sync builtins 2019-07-03 12:11:22 +03:00
mysql Merge 10.6 into 10.11 2024-02-08 15:04:46 +02:00
providers support lzma < 5.1.3alpha 2022-02-09 19:13:52 +01:00
aligned.h Revert aligned_alloc() addition from MDEV-28836 2022-08-22 09:10:40 +03:00
aria_backup.h S3 is pluggable now 2020-06-19 19:43:07 +02:00
assume_aligned.h Remove a misleading copyright message 2020-03-21 10:25:54 +02:00
big_endian.h Update FSF address 2019-05-11 19:25:02 +03:00
byte_order_generic.h Fix all warnings given by UBSAN 2021-04-20 12:30:09 +03:00
byte_order_generic_x86.h Fix all warnings given by UBSAN 2021-04-20 12:30:09 +03:00
byte_order_generic_x86_64.h typo fixed. HAVE_mi_uint8korr 2023-11-02 19:42:39 +11:00
CMakeLists.txt post fix for "move alloca() definition from all *.h files to one new header file" 2023-03-08 17:36:36 +01:00
decimal.h Added typedef decimal_digits_t (uint16) for number of digits in most 2021-05-19 22:27:27 +02:00
dur_prop.h Merge InnoDB 5.7 from mysql-5.7.9. 2016-09-02 13:22:28 +03:00
errmsg.h test cases for MySQL bugs 2022-01-21 16:02:34 +01:00
ft_global.h MDEV-23269 SIGSEGV in ft_boolean_check_syntax_string on setting ft_boolean_syntax 2021-10-11 17:43:23 +04:00
handler_ername.h Merge branch '10.5' into 10.6 2023-08-01 15:08:52 +02:00
handler_state.h Fix for MDEV-533: Confusing error code when doing auto-increment insert for out-of-range values 2012-09-18 15:14:19 +03:00
hash.h MDEV-26221: DYNAMIC_ARRAY use size_t for sizes 2021-10-19 16:00:26 +03:00
heap.h Merge 10.4 into 10.5 2023-01-03 17:08:42 +02:00
ilist.h Merge 10.6 into 10.8 2023-02-10 13:43:53 +02:00
json_lib.h Merge branch '10.6' into 10.9 2023-08-04 08:01:06 +02:00
keycache.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
lf.h MDEV-23510: arm64 lf_hash alignment of pointers 2021-02-25 10:06:15 +11:00
little_endian.h Update FSF address 2019-05-11 19:25:02 +03:00
m_ctype.h Merge branch '10.6' into 10.11 2023-12-18 11:19:04 +01:00
m_string.h Merge 10.6 into 10.11 2024-08-14 11:36:52 +03:00
ma_dyncol.h Merge 10.4 into 10.5 2023-01-03 17:08:42 +02:00
maria.h cleanup: Aria headers 2020-06-19 19:43:07 +02:00
mariadb_capi_rename.h MDEV-27295 Backport SQL service, introduced by MDEV-19275. 2023-11-05 23:35:32 +04:00
my_alarm.h Merge 10.4 into 10.5 2022-11-08 17:01:28 +02:00
my_alloc.h Merge branch '10.6' into 10.11 2023-12-18 11:19:04 +01:00
my_alloca.h Merge branch '10.4' into 10.5 2023-04-24 12:43:47 +02:00
my_atomic.h MDEV-17441 fixup: Remove unused my_atomic long macros 2022-03-24 09:53:52 +02:00
my_atomic_wrapper.h Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
my_attribute.h Check and remove high stack usage 2024-04-23 14:12:31 +03:00
my_base.h Merge 10.6 into 10.11 2024-03-28 09:16:57 +02:00
my_bit.h Coding style fixes 2020-04-04 14:55:51 +04:00
my_bitmap.h Merge 10.6 into 10.11 2024-03-28 09:16:57 +02:00
my_byteorder.h MDEV-25870 Windows - fix ARM64 cross-compilation 2021-06-07 23:15:36 +02:00
my_check_opt.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
my_compare.h Merge branch '10.4' into 10.5 2023-11-08 12:59:00 +01:00
my_compiler.h MDEV-29152: Assertion failed ... upon TO_CHAR with wrong argument 2023-07-12 12:05:59 +03:00
my_counter.h Apply clang-tidy to remove empty constructors / destructors 2023-02-09 16:09:08 +02:00
my_cpu.h Merge branch '10.5' into 10.6 2024-09-06 13:52:57 +10:00
my_crypt.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
my_dbug.h Merge branch '10.6' into 10.7 2022-10-04 07:41:35 +02:00
my_decimal_limits.h header typos 2022-12-20 08:55:48 +11:00
my_default.h MDEV-22214 mariadbd.exe calls function mysqld.exe, and crashes 2020-04-10 19:05:26 +02:00
my_dir.h Merge 10.6 into 10.7 2023-01-04 14:52:25 +02:00
my_getopt.h Added 'const' to arguments in get_one_option and find_typeset() 2021-02-08 12:16:29 +02:00
my_global.h Merge 10.6 into 10.11 2024-03-28 09:16:57 +02:00
my_handler_errors.h Merge commit '10.4' into 10.5 2023-07-20 11:54:52 +02:00
my_libwrap.h Update FSF Address 2019-05-11 21:29:06 +03:00
my_list.h Update FSF Address 2019-05-11 21:29:06 +03:00
my_md5.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
my_minidump.h MDEV-11499 mysqltest, Windows : improve diagnostics if server fails to shutdown 2021-09-24 11:49:28 +02:00
my_net.h MDEV-25602 get rid of __WIN__ in favor of standard _WIN32 2021-06-06 13:21:03 +02:00
my_nosys.h Update FSF Address 2019-05-11 21:29:06 +03:00
my_pthread.h Merge branch '10.5' into 10.6 2024-01-11 12:59:22 +11:00
my_rdtsc.h Merge 10.6 into 10.11 2024-06-11 12:50:10 +03:00
my_rnd.h remove dead code 2022-07-31 14:54:37 +02:00
my_service_manager.h MDEV-10183 implement service_manager_extend_timeout on Windows 2022-04-11 07:49:43 +02:00
my_stack_alloc.h perfschema memory related instrumentation changes 2020-03-10 19:24:22 +01:00
my_stacktrace.h MDEV-25602 get rid of __WIN__ in favor of standard _WIN32 2021-06-06 13:21:03 +02:00
my_sys.h MDEV-34062: Implement innodb_log_file_mmap on 64-bit systems 2024-09-26 18:47:12 +03:00
my_time.h Merge 10.3 into 10.4 2022-04-06 08:59:09 +03:00
my_tree.h Merge 10.2 into 10.3 2019-05-14 17:18:46 +03:00
my_uctype.h Update FSF Address 2019-05-11 21:29:06 +03:00
my_user.h Merge 10.2 into 10.3 2019-05-14 17:18:46 +03:00
my_valgrind.h Cleanup: Remove IF_VALGRIND 2022-04-25 09:40:40 +03:00
my_xml.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
myisam.h Merge 10.4 into 10.5 2023-01-03 17:08:42 +02:00
myisamchk.h Merge branch '10.4' into 10.5 2023-12-02 01:02:50 +01:00
myisammrg.h MDEV-31083 ASAN use-after-poison in myrg_attach_children 2023-05-23 09:16:36 +03:00
myisampack.h MDEV-29473 UBSAN: Signed integer overflow: X * Y cannot be represented in type 'int' in strings/dtoa.c 2022-11-17 17:51:01 +04:00
mysql.h Merge branch '10.6' into 10.11 2023-12-18 11:19:04 +01:00
mysql_com.h Merge from 10.4 to 10.5 2024-04-15 17:46:49 +02:00
mysql_com_server.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
mysql_embed.h Merge branch '10.3' into 10.4 2019-05-19 20:55:37 +02:00
mysql_time.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
mysql_version.h.in Merge 10.3 into 10.4 2020-10-29 13:38:38 +02:00
mysqld_default_groups.h Fixed that mariadb-# binaries reads their corresponding entry from my.cnf 2019-07-18 15:32:22 +03:00
mysys_err.h MDEV-7947 strcmp() takes 0.37% in OLTP RO 2020-07-23 10:54:33 +03:00
no_valgrind_without_big.inc MDEV-31893 Valgrind reports issues in main.join_cache_notasan 2023-08-10 20:57:42 +02:00
pack.h Merge branch '10.2' into bb-10.2-connector-c-integ-subm 2016-09-21 12:54:56 +02:00
password.h Merge 10.2 into 10.3 2019-05-14 17:18:46 +03:00
pfs_file_provider.h perfschema compilation, test and misc fixes 2020-03-10 19:24:23 +01:00
pfs_idle_provider.h P_S 5.7.28 2020-03-10 19:24:22 +01:00
pfs_memory_provider.h P_S 5.7.28 2020-03-10 19:24:22 +01:00
pfs_metadata_provider.h P_S 5.7.28 2020-03-10 19:24:22 +01:00
pfs_socket_provider.h P_S 5.7.28 2020-03-10 19:24:22 +01:00
pfs_stage_provider.h P_S 5.7.28 2020-03-10 19:24:22 +01:00
pfs_statement_provider.h P_S 5.7.28 2020-03-10 19:24:22 +01:00
pfs_table_provider.h P_S 5.7.28 2020-03-10 19:24:22 +01:00
pfs_thread_provider.h Merge branch 'merge-perfschema-5.7' into 10.5 2022-08-02 09:34:15 +02:00
pfs_transaction_provider.h cleanup: pass trxid by value 2020-03-10 19:24:23 +01:00
probes_mysql.d.base Update FSF Address 2019-05-11 21:29:06 +03:00
probes_mysql.h Update FSF Address 2019-05-11 21:29:06 +03:00
probes_mysql_nodtrace.h.in Merge branch '5.5' into 10.0 2016-02-15 22:50:59 +01:00
queues.h header typos 2022-12-20 08:55:48 +11:00
rijndael.h Update FSF Address 2019-05-11 21:29:06 +03:00
scope.h MDEV-18543 IMPORT TABLESPACE fails after instant DROP COLUMN 2021-10-26 22:50:58 +06:00
service_versions.h Merge 10.6 into 10.11 2024-02-08 15:04:46 +02:00
source_revision.h.in SOURCE_REVISION should always be defined in source_revision.h 2017-11-01 13:20:32 +00:00
span.h Apply clang-tidy to remove empty constructors / destructors 2023-02-09 16:09:08 +02:00
sql_common.h Merge branch '10.5' into 10.6 2023-12-17 11:20:43 +01:00
ssl_compat.h Merge branch '10.6' into 10.9 2023-08-04 08:01:06 +02:00
sslopt-case.h MDEV-25511: Command line tools don't support CRL parameters 2021-05-31 08:29:37 +02:00
sslopt-longopts.h Merge branch '10.6' into 10.11 2024-05-10 20:02:18 +02:00
sslopt-vars.h MDEV-27105 --ssl option set as default for mariadb CLI 2022-07-28 17:18:39 +02:00
t_ctype.h Update FSF Address 2019-05-11 21:29:06 +03:00
thr_alarm.h MDEV-25602 get rid of __WIN__ in favor of standard _WIN32 2021-06-06 13:21:03 +02:00
thr_lock.h MDEV-13115: Implement SELECT SKIP LOCKED 2021-04-08 16:51:36 +10:00
thr_timer.h MDEV-16264 - prerequisite patch, periodic thr_timer 2019-11-15 16:50:22 +01:00
typelib.h Added 'const' to arguments in get_one_option and find_typeset() 2021-02-08 12:16:29 +02:00
violite.h MDEV-33582 Add more warnings to be able to better diagnose network issues 2024-03-05 20:19:49 +02:00
waiting_threads.h header typos 2022-12-20 08:55:48 +11:00
welcome_copyright_notice.h Update FSF Address 2019-05-11 21:29:06 +03:00
wqueue.h Merge 10.2 into 10.3 2019-05-14 17:18:46 +03:00
wsrep.h Reduce compilation dependencies on wsrep_mysqld.h 2022-08-31 11:05:23 +03:00