Page MenuHomePhabricator

Upgrading from 1.2 to 1.11 fails with Mysql error
Closed, ResolvedPublic

Description

Author: caluml

Description:
Hello, I am following on from bug 11450, and now have this problem.

Query "ALTER TABLE imagelinks
DROP INDEX il_to,
ADD INDEX il_to(il_to, il_from)
" failed with error code "Specified key was too long; max key length is 1000 bytes (localhost)".

It did complain about imagelinks (or pagelinks?) not existing, but I reloaded the config/index.php and it went on.
However, it's stopping here.

PS. Thanks for the speed fix to the 11450 problem :)


Version: 1.11.x
Severity: normal
OS: Linux

Details

Reference
bz11451

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:00 PM
bzimport set Reference to bz11451.
bzimport added a subscriber: Unknown Object (MLST).

Hrm.... there should be no way that index is going to be too long. Even if the utf-8 case it'd be like 769 bytes.

Ah, it looks like 1.2 had an older form of the imagelinks table where il_from is a string, which is longer. The new imagelinks table (with page ID for il_from) is present from 1.3.

The updaters seem to be missing the restructuring of the imagelinks table, though. The links table is restructured via do_old_links_update() (via convertLinks.inc), and the index isn't added until do_backlinking_indices_update() later on.

Probably convertLinks.inc needs to be redone to apply the updates on the imagelinks table as well. Surprised nobody's caught this yet; I guess it sort of works even if you leave the string there, unless the index hits you. ;)

caluml wrote:

I know I'm being a pain, updating from such an old version - sorry about that.

Are there any SQL commands I can run to get past this stage?

caluml wrote:

Hello - just wondering if there's any quick fix that I can do to get me past this as my Wiki has been down for quite a while.

Just redo the imagelinks table from tables.sql.

caluml wrote:

I've rolled back to the old one now.

What do you mean by "redo"? Create?

Fixed in r50580 for release in MW 1.15. Note that you will have to run maintenance/refreshLinks.php after you install if you want the imagelinks table to be populated.