[MDEV-12226] Avoid writes of freed (garbage) pages to InnoDB data files Created: 2017-03-10  Updated: 2020-05-04  Resolved: 2020-04-20

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: 10.2.2
Fix Version/s: 10.5.2

Type: Bug Priority: Major
Reporter: Marko Mäkelä Assignee: Thirunarayanan Balathandayuthapani
Resolution: Fixed Votes: 0
Labels: performance, temporary

Attachments: File do_not_flush_freed_temp_pages.patch    
Issue Links:
Blocks
blocks MDEV-12227 Defer writes to the InnoDB temporary ... Closed
is blocked by MDEV-12219 Discard temporary undo logs at transa... Closed
Relates
relates to MDEV-15528 Avoid writing freed InnoDB pages Closed
relates to MDEV-16526 Overhaul the InnoDB page flushing Closed

 Description   

The flushing of the InnoDB temporary tablespace is unnecessarily tied to the write-ahead redo logging and the flushing of the persistent tablespaces.
It would be good to avoid any writes to the temporary tablespace, unless the pages are being evicted from the buffer pool and going to be reused.

This task is one step towards that goal: When a page in a temporary tablespace is marked as free, we should remove the page from the flush list. This will avoid unnecessary writes of garbage that is certainly not needed any more. (The freed pages would never be read back; instead new pages would be created.)



 Comments   
Comment by Marko Mäkelä [ 2018-04-05 ]

do_not_flush_freed_temp_pages.patch is a work-in-progress (non-working) patch that would implement part of this: when a page in the temporary tablespace is freed, it will be removed from the flush list.

Comment by Marko Mäkelä [ 2019-03-11 ]

Perhaps we should use asynchronous writes for advancing the redo log checkpoint, and synchronous I/O for anything else (page reads and writes).

For example, if a user thread wants to replace a buffer pool page with something else (to initialize or read a different page), then it could write a page to the temporary tablespace, unless the page was already marked to be free. This would be the only source of writes to the temporary tablespace file.

Read-ahead requests could be delegated to a background thread.

Comment by Marko Mäkelä [ 2020-04-20 ]

MDEV-15528 tracks freed pages and handles them in 3 ways:

  • Skip writing any page payload for freed pages. (This fixes MDEV-12226.)
  • For page_compressed tables, punch holes.
  • Else, if background scrubbing is enabled, overwrite freed pages with zeroes.

MDEV-8139 will further improve the scrubbing and may implement trimming of freed pages from the end of data files.

Generated at Thu Feb 08 07:56:05 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.