cl_sortkey should be 230 bytes long, not 255
authorAryeh Gregor <simetrical@users.mediawiki.org>
Thu, 14 Oct 2010 21:47:02 +0000 (21:47 +0000)
committerAryeh Gregor <simetrical@users.mediawiki.org>
Thu, 14 Oct 2010 21:47:02 +0000 (21:47 +0000)
Bug 25503, reported by Dmitriy.  When switching it to binary, I figured
that since it would always be one byte per character now, there would be
room to make it the full 255 bytes.  In fact, if cl_to is utf8, the
(cl_to, cl_type, cl_sortkey, cl_from) index will be 255*3 + 1 + 255 + 4
= 1025 bytes, longer than the max of 1000.  Shortening cl_sortkey to 230
bytes fixes this (fix tested by Dmitriy).

I didn't add an updater because if you're already running the current
schema without problems, you don't need this change.

maintenance/archives/patch-categorylinks-better-collation.sql
maintenance/archives/patch-categorylinks-better-collation2.sql
maintenance/tables.sql

index 7c711a3..606317d 100644 (file)
@@ -5,7 +5,7 @@
 -- changes are also incorporated into patch-categorylinks-better-collation2.sql,
 -- for the benefit of trunk users who applied the original.
 ALTER TABLE /*$wgDBprefix*/categorylinks
-       CHANGE COLUMN cl_sortkey cl_sortkey varbinary(255) NOT NULL default '',
+       CHANGE COLUMN cl_sortkey cl_sortkey varbinary(230) NOT NULL default '',
        ADD COLUMN cl_sortkey_prefix varchar(255) binary NOT NULL default '',
        ADD COLUMN cl_collation varbinary(32) NOT NULL default '',
        ADD COLUMN cl_type ENUM('page', 'subcat', 'file') NOT NULL default 'page',
index 7515c56..e957469 100644 (file)
@@ -7,6 +7,6 @@
 -- large table unnecessarily for people upgrading from 1.16, so this will be
 -- skipped if unneeded.
 ALTER TABLE /*$wgDBprefix*/categorylinks
-       CHANGE COLUMN cl_sortkey cl_sortkey varbinary(255) NOT NULL default '',
+       CHANGE COLUMN cl_sortkey cl_sortkey varbinary(230) NOT NULL default '',
        CHANGE COLUMN cl_collation cl_collation varbinary(32) NOT NULL default '';
 INSERT IGNORE INTO /*$wgDBprefix*/updatelog (ul_key) VALUES ('cl_fields_update');
index 7f57d5a..b68e888 100644 (file)
@@ -492,7 +492,7 @@ CREATE TABLE /*_*/categorylinks (
   -- A binary string obtained by applying a sortkey generation algorithm
   -- (Language::convertToSortkey()) to page_title, or cl_sortkey_prefix . "\0"
   -- . page_title if cl_sortkey_prefix is nonempty.
-  cl_sortkey varbinary(255) NOT NULL default '',
+  cl_sortkey varbinary(230) NOT NULL default '',
 
   -- A prefix for the raw sortkey manually specified by the user, either via
   -- [[Category:Foo|prefix]] or {{defaultsort:prefix}}.  If nonempty, it's