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

Assertion mode == 16 || mode == 12 || fix_block->page.status != buf_page_t::FREED failed in ibuf_read_merge_pages()

    XMLWordPrintable

    Details

      Description

      In stress testing, we got an assertion failure due to a call in ibuf_read_merge_pages():

      			buf_page_get_gen(page_id_t(space_id, page_nos[i]),
      					 zip_size,
      					 RW_X_LATCH, NULL, BUF_GET,
      					 __FILE__, __LINE__, &mtr, &err, true);
      

      The BUF_GET should actually be BUF_GET_POSSIBLY_FREED, and buf_page_get_gen() must not attempt to merge any buffered changes to freed pages. The scenario likely is something like this:

      1. INSERT, UPDATE or DELETE is written to the change buffer.
      2. DROP INDEX is executed and the page is freed, before the buffered changes are merged.
      3. Something else is written to the change buffer, and ibuf_insert_low() invokes ibuf_read_merge_pages() to merge (or remove) the entries for the page that was freed by DROP INDEX.

      Furthermore, MDEV-21572 seems to have broken buf_page_get_gen() so that it will wrongly skip change buffer merge in a rare scenario that I did not verify:

      1. A secondary index leaf page is initialized and modified.
      2. The page is evicted.
      3. Something is buffered for the page.
      4. All the redo log was durably written, and no log_checkpoint() took place.
      5. The server is killed.
      6. On restart, we read the page, but fail to merge the buffered changes.

      (It is highly unlikely that the page would be evicted while there would not be a log checkpoint between the page initialization, eviction, and the change buffer write.)

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: