Details
-
Bug
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Fixed
-
10.3(EOL), 10.4(EOL), 10.5, 10.6, 10.7(EOL), 10.8(EOL), 10.9(EOL), 10.10(EOL), 10.11
Description
While reviewing some code to prepare for MDEV-24402, I came across the following.
In the case where the purge coordinator task invokes trx_purge_remove_log_hdr() outside of trx_purge_free_segment(), it would be possible to free the undo log page, provided that nothing was appended to the page after the purged records.
Undo log pages may contain records for many unrelated transactions. If no "reuse of cached undo pages" took place, we could simply free the undo page. This could avoid some page writes and improve the performance of backup and recovery. It could also avoid unnecessary growth of the system tablespace or the temporary tablespace when they store undo log pages.
Attachments
Issue Links
- causes
-
MDEV-33137 Assertion `end_lsn == page_lsn' failed in recv_recover_page
-
- Closed
-
- is blocked by
-
MDEV-30671 innodb_undo_log_truncate=ON fails to wait for purge of transaction history
-
- Closed
-
- relates to
-
MDEV-31382 SET GLOBAL innodb_undo_log_truncate=ON does not free space when no undo logs exist
-
- Closed
-
-
MDEV-21952 ibdata1 file size growing in MariaDB
-
- Closed
-
-
MDEV-24402 CHECK TABLE may miss some cases of index inconsistencies
-
- Closed
-
-
MDEV-26782 InnoDB temporary tablespace: reclaiming of free space does not work
-
- Closed
-
-
MDEV-29401 InnoDB history list length increased in 10.6 compared to 10.5 for the same load
-
- Closed
-
The logic for this is a little tricky. I think that we can do this in the case when we cannot invoke trx_purge_free_segment() because the state is not TRX_UNDO_TO_PURGE but TRX_UNDO_CACHED and all other conditions (which were recently revised in
MDEV-30671) hold.In this case, we should find exactly one entry in rseg.undo_cached that points to the last record in the undo log page. That entry as well as the TRX_RSEG_UNDO_SLOTS pointer to the cached undo page will have to be removed.
The rseg.undo_cached is also being used for temporary undo logs (see trx_undo_assign_low() and trx_undo_reuse_cached()), but there is no purge of history or MVCC for temporary tables. For temporary tables, we could modify trx_undo_commit_cleanup() so that it will never add anything to rseg.undo_cached and instead just free the undo page after commit.