mariadb/storage/innobase/lock
Marko Mäkelä ef2f3d207b MDEV-16168: Performance regression after MDEV-12288
The function row_purge_reset_trx_id() that had been introduced in
commit 3c09f148f3 (MDEV-12288)
introduces some extra buffer pool and redo log activity that will
cause a significant performance regression under some workloads.

This is currently the most significant performance issue, after
commit acd071f599 (MDEV-21923)
fixed the InnoDB LSN allocation and MDEV-19749 the MDL bottleneck in 12.1.

The purpose of row_purge_reset_trx_id() was to ensure that we can
easily identify records for which no history exists. If DB_TRX_ID
is 0, we could avoid looking up the transaction to see if the
history is accessible or the record is implicitly locked.

To avoid trx_sys_t::find() for stale DB_TRX_ID values, we can refer
to trx_t::max_inactive_id, which was introduced in
commit 4105017a58 (MDEV-30357).
Instead of comparing DB_TRX_ID to 0, we may compare it to this
cached value. The cache would be updated by
trx_sys_t::find_same_or_older(), which is invoked for some operations
on secondary indexes.

row_purge_reset_trx_id(): Remove. We will no longer reset the
DB_TRX_ID to 0 after an INSERT. We will retain a single undo log
for all operations, though. Before MDEV-12288, there had been
separate insert_undo and update_undo logs.

row_check_index(): No longer warn
"InnoDB: Clustered index record with stale history in table".

lock_rec_queue_validate(), lock_rec_convert_impl_to_expl(),
row_vers_impl_x_locked_low(): Instead of comparing the DB_TRX_ID
to 0, compare it to trx_t::max_inactive_id.

In dict0load.cc we will not spend any effort to avoid extra
trx_sys.find() calls for stale DB_TRX_ID in dictionary tables.
This code does not currently use trx_t objects, and therefore
we cannot easily access trx_t::max_inactive_id. Loading table
definitions into the InnoDB data dictionary cache (dict_sys)
should be a very rare operation.

Reviewed by: Vladislav Lesin
2025-09-04 08:40:40 +03:00
..
lock0iter.cc MDEV-20612: Replace lock_sys.mutex with lock_sys.latch 2021-02-11 14:52:10 +02:00
lock0lock.cc MDEV-16168: Performance regression after MDEV-12288 2025-09-04 08:40:40 +03:00
lock0prdt.cc MDEV-35190 HASH_SEARCH duplicates effort before HASH_INSERT or HASH_DELETE 2024-11-21 08:59:02 +02:00