New maintenance script to recalculate category membership counts
authorThis, that and the other <at.light@live.com.au>
Thu, 26 Jan 2017 11:39:30 +0000 (22:39 +1100)
committerAaron Schulz <aschulz@wikimedia.org>
Sat, 15 Jul 2017 07:37:11 +0000 (07:37 +0000)
commit50affc7781bd6e220406432b2f281cf83d2380f8
treee750cd51b95d1689345547021c9f619cbd3849ef
parent6d4b02901b93bdfdd4f9eba04ac5e7a3be839637
New maintenance script to recalculate category membership counts

The category membership counts stored in the category table have a habit of
drifting away from the actual number of pages in the category. This script
identifies incorrectly-counted categories by performing a SELECT on the
replica DB, then querying master for up-to-date counts and updating the
category rows with those counts.

It's possible that a LinksUpdate job will be in progress while this script
is run. LinksUpdate does categorylinks INSERTs and category UPDATEs in
separate transactions, and our count might occur in between, leading to
category values that are slightly off. But since we are only updating
categories with already incorrect counts, we are not making the situation
any worse than it already was.

The script runs reasonably quickly on all but the very largest wikis.

Bug: T18765
Change-Id: I555f068fbf3aee20a7775d5532781f421f706346
autoload.php
maintenance/recountCategories.php [new file with mode: 0644]