-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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. That is what we will be doing by default. We can also enable memory-mapped log writes in case the new parameter innodb_log_file_mmap is set to ON. This could speed up I/O and allow the log data to be shared between mariadbd and mariadb-backup --backup in the RAM buffer. Memory-mapped regular files differ from log_sys.is_pmem() in the way that an open file handle to ib_logfile0 will be retained. That allows log_t::set_mmap() to enable or disable the interface with fewer operations. On log checkpoint we will invoke madvise() with MADV_DONTNEED in order to reduce the memory pressure. This could lead to reads of old garbage contents of the circular log file when a page fault occurs while writing a record. There does not seem to be any way around this; on Linux, invoking fallocate() with FALLOC_FL_ZERO_RANGE would make things even worse by triggering additional metadata writes. Most references to HAVE_PMEM or log_sys.is_pmem() are replaced with HAVE_INNODB_MMAP or log_sys.is_mmap(). The main difference is that PMEM skips the use of write_lock and flush_lock and uses pmem_persist(), while the memory-mapped interface will use a combination of msync() and fdatasync(). Starting with Linux 2.6.19, msync(MS_ASYNC) is a no-op, so we will not invoke it on Linux. For durable writes, we will invoke msync(MS_SYNC). Note: It is probably not advisable to enable memory-mapped log writes. It could make sense with a small innodb_log_file_size that fits in RAM. TODO: Can we avoid aggressive read-ahead of all of a huge ib_logfile0 in mariadb-backup when a tiny portion would be accessed? On Microsoft Windows, this seems to be an issue.
- Loading branch information
Showing
22 changed files
with
755 additions
and
307 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.