Details
-
Task
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
None
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
- relates to
-
MDEV-17841 S3 Storage engine
- Closed
-
MDEV-20681 Aria temptable used for grouping may have key longer than maria_max_key_length()
- Closed