Index column size too large

Created on 27 September 2023, 9 months ago
Updated 28 September 2023, 9 months ago

Problem/Motivation

When upgrading from 3.1.0-rc1 to -rc2, I get this error:

SQLSTATE[HY000]: General error: 1709 Index column size too large. The maximum column size is 767 bytes: CREATE INDEX imaestro_queue_token ON "maestro_queue" (token) COMMENT '' ALGORITHM DEFAULT LOCK DEFAULT; Array

This is because:

  • We are using MariaDB 10.3.38 (which is a little old, but 10.3.7+ is still supported by Drupal)
  • The new 'token' field is 255 characters long
  • The charset is utf8mb4, which uses up to 4 bytes per character (1020 bytes total)
  • maestro_update_8006 tries to create an index on that column, but the maximum index length allowed in that version of MariaDB was 767 bytes

(It was increased in later versions, I believe.)

Steps to reproduce

  • Use MariaDB 10.3
  • Set the default charset for the database to utf8mb4
  • Run drush updb

Proposed resolution

As a workaround, until we upgrade, I could change the MariaDB configuration...

But I don't think the token column actually needs to be 255 characters - it looks like it is filled using Crypt::randomBytesBase64() which returns only 43 characters. Reducing the column size to 191 characters or less would solve this for anyone else still using an older version.

Thanks!

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Fixed

Version

3.1

Component

Code

Created by

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

Comments & Activities

Production build 0.69.0 2024