[MDEV-15090] Reduce the overhead of writing undo log records Created: 2018-01-26  Updated: 2021-06-21  Resolved: 2018-01-29

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Fix Version/s: 10.3.5

Type: Task Priority: Major
Reporter: Sergey Vojtovich Assignee: Marko Mäkelä
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Problem/Incident
causes MDEV-22770 trx_undo_report_rename() fails to rel... Closed
causes MDEV-25979 Invalid undo page number written to D... Closed
Epic Link: arm64 optimization

 Description   

oltp_update_index.lua benchmark commits mini transaction 5 times. This causes log_sys->mutex contention.

First two mini transactions (write of the first undo log record and the creation of the undo log header) can be combined.

This change was verified to give ~10% better throughput.



 Comments   
Comment by Marko Mäkelä [ 2018-01-29 ]

I had some doubts whether this is safe to do in all cases or if some deadlocks could be caused due to making changes to some pages after a page allocation. (There is a rule about that in operations that affect the change buffer; see the comment in the function btr_compress() which BTW is involved in the deadlock that has been reported in MDEV-14637.)

It turns out that whenever there is not enough space for the undo log record in the undo log page, InnoDB will commit the mini-transaction and start a new one. It also turns out that the undo log record write would be attempted on the same page that was already written to within trx_undo_assign_undo(). So, merging the mini-transactions should be completely safe.

Generated at Thu Feb 08 08:18:36 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.