wiki.techinc.nl/maintenance/archives/patch-revision-actor-comment-MCR.sql
daniel fe8b5fa79c make rev_actor_timestamp index cover the rev_id field.
This adds the rev_id column to the end of the rev_actor_timestamp index
to make it unambiguous. With the id field added, the index matches the
pagination criterion for user contributions (filter by actor, sort by
timestamp, then disambiguate based on revision id). The index is not
marked UNIQUE since this would potentially degrade write performance.
Uniqueness is already guaranteed by the rev_id field being the primary
key.

Note that no provisions are made to change the definition of the
rev_actor_timestamp index for existing instances. This index was only
recently added in I18071a2fe45907a0cf1b0fefebd96a97a2dacb7b and has not
been part of any release. It has also not yet been created on the wikimedia
servers. For this reason, any existing instances are assumed to be for
testing only. Instances would also continue to function normally with
the previous index definition.

With this patch, the new index will be created correctly when updating
from 1.34 or earlier. It will however not be modified for installations
of some development version of 1.35.

Bug: T200259
Bug: T238966
Change-Id: I511bb21b1ca820d950818cc831f8e3fef43a1559
2020-06-03 09:14:42 +02:00

17 lines
746 B
SQL

-- T161671, T184615, T215466: Drop old revision user, comment, and content fields, and
-- add the replacement actor and comment_id fields.
ALTER TABLE /*_*/revision
DROP INDEX /*i*/user_timestamp,
DROP INDEX /*i*/page_user_timestamp,
DROP INDEX /*i*/usertext_timestamp,
DROP COLUMN rev_text_id,
DROP COLUMN rev_comment,
DROP COLUMN rev_user,
DROP COLUMN rev_user_text,
DROP COLUMN rev_content_model,
DROP COLUMN rev_content_format,
ADD COLUMN rev_comment_id bigint unsigned NOT NULL default 0 AFTER rev_page,
ADD COLUMN rev_actor bigint unsigned NOT NULL default 0 AFTER rev_comment_id,
ADD INDEX /*i*/rev_actor_timestamp (rev_actor,rev_timestamp,rev_id),
ADD INDEX /*i*/rev_page_actor_timestamp (rev_page,rev_actor,rev_timestamp);