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

Comments

mi-dave created an issue. See original summary.

  • _randy committed e64a7a09 on 3.x
    Issue #3390065: Index column size too large
    
_randy’s picture

Status: Active » Needs review

@mi-dave

Can you test this patch/update please? This should shrink the size of the field to 100 characters.

  • _randy committed ec5dbe3a on 3.x
    Issue #3390065: Index column size too large. Add index to field as well.
    

  • _randy committed 94976aed on 3.x
    Issue #3390065: Index column size too large. Add precaution around...
mi-dave’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me, thanks!

_randy’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.