Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-20934

Infinite loop on innodb_fast_shutdown=0 with inconsistent change buffer

    Details

      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

            Activity

              People

              • Assignee:
                marko Marko Mäkelä
                Reporter:
                marko Marko Mäkelä
              • Votes:
                1 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: