mariadb/storage/innobase/handler
Marko Mäkelä 7614f8fb5d MDEV-38589: SELECT unnecessarily waits for log write
The design of "binlog group commit" involves carrying some state across
transaction boundaries. This includes trx_t::commit_lsn, which keeps track
of how much write-ahead log needs to be written. Unfortunately, this
field was not reset in a commit where a log write was elided. That would
cause an unnecessary wait in a subsequent read-only transaction that
happened to reuse the same transaction object.

trx_deregister_from_2pc(): Reset trx->commit_lsn so that
an earlier write that was executed in the same client connection
will not result in an unnecessary wait during a subsequent read
operation.

trx_commit_complete_for_mysql(): Unless we are inside a binlog
group commit, reset trx->commit_lsn.

unlock_and_close_files(): Reset trx->commit_lsn after durably
writing the log, and remove a redundant log write call from some
callers.

trx_t::rollback_finish(): Clear commit_lsn, because a rolled-back
transaction will not need to be durably written.

trx_t::clear_and_free(): Wrapper function to suppress a debug check
in trx_t::free().

Also, remove some redundant ut_ad(!trx->will_lock) that will be checked
in trx_t::free().

Reviewed by: Vladislav Vaintroub
2026-01-28 13:24:09 +02:00
..
ha_innodb.cc MDEV-38589: SELECT unnecessarily waits for log write 2026-01-28 13:24:09 +02:00
ha_innodb.h Merge 10.6 into 10.11 2025-09-24 12:48:56 +03:00
handler0alter.cc MDEV-38589: SELECT unnecessarily waits for log write 2026-01-28 13:24:09 +02:00
i_s.cc Fixed that one can compile MariaDB with ASAN with -Wframe-larger-than=16384 2025-09-04 18:08:38 +03:00
i_s.h Merge 10.5 into 10.6 2021-08-23 11:21:33 +03:00