[MDEV-22497] [ERROR] InnoDB: Unable to purge a record Created: 2020-05-07 Updated: 2022-05-21 Resolved: 2020-05-07 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - InnoDB |
| Affects Version/s: | 5.5, 10.0, 10.1, 10.2, 10.3, 10.4, 10.5 |
| Fix Version/s: | 10.5.4, 10.1.46, 10.2.33, 10.3.24, 10.4.14 |
| Type: | Bug | Priority: | Major |
| Reporter: | Marko Mäkelä | Assignee: | Marko Mäkelä |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | corruption, upstream-5.5 | ||
| Issue Links: |
|
||||||||
| Description |
|
The InnoDB insert buffer was upgraded in MySQL 5.5 into a change buffer that also covers delete-mark and delete (purge) operations. There is an important constraint for delete operations: a B-tree leaf page must not become empty unless the entire tree becomes empty, consisting of an empty root page. Because change buffer merges only occur on a single leaf page at a time (until The function ibuf_get_volume_buffered_hash() is part of our insurance that the page would not become empty. It is supposed to map each buffered INSERT or DELETE_MARK record payload into a hash value. We will only count each such record as a distinct key if there is no hash collision. DELETE operations will always decrement the predicted number fo records in the page. Due to a bug in the function, we would actually compute the hash value not only on the record payload, but also on some following bytes, in case the record contains NULL values. In MySQL Bug #61104, we have some examples of this dating back to 2012:
Note: the SQL NULL in the output is part of the DELETE operation that was not supposed to be buffered. It proves that the secondary index in question allows NULL values, and hence it is possible that there were preceding buffered INSERT or DELETE_MARK records for the page that might have contained NULL values for some of the secondary key columns. With a corrected and simplified hash function (also, using CRC-32C in the hash value calculation instead of the slower and worse ut_fold_binary()), the problem is no longer repeatable:
See |
| Comments |
| Comment by Manuel Arostegui [ 2020-05-26 ] |
|
This keeps happening with 10.4.13, see: https://jira.mariadb.org/browse/MDEV-22373 |
| Comment by Marko Mäkelä [ 2020-09-03 ] |
|
Sorry, the fixVersion was wrong, and I corrected it now. I remember that the fix was finished near the time when the bunch of releases in May 2020 were being prepared. We also decided to omit the fix from the very last 5.5 release. |
| Comment by Manuel Arostegui [ 2021-03-05 ] |
|
We are seeing this bug happening again on 10.4.18. |