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

Add MTR tests covering key and key segment flags and types

    XMLWordPrintable

Details

    Description

      In order to fix these bugs without regressions:

      MDEV-29481 mariadb-upgrade prints confusing statement
      MDEV-28822 Table from older version requires table rebuild when adding colum to table with multi-column index

      let's add MTR debug tests to print verbose information about keys and key segments.
      The following members of the underlying structures are of interest:

      1. KEY::name and KEY::flag in mysql_prepare_create_table()
      2. MI_KEYDEF::flag, HA_KEYSEG::type and HA_KEYSEG::flags in ha_myisam::create(), after copying from KEY.

      The underlying code is very hard to understand and simplify. The way how flags HA_SPACE_PACK_USED, HA_VAR_LENGTH_KEY, HA_PACK_KEY, HA_BINARY_PACK_KEY walk through the code are especually hard to follow.

      We need to make sure that after fixes for MDEV-29481 and MDEV-28822 nothing changes in MyISAM tables.

      The proposed test should work in debug builds and display flags using server Notes:

      About the following output should be descriptive enough:

      CREATE TABLE t1 (a INT NOT NULL, b CHAR(10) NOT NULL, KEY(a,b))
      Level  Code    Message
      Note   1105    DBUG: prep_create_table: name=`a` flags=00000002 (HA_PACK_KEY)
      Note   1105    DBUG: ha_myisam::create: name=`a` flags=00000020 (HA_BINARY_PACK_KEY)
      Note   1105    DBUG:   seg[0].type=4 LONG_INT
      Note   1105    DBUG:   seg[0].flag=00000000
      Note   1105    DBUG:   seg[1].type=1 TEXT
      Note   1105    DBUG:   seg[1].flag=00000001 (HA_SPACE_PACK)
      Table  Create Table
      t1     CREATE TABLE `t1` (
        `a` int(11) NOT NULL,
        `b` char(10) NOT NULL,
        KEY `a` (`a`,`b`)
      ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
      

      The new test should cover all essential data type pairs as well as partial key lengths for TEXT. Pairs are needed because flags are calculated in different ways on the first key segment versus other key segments.

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              bar Alexander Barkov
              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.