mariadb/storage/innobase
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
..
btr MDEV-29445: Reimplement SET GLOBAL innodb_buffer_pool_size 2025-03-26 17:05:44 +02:00
buf MDEV-21923: LSN allocation is a bottleneck 2025-04-10 13:02:17 +03:00
data Merge 10.7 into 10.8 2022-11-01 08:50:28 +02:00
dict Merge branch '10.6' into '10.11' 2025-04-02 06:33:39 +02:00
eval MDEV-26938 Support descending indexes internally in InnoDB 2022-01-26 18:43:05 +01:00
fil Merge branch '10.6' into 10.11 2025-01-30 11:55:13 +01:00
fsp MDEV-35000 preparation: Clean up dict_table_t::stat 2025-02-28 08:55:16 +02:00
fts MDEV-35000: dict_table_close() breaks STATS_AUTO_RECALC 2025-02-28 09:00:16 +02:00
fut MDEV-32175: Reduce page_align(), page_offset() calls 2024-11-21 11:01:30 +02:00
gis Merge 10.5 into 10.6 2025-03-26 17:09:57 +02:00
ha MDEV-35472 Server crash in ha_storage_put_memlim upon reading from INNODB_LOCKS 2024-11-25 10:31:57 +02:00
handler MDEV-21923: LSN allocation is a bottleneck 2025-04-10 13:02:17 +03:00
ibuf MDEV-29445: Reimplement SET GLOBAL innodb_buffer_pool_size 2025-03-26 17:05:44 +02:00
include MDEV-21923: LSN allocation is a bottleneck 2025-04-10 13:02:17 +03:00
lock MDEV-36122: Protect table references with a lock 2025-03-26 14:31:44 +02:00
log MDEV-21923: LSN allocation is a bottleneck 2025-04-10 13:02:17 +03:00
mem Cleanup: Remove duplicated code 2024-11-29 14:16:34 +02:00
mtr MDEV-21923: LSN allocation is a bottleneck 2025-04-10 13:02:17 +03:00
mysql-test/storage_engine Remove dates from all rdiff files 2025-01-05 16:40:11 +02:00
os Merge branch '10.6' into '10.11' 2025-04-02 06:33:39 +02:00
page Merge 10.6 into 10.11 2024-11-29 13:43:17 +02:00
pars Merge 10.6 into 10.11 2025-02-25 10:23:24 +02:00
que MDEV-24035 Failing assertion: UT_LIST_GET_LEN(lock.trx_locks) == 0 causing disruption and replication failure 2024-12-12 18:02:00 +02:00
read MDEV-34515: Contention between purge and workload 2024-08-26 12:23:06 +03:00
rem Merge 10.6 into 10.11 2024-03-28 09:16:57 +02:00
row MDEV-21923: LSN allocation is a bottleneck 2025-04-10 13:02:17 +03:00
srv MDEV-21923: LSN allocation is a bottleneck 2025-04-10 13:02:17 +03:00
sync Merge 10.6 into 10.11 2024-10-03 10:55:08 +03:00
trx Merge 10.6 into 10.11 2025-03-27 08:01:47 +02:00
unittest MDEV-35587 unit.innodb_sync leaks memory on mac 2024-12-12 10:27:36 +11:00
ut Merge 10.6 into 10.11 2024-12-19 15:38:53 +02:00
.clang-format-old switch off storage/innobase/.clang-format: InnoDB uses a common formatting style for all new code 2021-03-17 11:01:15 +03:00
CMakeLists.txt MDEV-35000: dict_table_close() breaks STATS_AUTO_RECALC 2025-02-28 09:00:16 +02:00
COPYING.Google
COPYING.Percona