r70716 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70715‎ | r70716 | r70717 >
Date:16:51, 8 August 2010
Author:simetrical
Status:resolved (Comments)
Tags:
Comment:
Update tables.sql for category sorting changes

Pointed out by X! on Code Review for r69961. There are a couple of
FIXMEs here, I'm waiting for review to evaluate how to fix them.
Modified paths:
  • /trunk/phase3/maintenance/tables.sql (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/tables.sql
@@ -490,29 +490,53 @@
491491 -- all such pages are in namespace 14 (NS_CATEGORY).
492492 cl_to varchar(255) binary NOT NULL default '',
493493
494 - -- The title of the linking page, or an optional override
495 - -- to determine sort order. Sorting is by binary order, which
496 - -- isn't always ideal, but collations seem to be an exciting
497 - -- and dangerous new world in MySQL... The sortkey is updated
498 - -- if no override exists and cl_from is renamed.
 494+ -- A binary string obtained by applying a sortkey generation algorithm
 495+ -- (Language::convertToSortkey()) to page_title, or cl_sortkey_prefix . "\0"
 496+ -- . page_title if cl_sortkey_prefix is nonempty.
499497 --
500 - -- Truncate so that the cl_sortkey key fits in 1000 bytes
501 - -- (MyISAM 5 with server_character_set=utf8)
 498+ -- Truncate so that the cl_sortkey key fits in 1000 bytes (MyISAM 5 with
 499+ -- server_character_set=utf8). FIXME: this truncation probably makes no
 500+ -- sense anymore; we should be using varbinary for this, utf8 will break
 501+ -- everything.
502502 cl_sortkey varchar(70) binary NOT NULL default '',
 503+
 504+ -- A prefix for the raw sortkey manually specified by the user, either via
 505+ -- [[Category:Foo|prefix]] or {{defaultsort:prefix}}. If nonempty, it's
 506+ -- concatenated with a null followed by the page title before the sortkey
 507+ -- conversion algorithm is run. We store this so that we can update
 508+ -- collations without reparsing all pages.
 509+ cl_sortkey_prefix varchar(255) binary NOT NULL default '',
503510
504511 -- This isn't really used at present. Provided for an optional
505512 -- sorting method by approximate addition time.
506 - cl_timestamp timestamp NOT NULL
 513+ cl_timestamp timestamp NOT NULL,
 514+
 515+ -- Stores $wgCollationVersion at the time cl_sortkey was generated. This can
 516+ -- be used to install new collation versions, tracking which rows are not yet
 517+ -- updated. 0 means no collation, this is a legacy row that needs to be
 518+ -- updated by updateCollation.php. In the future, it might be possible to
 519+ -- specify different collations per category.
 520+ cl_collation tinyint NOT NULL default 0,
 521+
 522+ -- Stores whether cl_from is a category, file, or other page, so we can
 523+ -- paginate the three categories separately. This never has to be updated
 524+ -- after the page is created, since none of these page types can be moved to
 525+ -- any other.
 526+ cl_type ENUM('page', 'subcat', 'file') NOT NULL default 'page'
507527 ) /*$wgDBTableOptions*/;
508528
509529 CREATE UNIQUE INDEX /*i*/cl_from ON /*_*/categorylinks (cl_from,cl_to);
510530
511 -CREATE INDEX /*i*/cl_sortkey ON /*_*/categorylinks (cl_to,cl_sortkey,cl_from);
 531+-- We always sort within a given category, and within a given type. FIXME:
 532+-- Formerly this index didn't cover cl_type (since that didn't exist), so old
 533+-- callers won't be using an index: fix this?
 534+CREATE INDEX /*i*/cl_sortkey ON /*_*/categorylinks (cl_to,cl_type,cl_sortkey,cl_from);
512535
513536 -- Not really used?
514537 CREATE INDEX /*i*/cl_timestamp ON /*_*/categorylinks (cl_to,cl_timestamp);
515538
 539+-- For finding rows with outdated collation
 540+CREATE INDEX /*i*/cl_collation ON /*_*/categorylinks (cl_collation);
516541
517542 --
518543 -- Track all existing categories. Something is a category if 1) it has an en-

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r69961Reconcept cl_raw_sortkey as cl_sortkey_prefix...simetrical19:27, 26 July 2010

Comments

#Comment by Reedy (talk | contribs)   22:54, 7 January 2011

Was there a related DB update patch created to go with this? Quick look I can't spot anything, but that might just be being blind..

#Comment by Simetrical (talk | contribs)   23:56, 8 January 2011

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

Status & tagging log