https://bugzilla.wikimedia.org/show_bug.cgi?id=25503

--- Comment #5 from Dmitriy <c...@uniyar.ac.ru> 2010-10-14 10:41:27 UTC ---
> Please post the output of "SHOW CREATE TABLE wiki_categorylinks\G".  I have a 
> guess as to how this could happen, but would like to confirm it.
Here's the output:

CREATE TABLE `wiki_categorylinks` (
  `cl_from` int(10) unsigned NOT NULL DEFAULT '0',
  `cl_to` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
  `cl_sortkey` varbinary(255) NOT NULL DEFAULT '',
  `cl_timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE
CURRENT_TIMESTAMP,
  `cl_sortkey_prefix` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL
DEFAULT '',
  `cl_collation` varbinary(32) NOT NULL DEFAULT '',
  `cl_type` enum('page','subcat','file') NOT NULL DEFAULT 'page',
  UNIQUE KEY `cl_from` (`cl_from`,`cl_to`),
  KEY `cl_timestamp` (`cl_to`,`cl_timestamp`),
  KEY `cl_collation` (`cl_collation`),
  KEY `cl_sortkey` (`cl_to`,`cl_type`,`cl_sortkey`(1),`cl_from`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8

Then, I've tried field length of 231 utf8 chars:
ALTER TABLE wiki_categorylinks CHANGE COLUMN cl_sortkey cl_sortkey
varbinary(231) NOT NULL default '';

caused the same error when altering index, while

230 utf8 chars seems to be OK:
ALTER TABLE wiki_categorylinks CHANGE COLUMN cl_sortkey cl_sortkey
varbinary(230) NOT NULL default '';

fixed the error:
mysql> ALTER TABLE `wiki_categorylinks` DROP INDEX cl_sortkey, ADD INDEX
cl_sortkey (cl_to, cl_type, cl_sortkey, cl_from);
Query OK, 11510 rows affected (1.06 sec)
Records: 11510  Duplicates: 0  Warnings: 0

> No.  That destroys the point of the index, you may as well just drop the index
entirely if you do that.  The field itself has to be shortened, not the index. 
The index has to cover the whole field to work correctly.  (Although if your
wiki is small enough, you might not notice the difference if the index isn't
working.)
Thanks for info, my mistake.

> This is not related to MyISAM, as far as I know -- it's probably related to 
> the use of utf8 collation instead of binary.
I've switched another wiki from 1.16 trunk (with InnoDB tables) to 1.17 trunk
just few days before and there was no warnings or errors during execution of
update.php. Has that patch-categorylinks-better-collation.sql already been
incorporated into pre-release 1.16 ? It seems not - cannot find such patch in
old backup. So I am not absolutely sure that it's unrelated to MyISAM (however
this is another 1.15.4 wiki).

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to