[AdvancedSearch] sql/translate_sections.sql : Error: 1071 Specified key was too long; max key length is 767 bytes
Closed, InvalidPublic

Description

When running MySQL/MariaDB with charset utf8mb4, a character is 4 bytes. Hence a key created on a VARCHAR(255) takes 255 characters * 4 bytes/characters = 1020 bytes. However Innodb defaults to a maximum of 767 bytes for an index.

The extension fails to install on Debian Stretch which uses utf8mb4 as the default charset:

Query: CREATE TABLE `translate_sections` (
 trs_page int unsigned NOT NULL,
 trs_key varchar(255) binary NOT NULL,
 trs_text mediumblob NOT NULL,
 trs_order int unsigned,
 PRIMARY KEY (trs_page, trs_key)
 ) ENGINE=InnoDB

Function: Wikimedia\Rdbms\Database::sourceFile( /workspace/src/extensions/Translate/sql/translate_sections.sql )
Error: 1071 Specified key was too long; max key length is 767 bytes (localhost:/tmp/quibble-mysql-n7dsyle6/socket)
Restricted Application added a project: TCB-Team. · View Herald TranscriptMay 1 2018, 7:08 PM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript

I'm a bit confused how this applies to AdvancedSearch, as the error message comes from the Translate extension. Is one of our translation strings too long? Can you describe what you did? Did you try two installs, one with and one without AdvancedSearch and the one with AdvancedSearch fails?

I'm a bit confused how this applies to AdvancedSearch, as the error message comes from the Translate extension. Is one of our translation strings too long? Can you describe what you did? Did you try two installs, one with and one without AdvancedSearch and the one with AdvancedSearch fails?

Pinging @hashar

hashar closed this task as Resolved.Jun 7 2018, 12:56 PM
hashar claimed this task.

The trace refers to the Translate extension which already has a bug: T193558 so it is not relevant to AdvancedSearch. Sorry for the spam :(

hashar changed the task status from Resolved to Invalid.Jun 7 2018, 12:56 PM
Vvjjkkii renamed this task from [AdvancedSearch] sql/translate_sections.sql : Error: 1071 Specified key was too long; max key length is 767 bytes to hvdaaaaaaa.Jul 1 2018, 1:12 AM
Vvjjkkii reopened this task as Open.
Vvjjkkii triaged this task as High priority.
Vvjjkkii removed hashar as the assignee of this task.
Vvjjkkii updated the task description. (Show Details)
Vvjjkkii removed a subscriber: Aklapper.
Mainframe98 renamed this task from hvdaaaaaaa to [AdvancedSearch] sql/translate_sections.sql : Error: 1071 Specified key was too long; max key length is 767 bytes.Jul 1 2018, 10:51 AM
Mainframe98 closed this task as Invalid.
Mainframe98 raised the priority of this task from High to Needs Triage.
Mainframe98 assigned this task to hashar.
Mainframe98 updated the task description. (Show Details)
Mainframe98 added a subscriber: Aklapper.