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

page_compression flag is missing for full_crc32 tablespace

    XMLWordPrintable

    Details

      Description

      The page compression flag wasn't set during recovery. So while opening the table, it leads to wrong page corruption.

      Stack trace is

      #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
      #1  0x00001f3a412ca8b1 in __GI_abort () at abort.c:79
      #2  0x00005650b748a0a3 in ib::fatal::~fatal (this=0x7ffffcd5e690, __in_chrg=<optimized out>) at /home/mleich/bb-10.5-thiru/storage/innobase/ut/ut0ut.cc:580
      #3  0x00005650b74f5321 in fil_page_type_validate (space=0x1d3d614522f8, page=0x4a4654826000 "")
          at /home/mleich/bb-10.5-thiru/storage/innobase/include/fil0fil.ic:131
      #4  0x00005650b74f69d5 in buf_page_decrypt_after_read (bpage=0x4a465396eb00, node=...) at /home/mleich/bb-10.5-thiru/storage/innobase/buf/buf0buf.cc:497
      #5  0x00005650b7500720 in buf_page_read_complete (bpage=0x4a465396eb00, node=...) at /home/mleich/bb-10.5-thiru/storage/innobase/buf/buf0buf.cc:4226
      #6  0x00005650b752abae in buf_read_page_low (err=0x7ffffcd5ee74, sync=true, mode=132, page_id=..., zip_size=0, unzip=false, ignore=false)
          at /home/mleich/bb-10.5-thiru/storage/innobase/buf/buf0rea.cc:364
      #7  0x00005650b752b0a7 in buf_read_page (page_id=..., zip_size=0) at /home/mleich/bb-10.5-thiru/storage/innobase/buf/buf0rea.cc:480
      #8  0x00005650b74fca3a in buf_page_get_low (page_id=..., zip_size=0, rw_latch=1, guess=0x0, mode=10, 
          file=0x5650b7cd0780 "/home/mleich/bb-10.5-thiru/storage/innobase/dict/dict0load.cc", line=2996, mtr=0x7ffffcd5f650, err=0x0, allow_ibuf_merge=false)
          at /home/mleich/bb-10.5-thiru/storage/innobase/buf/buf0buf.cc:3174
      #9  0x00005650b74fe001 in buf_page_get_gen (page_id=..., zip_size=0, rw_latch=1, guess=0x0, mode=10, 
          file=0x5650b7cd0780 "/home/mleich/bb-10.5-thiru/storage/innobase/dict/dict0load.cc", line=2996, mtr=0x7ffffcd5f650, err=0x0, allow_ibuf_merge=false)
          at /home/mleich/bb-10.5-thiru/storage/innobase/buf/buf0buf.cc:3645
      #10 0x00005650b7563a49 in dict_load_table_one (name=..., ignore_err=DICT_ERR_IGNORE_RECOVER_LOCK, fk_tables=std::deque with 0 elements)
          at /home/mleich/bb-10.5-thiru/storage/innobase/dict/dict0load.cc:2994
      #11 0x00005650b7562831 in dict_load_table (name=0x394950f7aae8 "test/t6", ignore_err=DICT_ERR_IGNORE_RECOVER_LOCK)
          at /home/mleich/bb-10.5-thiru/storage/innobase/dict/dict0load.cc:2745
      #12 0x00005650b7564539 in dict_load_table_on_id (table_id=25, ignore_err=DICT_ERR_IGNORE_RECOVER_LOCK)
          at /home/mleich/bb-10.5-thiru/storage/innobase/dict/dict0load.cc:3182
      #13 0x00005650b7543d4c in dict_table_open_on_id_low (table_id=25, ignore_err=DICT_ERR_IGNORE_RECOVER_LOCK, cached_only=false)
          at /home/mleich/bb-10.5-thiru/storage/innobase/dict/dict0dict.cc:222
      #14 0x00005650b7545648 in dict_table_open_on_id (table_id=25, dict_locked=false, table_op=DICT_TABLE_OP_LOAD_TABLESPACE, thd=0x0, mdl=0x0)
          at /home/mleich/bb-10.5-thiru/storage/innobase/dict/dict0dict.cc:953
      #15 0x00005650b74723d6 in trx_resurrect_table_locks (trx=0x1d3d60f7e588, undo=0x252b1ac4fd28)
          at /home/mleich/bb-10.5-thiru/storage/innobase/trx/trx0trx.cc:629
      #16 0x00005650b7472ab8 in trx_resurrect (undo=0x252b1ac4fd28, rseg=0x252b1ac4fa78, start_time=1594728365, start_time_micro=522294300743, 
          rows_to_undo=0x7ffffcd60bc8, is_old_insert=false) at /home/mleich/bb-10.5-thiru/storage/innobase/trx/trx0trx.cc:725
      #17 0x00005650b7472dbc in trx_lists_init_at_db_start () at /home/mleich/bb-10.5-thiru/storage/innobase/trx/trx0trx.cc:786
      #18 0x00005650b7421f80 in srv_start (create_new_db=false) at /home/mleich/bb-10.5-thiru/storage/innobase/srv/srv0start.cc:1556
      #19 0x00005650b71ed546 in innodb_init (p=0x5650bab367e8) at /home/mleich/bb-10.5-thiru/storage/innobase/handler/ha_innodb.cc:4001
      #20 0x00005650b6d91b57 in ha_initialize_handlerton (plugin=0x5650baa6cd70) at /home/mleich/bb-10.5-thiru/sql/handler.cc:645
      #21 0x00005650b6a545fc in plugin_initialize (tmp_root=0x7ffffcd61960, plugin=0x5650baa6cd70, argc=0x5650b86a9e00 <remaining_argc>, argv=0x5650baa2c5f0, 
          options_only=false) at /home/mleich/bb-10.5-thiru/sql/sql_plugin.cc:1459
      #22 0x00005650b6a553f0 in plugin_init (argc=0x5650b86a9e00 <remaining_argc>, argv=0x5650baa2c5f0, flags=0)
          at /home/mleich/bb-10.5-thiru/sql/sql_plugin.cc:1751
      #23 0x00005650b68f4f09 in init_server_components () at /home/mleich/bb-10.5-thiru/sql/mysqld.cc:4909
      #24 0x00005650b68f612b in mysqld_main (argc=45, argv=0x5650baa2c5f0) at /home/mleich/bb-10.5-thiru/sql/mysqld.cc:5492
      ---Type <return> to continue, or q <return> to quit---
      #25 0x00005650b68eb2da in main (argc=44, argv=0x7ffffcd63298) at /home/mleich/bb-10.5-thiru/sql/main.cc:25
      

      ALTER TABLE t1 PAGE_COMPRESSED=1; doesn't do table rebuild. It does write FSP_FLAG in commit_cache_norebuild().

      During recovery:
      1) InnoDB encounters FILE_CREATE redo log and opens the tablespace with old FSP_FLAG value.
      2) Only parsing of redo log has been finished. Now InnoDB tries to load dict_load_table() and tries to compare it with table->flags. If it is not equal then InnoDB should set the tablespace flag by reading page0. But the read of page0 is avoided because of the following code in fsp_flags_try_adjust()

          if (space->full_crc32() || fil_space_t::full_crc32(flags)) {
                      return;
           }
      

      3) InnoDb tries to open the table by reading page3 from disk. Page3 has page_compression flag enabled in its page. So it leads to failure of page type validation.

      Fix should involve allowing page0 to read when there is a mismatch of full crc32 flags. During that check, use page_compression algorithm.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              thiru Thirunarayanan Balathandayuthapani
              Reporter:
              thiru Thirunarayanan Balathandayuthapani
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Git Integration