From d798fd5ed1389b43d3df19d97ebc681c75cedee9 Mon Sep 17 00:00:00 2001 From: Aryeh Gregor Date: Thu, 14 Oct 2010 21:47:02 +0000 Subject: [PATCH] cl_sortkey should be 230 bytes long, not 255 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 | 2 +- maintenance/archives/patch-categorylinks-better-collation2.sql | 2 +- maintenance/tables.sql | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/maintenance/archives/patch-categorylinks-better-collation.sql b/maintenance/archives/patch-categorylinks-better-collation.sql index 7c711a3d79..606317ded0 100644 --- a/maintenance/archives/patch-categorylinks-better-collation.sql +++ b/maintenance/archives/patch-categorylinks-better-collation.sql @@ -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', diff --git a/maintenance/archives/patch-categorylinks-better-collation2.sql b/maintenance/archives/patch-categorylinks-better-collation2.sql index 7515c5615f..e9574693b3 100644 --- a/maintenance/archives/patch-categorylinks-better-collation2.sql +++ b/maintenance/archives/patch-categorylinks-better-collation2.sql @@ -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'); diff --git a/maintenance/tables.sql b/maintenance/tables.sql index 7f57d5aae5..b68e88853f 100644 --- a/maintenance/tables.sql +++ b/maintenance/tables.sql @@ -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 -- 2.20.1