Page MenuHomePhabricator

[AbuseFilter] AbuseFilter/abusefilter.tables.sql : Error: 1071 Specified key was too long; max key length is 767 bytes
Closed, ResolvedPublic

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 `abuse_filter_action` (
 afa_filter BIGINT unsigned NOT NULL,
 afa_consequence varchar(255) NOT NULL,
 afa_parameters TINYBLOB NOT NULL,
 PRIMARY KEY (afa_filter,afa_consequence),
 KEY (afa_consequence)
 ) ENGINE=InnoDB

Function: Wikimedia\Rdbms\Database::sourceFile( /workspace/src/extensions/AbuseFilter/abusefilter.tables.sql )
Error: 1071 Specified key was too long; max key length is 767 bytes (localhost:/tmp/quibble-mysql-xo6py6vh/socket)

Event Timeline

hashar created this task.May 1 2018, 7:06 PM
Restricted Application added subscribers: Scoopfinder, Aklapper. · View Herald TranscriptMay 1 2018, 7:06 PM

Change 429426 had a related patch set uploaded (by Hashar; owner: Hashar):
[mediawiki/extensions/AbuseFilter@master] Change primary key length to 191

https://gerrit.wikimedia.org/r/429426

@hashar So this is fixed per comment in T195020, right? I ran a check experimental on https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/AbuseFilter/+/439918/ and quibble passed.

Vvjjkkii renamed this task from [AbuseFilter] AbuseFilter/abusefilter.tables.sql : Error: 1071 Specified key was too long; max key length is 767 bytes to ivdaaaaaaa.Jul 1 2018, 1:12 AM
Vvjjkkii triaged this task as High priority.
Vvjjkkii updated the task description. (Show Details)
Vvjjkkii removed subscribers: gerritbot, Aklapper.
Daimona renamed this task from ivdaaaaaaa to [AbuseFilter] AbuseFilter/abusefilter.tables.sql : Error: 1071 Specified key was too long; max key length is 767 bytes.Jul 1 2018, 9:42 AM
Daimona closed this task as Resolved.
Daimona raised the priority of this task from High to Needs Triage.
Daimona updated the task description. (Show Details)
Daimona added subscribers: gerritbot, Aklapper.

Since we're here, I'm seizing the opportunity to close this as resolved since the problem was apparently fixed.

Change 429426 abandoned by Hashar:
Change primary key length to 191

https://gerrit.wikimedia.org/r/429426