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

Increase Aria index length limit

    XMLWordPrintable

Details

    Description

      The max length of a key in Aria is limited by HA_MAX_KEY_LENGTH (1000 bytes).
      The purpose of this task is to increase the limit to 2000 bytes and make it possible to later easily increase the limit even more if needed

      The reason for the limit is that Aria is storing keys on the stack while doing recursive searches in the b-tree. Just increasing the size of HA_MAX_KEY_LENGTH could cause problems with the stack.

      The solution would be to instead of using alloca() for storing key pages and indexes on the stack (as we do now) instead create a new interface that would use alloca() if there is stack available and otherwise malloc().

      This would allow us to allocate just as much memory that is needed, instead of always allocating increments of HA_MAX_KEY_LENGTH and thus decrease the usage of stack size for common tables.

      The problem with Aria max key length has recently been highlighted by users trying to convert InnoDB tables with long utf8mb4 byte characters which failed because Aria (and thus S3 engine) has a smaller max key length than InnoDB.

      Example:
      MariaDB [test]> create or replace table t1 (a varchar(251) character set utf8mb4, unique (a)) engine=aria;
      ERROR 1904 (HY000): Key/Index cannot be defined on a virtual generated column

      (The error message should also be fixed...)

      Attachments

        Issue Links

          Activity

            People

              monty Michael Widenius
              monty Michael Widenius
              Votes:
              0 Vote for this issue
              Watchers:
              4 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.