mariadb/extra/mariabackup
Marko Mäkelä acd071f599 MDEV-21923: LSN allocation is a bottleneck
The parameter innodb_log_spin_wait_delay will be deprecated and
ignored, because there is no spin loop anymore.

Thanks to commit 685d958e38
and commit a635c40648
multiple mtr_t::commit() can concurrently copy their slice of
mtr_t::m_log to the shared log_sys.buf.  Each writer would allocate
their own log sequence number by invoking log_t::append_prepare()
while holding a shared log_sys.latch.  This function was too heavy,
because it would invoke a minimum of 4 atomic read-modify-write
operations as well as system calls in the supposedly fast code path.

It turns out that with a simpler data structure, instead of having
several data fields that needed to be kept consistent with each other,
we only need one Atomic_relaxed<uint64_t> write_lsn_offset, on which
we can operate using fetch_add(), fetch_sub() as well as a single-bit
fetch_or(), which reasonably modern compilers (GCC 7, Clang 15 or later)
can translate into loop-free code on AMD64.

Before anything can be written to the log, log_sys.clear_mmap()
must be invoked.

log_t::base_lsn: The LSN of the last write_buf() or persist().
This is a rough approximation of log_sys.lsn, which will be removed.

log_t::write_lsn_offset: An Atomic_relaxed<uint64_t> that buffers
updates of write_to_buf and base_lsn.

log_t::buf_free, log_t::max_buf_free, log_t::lsn. Remove.
Replaced by base_lsn and write_lsn_offset.

log_t::buf_size: Always reflects the usable size in append_prepare().

log_t::lsn_lock: Remove.  For the memory-mapped log in resize_write(),
there will be a resize_wrap_mutex.

log_t::get_lsn_approx(): Return a lower bound of get_lsn().
This should be exact unless append_prepare_wait() is pending.

log_get_lsn(): A wrapper for log_sys.get_lsn(), which must be invoked
while holding an exclusive log_sys.latch.

recv_recovery_from_checkpoint_start(): Do not invoke fil_names_clear();
it would seem to be unnecessary.

In many places, references to log_sys.get_lsn() are replaced with
log_sys.get_flushed_lsn(), which remains a simple std::atomic::load().

Reviewed by: Debarun Banerjee
2025-04-10 13:02:17 +03:00
..
quicklz MDEV-9566 Add Percona Xtrabackup 2.3.7 2017-04-27 19:12:39 +02:00
aria_backup_client.cc Fix a typo which lead to compiler error on 32 bit systems 2024-04-09 17:11:49 +02:00
aria_backup_client.h MDEV-32932 Port backup features from ES 2024-02-27 20:55:54 +02:00
backup_copy.cc Merge 10.6 into 10.11 2024-10-03 10:55:08 +03:00
backup_copy.h MDEV-32932 fix comments to match the code 2024-04-22 15:27:14 +02:00
backup_debug.h MDEV-32932 Port backup features from ES 2024-02-27 20:55:54 +02:00
backup_mysql.cc MDEV-36253 Redundant check in wf_incremental_process() 2025-03-10 11:48:18 +05:30
backup_mysql.h Merge 10.6 into 10.11 2025-01-08 12:51:26 +02:00
backup_wsrep.h Merge 10.1 into 10.2 2019-05-13 17:54:04 +03:00
CMakeLists.txt MDEV-33091 pcre2 headers aren't found on Solaris 2024-09-05 12:14:06 +10:00
common.h MDEV-33379 innodb_log_file_buffering=OFF causes corruption on bcachefs 2024-02-20 11:22:45 +02:00
common_engine.cc MDEV-36437 mariabackup - confusing error message when running out of file handles with partitioned MyISAM 2025-03-31 17:57:35 +02:00
common_engine.h MDEV-32932 Port backup features from ES 2024-02-27 20:55:54 +02:00
datasink.cc MDEV-32932 Port backup features from ES 2024-02-27 20:55:54 +02:00
datasink.h MDEV-32932 Port backup features from ES 2024-02-27 20:55:54 +02:00
ddl_log.cc MDEV-32932 Port backup features from ES 2024-02-27 20:55:54 +02:00
ddl_log.h MDEV-32932 Port backup features from ES 2024-02-27 20:55:54 +02:00
ds_buffer.cc MDEV-32932 Port backup features from ES 2024-02-27 20:55:54 +02:00
ds_buffer.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
ds_compress.cc MDEV-32932 Port backup features from ES 2024-02-27 20:55:54 +02:00
ds_compress.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
ds_local.cc MDEV-32932 Port backup features from ES 2024-02-27 20:55:54 +02:00
ds_local.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
ds_stdout.cc MDEV-32932 Port backup features from ES 2024-02-27 20:55:54 +02:00
ds_stdout.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
ds_tmpfile.cc MDEV-32932 Port backup features from ES 2024-02-27 20:55:54 +02:00
ds_tmpfile.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
ds_xbstream.cc MDEV-32932 Port backup features from ES 2024-02-27 20:55:54 +02:00
ds_xbstream.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
encryption_plugin.cc Merge branch '10.6' into 10.11 2025-01-10 13:14:42 +01:00
encryption_plugin.h MDEV-32932 Port backup features from ES 2024-02-27 20:55:54 +02:00
fil_cur.cc Merge 10.6 into 10.11 2025-01-08 12:51:26 +02:00
fil_cur.h Merge 10.6 into 10.11 2024-02-14 16:12:53 +02:00
innobackupex.cc MDEV-29445: Reimplement SET GLOBAL innodb_buffer_pool_size 2025-03-26 17:05:44 +02:00
innobackupex.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
read_filt.cc Cleanup: Remove changed_pages_bitmap 2024-02-12 17:01:35 +02:00
read_filt.h Cleanup: Remove changed_pages_bitmap 2024-02-12 17:01:35 +02:00
thread_pool.cc MDEV-32932 Port backup features from ES 2024-02-27 20:55:54 +02:00
thread_pool.h MDEV-32932 Port backup features from ES 2024-02-27 20:55:54 +02:00
write_filt.cc MDEV-36253 Redundant check in wf_incremental_process() 2025-03-10 11:48:18 +05:30
write_filt.h MDEV-31039 mariadb-backup: remove global variables ds_data and ds_meta 2023-04-12 15:14:03 +04:00
wsrep.cc MDEV-32932 Port backup features from ES 2024-02-27 20:55:54 +02:00
xb_regex.h MDEV-14024 PCRE2. 2019-12-21 10:34:02 +01:00
xbcloud.cc Fix few vulnerabilities found by Cppcheck 2023-03-02 14:38:24 +11:00
xbstream.cc Merge 10.6 into 10.11 2024-11-29 13:43:17 +02:00
xbstream.h MDEV-32932 Port backup features from ES 2024-02-27 20:55:54 +02:00
xbstream_read.cc MDEV-32932 Port backup features from ES 2024-02-27 20:55:54 +02:00
xbstream_write.cc MDEV-32932 Port backup features from ES 2024-02-27 20:55:54 +02:00
xtrabackup.cc MDEV-21923: LSN allocation is a bottleneck 2025-04-10 13:02:17 +03:00
xtrabackup.h MDEV-32932 Port backup features from ES 2024-02-27 20:55:54 +02:00