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

InnoDB fails to detect page number mismatch

    XMLWordPrintable

    Details

      Description

      InnoDB is not checking that the page number in a buffer pool page is correct. The following would implement such a check:

      diff --git a/storage/innobase/mtr/mtr0mtr.cc b/storage/innobase/mtr/mtr0mtr.cc
      --- a/storage/innobase/mtr/mtr0mtr.cc
      +++ b/storage/innobase/mtr/mtr0mtr.cc
      @@ -1196,6 +1196,8 @@ void mtr_t::page_lock(buf_block_t *block, ulint rw_latch)
       #endif /* BTR_CUR_HASH_ADAPT */
       
       done:
      +  ut_ad(page_id_t(page_get_space_id(block->page.frame),
      +                  page_get_page_no(block->page.frame)) == block->page.id());
         memo_push(block, fix_type);
       }
       
      

      This would be tripped in a number of tests that inject corruption to data files. Those tests will have to be adjusted.

      Furthermore, operations like DROP TABLE need to be fixed so that they will not attempt to load the table definition at all. This would avoids a crash in a test that corrupts the clustered index root page number of a table. The following fix for that test would be needed in any case:

      diff --git a/mysql-test/suite/innodb/t/page_id_innochecksum.test b/mysql-test/suite/innodb/t/page_id_innochecksum.test
      index 2726b3254da..f5166018dd1 100644
      --- a/mysql-test/suite/innodb/t/page_id_innochecksum.test
      +++ b/mysql-test/suite/innodb/t/page_id_innochecksum.test
      @@ -61,5 +61,9 @@ let SEARCH_PATTERN=page id mismatch;
       --source include/search_pattern_in_file.inc
       
       --remove_file $resultlog
      +# prevent purge from crashing on page ID mismatch
      +let $restart_parameters=--innodb-force-recovery=2;
       --source include/start_mysqld.inc
       drop table t1;
      +let $restart_parameters=;
      +--source include/restart_mysqld.inc
      

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved:

                  Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.