[MDEV-20279] Increase Aria index length limit Created: 2019-08-07  Updated: 2023-11-27  Due: 2019-08-18  Resolved: 2019-08-28

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - Aria
Fix Version/s: 10.5.0

Type: Task Priority: Major
Reporter: Michael Widenius Assignee: Michael Widenius
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-17841 S3 Storage engine Closed
relates to MDEV-20681 Aria temptable used for grouping may ... Closed

 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...)


Generated at Thu Feb 08 08:58:14 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.