[MDEV-32489] Change buffer index fails to delete the records Created: 2023-10-17 Updated: 2024-01-29 |
|
| Status: | In Progress |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - InnoDB |
| Affects Version/s: | 10.5, 10.6, 10.10, 10.11, 11.1, 11.2, 11.3 |
| Fix Version/s: | 10.5, 10.6, 10.11, 11.1, 11.2, 11.3 |
| Type: | Bug | Priority: | Major |
| Reporter: | Thirunarayanan Balathandayuthapani | Assignee: | Thirunarayanan Balathandayuthapani |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
While testing bb-10.6-thiru, InnoDB hangs during shutdown and it shows the
Analysis:
btr_cur_open() searches with tuple only page_id (0, 739). Root page has this following (..(0, 563)(child 60), (0, 739)(child 63)..) since the mode is Since change buffer index is in 5.5+ format, primary key for the index is {space, 0, page_no, counter}. But we fail to use the counter field for searching the tuple. Thanks to vlad.lesin for helping me in analysing this issue. |
| Comments |
| Comment by Vladislav Lesin [ 2023-10-17 ] |
|
> Since change buffer index is in 5.5+ format, primary key for the index is {space, 0, page_no, counter}I am not sure about this, because when we get offsets of the record on root page, there are 7 fields. The first 4 fields is {space, 0, page_no, counter} , the last field is a child page id. There are 2 more fields in the key. And, if so, https://github.com/MariaDB/server/commit/015ab499696382b0e3b8d70118beefafd328a779 commit just shifts the problem from "counter" field to the next to the "counter" one. I.e. what if we have {a, 0, b, count, c, ...}record on leaf page N and {a, 0, b, count, c+1, ...}record on page N+1. And we use {a, 0, b, count}search tuple. We will delete all {a, 0, b, count, ...}records on page N, and then, when we open cursor again, there will be the same problem as we have now, i.e. the cursor will point to the supremum of page N, and we will miss records on page N+1. |
| Comment by Marko Mäkelä [ 2023-10-17 ] |
|
Change buffer records may be in the pre-MySQL 5.5 format in case innodb_change_buffering=inserts is being used. We must not assume anything about the format. I think that we should perform a forward scan and first delete-mark all records in the same mini-transaction that modifies the change buffer bitmap. Then, start another mini-transaction that will lock the entire change buffer while doing a forward scan and "pessimistic" delete of all matching change buffer records. |