[MDEV-29694] Remove the InnoDB change buffer Created: 2022-10-04 Updated: 2023-09-19 Resolved: 2023-01-11 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - InnoDB |
| Fix Version/s: | 11.0.1 |
| Type: | Task | Priority: | Blocker |
| Reporter: | Marko Mäkelä | Assignee: | Marko Mäkelä |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | Preview_11.0, corruption, performance | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Description |
|
The next logical step is to remove the parameter altogether, along with any code that would create the change buffer or add records to it. An attempt to downgrade to an earlier version will be caught and prevented by In order to be able to simplify the buffer pool interfaces, upgrading will be split in two parts: First, check if an upgrade is needed. If it is, we will apply all redo log, possibly upgrade the redo log to the current format, and then attempt to upgrade the change buffer:
If an error occurs during before the final upgrade step, it should be possible to downgrade to MariaDB Server 10.8 or a later version (using the currently latest redo log format that was changed in As noted in |
| Comments |
| Comment by Marko Mäkelä [ 2022-11-30 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The code to upgrade the MySQL 3.23 or MySQL 4.0 change buffer (before the introduction of innodb_file_per_table) was removed in MySQL 5.6.5 and in MariaDB 10.0.11. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2022-12-01 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
mleich, I only tested the upgrade of an empty change buffer. Can you please provide a copy of a 10.6 data directory where the change buffer is not empty, for some additional testing by me? Use innodb_change_buffering_debug=1 and update an indexed secondary index field, and shut down normally, without innodb_fast_shutdown=0. The current implementation is missing an upgrade of the redo log format before upgrading the change buffer. Please pay special attention to testing SPATIAL INDEX, because as part of removing the change buffer, the field btr_cur_t::thr was removed. The innodb_gis test suite passed (including the disabled sporadically failing tests), but I think that we need some more testing there. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2022-12-02 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The upgrade from a nonempty change buffer can be tested with the following patch applied to an earlier version:
The test will fail like this:
After that, we can find a data directory in mysql-test/var/log/innodb.ibuf_not_empty*/mysqld.1/data on which we can test the upgrade:
This will actually crash with the current code (trying an upgrade from 10.6):
The upgrade needs to be revised so that the log will be upgraded to the most recent format (
What if we upgraded before corrupting the change buffer bitmap?
Unfortunately, the result is the same. I will fix these issues. This should not block the testing of the bulk of the changes (that everything still works during normal operation). | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2022-12-02 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The change buffer contains 34 buffered insert operations, all for a single index page. That coincides with the reported mismatch. I fixed a few things, but I still have to add the opening of data files, so that the buffered changes can be merged. I think that we can find the tablespaces by scanning the clustered index of SYS_TABLES. Accessing the secondary indes on SYS_TABLES.ID is out of the question, because there may exist buffered changes for that index. The upgrade must follow a particular order:
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2022-12-02 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2022-12-02 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I fixed the upgrade from 10.6 and 10.8 using the above test. It only covers buffered inserts, not delete-mark or purge operations. And there were buffered inserts only to one index page. Additional testing of the upgrades will be needed. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2022-12-05 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Sysbench oltp_update_index did not use the change buffer, no matter what I tried (yes, it included innodb_change_buffering_debug=1. I suppose that the test is searching via the indexed column, which would force change buffer merges. I was a little more successful with the following test:
As far as I can tell, this may not trigger purge buffering, but it still is better than my initial upgrade test, which only covered insert buffering. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2022-12-05 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The second UPDATE appears to trigger a change buffer merge. With the following, I got 79 INSERT operations and 3700 delete-mark operations buffered for 90 pages:
The upgrade was successful, and CHECK TABLE did not report any errors. One more test with 65,536 rows: 193 pages, 33,426 delete-mark operations, 7 insert operations, no purge operations. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Matthias Leich [ 2022-12-06 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Matthias Leich [ 2022-12-13 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
origin/bb-10.11-new-innodb-defaults c434f870a346fb11a6b5932dbdf860ed7e2d2f74 2022-12-12T10:05:22+02:00 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2023-01-25 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
It is worth noting that starting with
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2023-09-08 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Users should beware of dormant corruption, such as that one caused by greenman, I think that we must amend the recommended upgrade procedure from 10.x to 11.x along the following lines:
The upgrade procedure ignores the "change buffer bitmaps" and trusts that all records in the change buffer are valid. The slow shutdown procedure of 10.4 ( We might choose to revise the upgrade logic in 11.0 to work in a similar fashion. Until or unless that is done, I think that we must document this. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2023-09-19 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
My plan is to revise the upgrade logic in |