xntt_rest_queries table: Specified key was too long; max key length is 3072 bytes

Created on 20 September 2024, 2 months ago

When upgrading from 2.x to 3.x I get an error caused by the external_entities_update_9305() update hook:

>  [notice] Update started: external_entities_update_9305
>  [error]  SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 3072 bytes: CREATE TABLE "xntt_rest_queries" (
> "qid" INT unsigned NOT NULL auto_increment COMMENT 'The primary identifier for a query set.', 
> "endpoint" VARCHAR(2083) NOT NULL COMMENT 'Holds the endpoint URL', 
> "qtimes" TEXT NOT NULL COMMENT 'Sorted array of query times', 
> "xntt_type" VARCHAR(32) NOT NULL COMMENT 'Holds used external entity type for the query', 
> "username" VARCHAR(60) NOT NULL COMMENT 'Holds name of the user which issued the query', 
> PRIMARY KEY ("qid"), 
> UNIQUE KEY "endpoint" ("endpoint")
> ) ENGINE = InnoDB DEFAULT CHARACTER SET utf8mb4 COMMENT 'Stores REST queries to handle limitations.'; Array
> (
> )
>  
>  [error]  Update failed: external_entities_update_9305 
 [error]  Update aborted by: external_entities_update_9305 
 [error]  Finished performing updates. 

The underlying database is an AWS RDS database. Looks like the unique index is causing this. The endpoint column is a varchat(2083).

I guess the maximum index key length can be increased by configuration somehow, but I have serious doubts if such a large index is good practice. If we really want to avoid unique URLs in the table, perhaps we can generate a hash (MD5, SHA-256, ...) of the URL instead?

🐛 Bug report
Status

Active

Version

3.0

Component

Code

Created by

🇧🇪Belgium rp7

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024