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

InnoDB crashes when trying to recover a corrupted page

    XMLWordPrintable

Details

    Description

      InnoDB crash recovery can crash when using a slightly modified version of the test that was added in MDEV-12699. In this case, corruption of the table is expected to be noticed, and the table is expected to be made inaccessible to SQL. What happens instead is that InnoDB will attempt to apply log records to the corrupted page, and will crash while doing that.

      10.4 crashes with unmodified test when using a different parameter, which will cause the key_version field to be corrupted:

      ./mtr --mysqld=--innodb-checksum-algorithm=full_crc32 encryption.corrupted_during_recovery
      

      10.2 to 10.4 when using the default innodb_checksum_algorithm=crc32 will fail if we corrupt a different field of the page:

      diff --git a/mysql-test/suite/encryption/t/corrupted_during_recovery.test b/mysql-test/suite/encryption/t/corrupted_during_recovery.test
      index 44cd03e9f8a..55b1b52d393 100644
      --- a/mysql-test/suite/encryption/t/corrupted_during_recovery.test
      +++ b/mysql-test/suite/encryption/t/corrupted_during_recovery.test
      @@ -34,7 +34,7 @@ my $ps = $ENV{INNODB_PAGE_SIZE};
       my $file = "$ENV{MYSQLD_DATADIR}/test/t1.ibd";
       open(FILE, "+<$file") || die "Unable to open $file";
       binmode FILE;
      -seek (FILE, $ENV{INNODB_PAGE_SIZE} * 3, SEEK_SET) or die "seek";
      +seek (FILE, $ENV{INNODB_PAGE_SIZE} * 3 + 26, SEEK_SET) or die "seek";
       print FILE "junk";
       close FILE or die "close";
      

      In both cases, recv_recover_page() will try to apply redo log to the corrupted page. The test is expected to deny access to this table, which is not supposed to be recoverable via the redo log.
      Stack traces will include something like this:

      #7  0x0000564f47df0bc5 in recv_parse_or_apply_log_rec_body (type=<optimized out>, ptr=0x0, end_ptr=<optimized out>, space_id=4, page_no=3, apply=<optimized out>, block=0x7f33bc76fbe8, mtr=0x7f33b6cdc508) at /mariadb/10.2/storage/innobase/log/log0recv.cc:1651
      #8  0x0000564f47de8700 in recv_recover_page (block=<optimized out>, mtr=..., recv_addr=<optimized out>, init_lsn=<optimized out>) at /mariadb/10.2/storage/innobase/log/log0recv.cc:2153
      #9  0x0000564f47de7cb8 in recv_recover_page (bpage=0x7f33bc76fbe8) at /mariadb/10.2/storage/innobase/log/log0recv.cc:2246
      #10 0x0000564f47fa6c20 in buf_page_io_complete (bpage=<optimized out>, dblwr=<optimized out>, evict=<optimized out>) at /mariadb/10.2/storage/innobase/buf/buf0buf.cc:6038
      

      Attachments

        Issue Links

          Activity

            People

              thiru Thirunarayanan Balathandayuthapani
              marko Marko Mäkelä
              Votes:
              0 Vote for this issue
              Watchers:
              1 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.