[MDEV-15528] Avoid writing freed InnoDB pages Created: 2018-03-09 Updated: 2023-12-22 Resolved: 2020-03-10 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - InnoDB |
| Affects Version/s: | 10.1.3, 10.2.0, 10.3.0 |
| Fix Version/s: | 10.5.2 |
| Type: | Bug | Priority: | Major |
| Reporter: | Marko Mäkelä | Assignee: | Thirunarayanan Balathandayuthapani |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | performance | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Description |
|
When a InnoDB data file page is freed, its contents becomes garbage, and any storage allocated in the data file is wasted. MariaDB 10.4 introduced an InnoDB redo log record MLOG_INIT_FREE_PAGE for marking pages as freed. In If innodb_immediate_scrub_data_uncompressed is set, we should initialize the page with zeros. This will replace some of the non-working scrubbing logic ( The following parameters will be deprecated and ignored and the problematic ‘background scrubbing’ code removed:
For page_compressed tables the freed page will be hole-punched |
| Comments |
| Comment by Marko Mäkelä [ 2019-02-08 ] | |||||||||||||||||||
|
MariaDB 10.4.3 will introduce a MLOG_INIT_FREE_PAGE record for this purpose. This allows this bug to be fixed in MariaDB 10.4 later without breaking crash-downgrade to earlier MariaDB 10.4 versions. In | |||||||||||||||||||
| Comment by Marko Mäkelä [ 2019-04-08 ] | |||||||||||||||||||
|
I think that this is realistic to do in the 10.4 time frame. Assigning to myself, because this is closely related to | |||||||||||||||||||
| Comment by Marko Mäkelä [ 2019-04-18 ] | |||||||||||||||||||
|
When scrubbing is not enabled and the page is not on SSD and the file is not page_compressed, we can discard the page from the buf_pool->flush_list once the MLOG_INIT_FREE_PAGE record has been written. For scrubbing, it is kind of mandatory to initialize the page. For non-compressed tables on SSD, we will have to evaluate whether punching holes is going to improve or hurt performance on the average. | |||||||||||||||||||
| Comment by Marko Mäkelä [ 2020-01-27 ] | |||||||||||||||||||
|
As part of this, we should simplify the freeing of B-tree root pages:
(Obviously, also the code inside if (invalidate) should be removed and the callers be adjusted.) | |||||||||||||||||||
| Comment by Marko Mäkelä [ 2020-03-09 ] | |||||||||||||||||||
|
This looks OK to me, after addressing my feedback for commit 1 of 2. We will address the following later, ideally before the 10.5 GA release:
| |||||||||||||||||||
| Comment by Thirunarayanan Balathandayuthapani [ 2020-03-10 ] | |||||||||||||||||||
|
Patch has been pushed to 10.5. Thanks to marko and @matthias.leich for testing abd reviewing it |