mariadb/extra
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
..
aws_sdk MDEV-23539: aws key plugin - fails to build 2020-10-26 14:59:42 +11:00
mariabackup MDEV-34062: Implement innodb_log_file_mmap on 64-bit systems 2024-09-26 18:47:12 +03:00
readline Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
wolfssl New wolfssl v5.7.2-stable 2024-07-15 19:11:39 +02:00
charset2html.c Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
CMakeLists.txt Merge branch '10.5' into 10.6 2024-05-08 20:06:00 +02:00
comp_err.c MDEV-30810 errmsg-utf8.txt no longer uses charsets 2023-03-10 08:53:58 +11:00
innochecksum.cc Merge branch '10.9' into 10.10 2023-08-05 20:34:09 +02:00
my_print_defaults.c Merge 10.6 into 10.11 2023-12-20 15:58:36 +02:00
mysql_waitpid.c Added 'const' to arguments in get_one_option and find_typeset() 2021-02-08 12:16:29 +02:00
mysqld_safe_helper.c
perror.c MDEV-34714 perror-win test failure on localized Windows 2024-08-09 01:15:45 +02:00
replace.c Merge 10.4 into 10.5 2022-07-01 14:42:02 +03:00
resolve_stack_dump.c MDEV-22189: Change error messages inside code to have mariadb instead of 2021-05-24 11:38:13 +05:30
resolveip.c Added 'const' to arguments in get_one_option and find_typeset() 2021-02-08 12:16:29 +02:00