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

Avoid copying when changing the type of an indexed column

    XMLWordPrintable

Details

    Description

      It was the intention of MDEV-15564 to allow ALGORITHM=NOCOPY for changing the character set or collation of an indexed column. Currently, such operations will degrade to ALGORITHM=COPY:

      Please see the test innodb.instant_alter_charset. We would expect results like

      ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: ADD INDEX. Try ALGORITHM=NOCOPY

      but instead, we currently get the following:

      ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type INPLACE. Try ALGORITHM=COPY

      I believe that this is due to the following in Field_str::is_equal() and Field_varstring::is_equal():

        if (!Type_handler::Charsets_are_compatible(field_charset, new_field->charset,
      					     part_of_a_key))
          return IS_EQUAL_NO;
      

      Maybe we need variants of IS_EQUAL_PACK_LENGTH and IS_EQUAL_PACK_LENGTH_EXT that indicate that the column is indexed, and therefore the SQL layer must request the indexes to be dropped and added.

      Attachments

        Issue Links

          Activity

            People

              kevg Eugene Kosov (Inactive)
              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.