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

Online log apply fails for redundant row format tables

Details

    Description

      In rec_get_converted_size_comp_prefix_low(), InnoDB calculates extra bytes
      for null bytes using index->n_core_null_bytes field. But in
      rec_convert_dtuple_to_rec_comp(), InnoDB traverse to null bytes
      using index->n_nullable field. In the given scenario, index->n_core_null_bytes
      is 1 and index->n_nullable is 9 and it doesn't fit in single byte.
      Moreover, n_core_null_bytes indicates the number of null bits in non-redundant
      format when table is not instant. Problem exist from 10.3+. But
      the given test case repeats from 10.4+

       
      --source include/have_innodb.inc
      CREATE TABLE IF NOT EXISTS t4 ( col1 INT, col2 INT, col_int INTEGER, col_string INTEGER, col_varchar VARCHAR(500), col_text TEXT ) ENGINE = InnoDB ROW_FORMAT = REDUNDANT;
      ALTER TABLE t4 ADD PRIMARY KEY ( col_text(9), col_int );
      ALTER TABLE t4 ADD COLUMN col_int_copy INTEGER;
      ALTER TABLE t4 DROP PRIMARY KEY;
      ALTER TABLE t4 ADD COLUMN col_text_copy TEXT;
      ALTER TABLE t4 ADD PRIMARY KEY ( col_text(9), col_int );
      ALTER TABLE t4 ADD COLUMN col_inTcol_int INTEGER;
      ALTER TABLE t4 DROP PRIMARY KEY;
      ALTER TABLE t4 ADD COLUMN col_texTcol_text TEXT;
      ALTER TABLE t4 ADD PRIMARY KEY ( col_text(9), col_int );
      ALTER TABLE t4 DROP PRIMARY KEY;
      ALTER TABLE t4 MODIFY COLUMN col_text TEXT;
       
      set DEBUG_SYNC="innodb_inplace_alter_table_enter SIGNAL alter_phase WAIT_FOR alter_finish";
      --send ALTER TABLE t4 ADD PRIMARY KEY ( col_text(9), col_int )
      connect(con1,localhost,root,,);
      set DEBUG_SYNC="now WAIT_FOR alter_phase";
      begin;
      INSERT INTO t4 (col1,col2, col_int, col_string, col_text) VALUES ( 1, 1, 0, REPEAT(SUBSTR(CAST( 1 AS CHAR),1,1), 10), REPEAT(SUBSTR(CAST( 1 AS CHAR),1,1), 10000) );
      rollback;
      set DEBUG_SYNC="now SIGNAL alter_finish";
       
      connection default;
      reap;
      disconnect con1;
      select * from t4;
      drop table t4;
      set debug_sync=reset;
      

      Run the above test case with --innodb_page_size=64K --innodb_buffer_pool_size=24M

      Attachments

        Issue Links

          Activity

            Patch is in bb-10.4-thiru

            thiru Thirunarayanan Balathandayuthapani added a comment - Patch is in bb-10.4-thiru

            I think that we must a second template parameter bool redundant_temp to rec_init_offsets_comp_ordinary(), like we already have it in rec_get_converted_size_comp_prefix_low().

            If redundant_temp==true, we must do something special for !index->table->not_redundant() (the online_log record is in a different format). Else, we must assert that index->table->not_redundant() holds.

            The test innodb.instant_alter_crash is supposed to test crash recovery. For this test, innodb.instant_alter_debug would be a better match. Please remove ROW_FORMAT=REDUNDANT from the test case, because that test runs with two combinations of innodb_default_row_format.

            marko Marko Mäkelä added a comment - I think that we must a second template parameter bool redundant_temp to rec_init_offsets_comp_ordinary() , like we already have it in rec_get_converted_size_comp_prefix_low() . If redundant_temp==true , we must do something special for !index->table->not_redundant() (the online_log record is in a different format). Else, we must assert that index->table->not_redundant() holds. The test innodb.instant_alter_crash is supposed to test crash recovery. For this test, innodb.instant_alter_debug would be a better match. Please remove ROW_FORMAT=REDUNDANT  from the test case, because that test runs with two combinations of innodb_default_row_format .

            Problem happens only in 10.4. Modify column does instant operation only in 10.4+. This issue is caused by MDEV-15563.
            so moving the affected version to 10.4

            thiru Thirunarayanan Balathandayuthapani added a comment - Problem happens only in 10.4. Modify column does instant operation only in 10.4+. This issue is caused by MDEV-15563 . so moving the affected version to 10.4

            I spent some time creating a simpler test case. We need 9 columns, and 8 of them can be INT. Only 2 ALTER TABLE statements are necessary.

            The code fix itself is fine, and 10.3 is not affected because it is missing MDEV-15563.

            marko Marko Mäkelä added a comment - I spent some time creating a simpler test case. We need 9 columns, and 8 of them can be INT . Only 2 ALTER TABLE statements are necessary. The code fix itself is fine, and 10.3 is not affected because it is missing MDEV-15563 .

            People

              thiru Thirunarayanan Balathandayuthapani
              thiru Thirunarayanan Balathandayuthapani
              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.