Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
5.5(EOL), 10.0(EOL), 10.1(EOL), 10.2(EOL), 10.3(EOL), 10.4(EOL)
Description
Due to a data corruption bug in the past (such as MySQL Bug #69122 InnoDB doesn't redo-log insert buffer merge operation if it is done in-place) it seems possible that the InnoDB change buffer ends up containing entries, while no buffered changes exist according to the change buffer bitmap pages in the .ibd files.
The logic on slow shutdown would proceed as follows:
- ibuf_merge_pages() calls btr_pcur_open_at_rnd_pos(), which will find a change buffer leaf page
- page numbers are read from the change buffer records
- page reads requests will be posted
- on read completion, ibuf_merge_or_delete_for_page() will be invoked
- Alas, the bitmap page in the .ibd says that there are no buffered changes, and nothing will be done.
- Because the ‘orphan’ records for the page were not deleted from the change buffer, this will keep looping.
To fix this, I think that we should change the following code in ibuf_merge_or_delete_for_page():
if (!bitmap_bits) { |
/* No inserts buffered for this page */ |
|
fil_space_release(space);
|
return; |
}
|
Before returning, we should check if slow shutdown is in progress. If yes, we should attempt to delete any change buffer entries for page_id. We should not try this during normal operation, because it would cause a lot of unnecessary work.
Attachments
Issue Links
- causes
-
MDEV-23839 innodb_fast_shutdown=0 hang on change buffer merge
- Closed
-
MDEV-25783 CHECK TABLE harvests InnoDB: Index 'abdcef' contains 10001 entries, should be 10000
- Closed
- relates to
-
MDEV-21069 Crash on DROP TABLE if the data file is corrupted
- Closed
-
MDEV-21152 Bogus debug assertion btr_pcur_is_after_last_in_tree() in ibuf code
- Closed
-
MDEV-24449 Corruption of system tablespace or last recovered page
- Closed
-
MDEV-30009 InnoDB shutdown hangs when the change buffer is corrupted
- Closed
-
MDEV-32132 DROP INDEX followed by CREATE INDEX may corrupt data
- Closed
-
MDEV-20864 Introduce debug option innodb_change_buffer_dump
- Closed