The flag makes the query return one revision per deleted title. This functionality is missing from the replacement module alldeletedrevisions.
Description
Details
Subject | Repo | Branch | Lines +/- | |
---|---|---|---|---|
ApiQueryDeletedRevisions: Optimize ascending title generation | mediawiki/core | master | +39 -5 |
Related Objects
Event Timeline
The way it was being done in the old module involves a MySQL misfeature. What exactly is the use case here, to help in planning a replacement?
To search the archive table for titles with a given prefix without having to iterate through the entire list of deleted revisions -- essentially like https://en.wikipedia.org/w/index.php?title=Special%3AUndelete&prefix=John . The current situation is not desirable if you hit a page with 5000 deleted revisions.
Would it be satisfactory if this only worked in generator mode and didn't work with 'gadruser', i.e. we just fix gadrgeneratetitles=1 to not internally process all the revisions? That looks like the best bet for a sane query.
It turns out I need to add one more restriction (unless @jcrespo has ideas?): you also need to pass gadrdir=newer.
Sample queries that seem to work:
SELECT DISTINCT ar_title,ar_namespace FROM `archive` ORDER BY ar_namespace ,ar_title LIMIT 11 SELECT DISTINCT ar_title,ar_namespace FROM `archive` WHERE (ar_title LIKE 'Foo%' ) ORDER BY ar_namespace ,ar_title LIMIT 11 SELECT DISTINCT ar_title,ar_namespace FROM `archive` WHERE ar_namespace = '0' ORDER BY ar_title LIMIT 11 SELECT DISTINCT ar_title,ar_namespace FROM `archive` WHERE ar_namespace IN ('0','1','2','3') ORDER BY ar_namespace ,ar_title LIMIT 11 SELECT DISTINCT ar_title,ar_namespace FROM `archive` INNER JOIN `change_tag` ON ((ar_rev_id=ct_rev_id)) WHERE ct_tag = 'Addition of interwiki link' ORDER BY ar_namespace ,ar_title LIMIT 11 SELECT DISTINCT ar_title,ar_namespace FROM `archive` INNER JOIN `change_tag` ON ((ar_rev_id=ct_rev_id)) WHERE ct_tag = 'Addition of interwiki link' AND ar_namespace IN ('0','1','2','3') ORDER BY ar_namespace ,ar_title LIMIT 11 SELECT DISTINCT ar_title,ar_namespace FROM `archive` WHERE (ar_namespace > 8 OR (ar_namespace = 8 AND ar_title >= 'Gadgets-definition')) ORDER BY ar_namespace ,ar_title LIMIT 11 SELECT DISTINCT ar_title,ar_namespace FROM `archive` WHERE (ar_title LIKE 'Foo%' ) AND (ar_namespace > 8 OR (ar_namespace = 8 AND ar_title >= 'Gadgets-definition')) ORDER BY ar_namespace ,ar_title LIMIT 11
If you try to do it with gadrdir=older, MySQL decides it has to filesort on the continuation queries for some reason:
SELECT DISTINCT ar_title,ar_namespace FROM `archive` WHERE (ar_namespace < 8 OR (ar_namespace = 8 AND ar_title <= 'Gadgets-definition')) ORDER BY ar_namespace DESC,ar_title DESC LIMIT 11; SELECT DISTINCT ar_title,ar_namespace FROM `archive` WHERE (ar_title LIKE 'Foo%' ) AND (ar_namespace < 8 OR (ar_namespace = 8 AND ar_title <= 'Gadgets-definition')) ORDER BY ar_namespace DESC,ar_title DESC LIMIT 11;
Change 236190 had a related patch set uploaded (by Anomie):
ApiQueryDeletedRevisions: Optimize ascenting title generation
Change 236190 merged by jenkins-bot:
ApiQueryDeletedRevisions: Optimize ascending title generation
Should be deployed to WMF wikis with 1.26wmf23, see https://www.mediawiki.org/wiki/MediaWiki_1.26/Roadmap for the schedule.