Page MenuHomePhabricator

Add namespace column and index to table
Open, Needs TriagePublic

Description

The goal of this task is to define all of the steps and code required for both production and open source release of a database change which adds a column to an existing table, populates the new column with data from other columns and also adds code to the recording function that adds new records which now include the new columns data. In this case, we are adding namespace info to an existing table as a separate column in the Linter table.

The Linter table is used for a variety of reports and allows results record sets to be filtered based on a number of criteria including namespace. The current Linter table does not contain a separate column for each records namespace component of the pages title and thus selects cannot reduce the result set based on that criteria and have to loop through a much larger record set to find those records with the appropriate namespace.

The process of making this type of database change requires a DBA and a developer to cooperate and coordinate their activities and understand the time it takes for some operations to complete and propagate, and other issues such as the ability roll back, UI and new code dependencies and dual mode operation based on feature flag enablement and other minor details. It is hoped this task will touch on and provide a complete guide to developers wishing to accomplish this type of comprehensive task

Event Timeline

@Sbailey The ContentTranslation tag in this ticket - was this added intentionally?

It was unintentional, sorry about that,

Shannon

@Sbailey: If I get it right, this is a Documentation task, thus adding tag so this task could be found.
In my understanding, https://wikitech.wikimedia.org/wiki/Schema_changes and https://wikitech.wikimedia.org/wiki/Creating_new_tables cover this mostly.
You may want to add DBA for additional input for specific aspects.

Change 755817 had a related patch set uploaded (by Sbailey; author: Sbailey):

[mediawiki/extensions/Linter@master] WIP Add namespace column and new index to Linter table

https://gerrit.wikimedia.org/r/755817

Change 756101 had a related patch set uploaded (by Sbailey; author: Sbailey):

[mediawiki/extensions/Linter@master] WIP Add namespace column and new index to Linter table - part 2

https://gerrit.wikimedia.org/r/756101

So in the process of creating a set of patches that add a column for part 1, start populating the new column when new records are written in part 2, will do a full pass through existing records migrating data derived form data in another column to populate the new column completely in part 3, then add code to utilize the new column for search/reporting in part 4, then do a complete refactor of old and new code, removing old code and moving new code around as needed and removing config variable enablements, etc.

Change 757117 had a related patch set uploaded (by Sbailey; author: Sbailey):

[mediawiki/extensions/Linter@master] WIP Add namespace column and new index to Linter table - part 3

https://gerrit.wikimedia.org/r/757117

Change 757527 had a related patch set uploaded (by Sbailey; author: Sbailey):

[mediawiki/extensions/Linter@master] WIP Add namespace column and new index to Linter table - part 4

https://gerrit.wikimedia.org/r/757527

Change 755817 merged by jenkins-bot:

[mediawiki/extensions/Linter@master] Add namespace column and new index to Linter table - part 1

https://gerrit.wikimedia.org/r/755817

Change 756101 merged by jenkins-bot:

[mediawiki/extensions/Linter@master] Add namespace column and new index to Linter table - part 2

https://gerrit.wikimedia.org/r/756101