* (bug 25734) API: possible issue with revids validation
authorSam Reed <reedy@users.mediawiki.org>
Sun, 5 Jun 2011 17:49:00 +0000 (17:49 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Sun, 5 Jun 2011 17:49:00 +0000 (17:49 +0000)
commita5b8ef1056276c7cb2597ec5ea816209cb06305e
treeef9873b58ea9b1fad037de17bb1edb6aad28f1e5
parent8d38e2a8f5443db6470511e9a2f5a9e67e4fedf4
* (bug 25734) API: possible issue with revids validation

It seems, on databases with loads of revision rows (ie enwiki, not testwiki), although the EXPLAIN is sane, it's doing something stupid (table scan? I've nfi). So, as any revision id's less than 0 aren't valid, just prefilter them from the database SQL query

mysql> DESCRIBE SELECT /* ApiPageSet::initFromRevIDs  */  rev_id,rev_page  FROM `revision`,`page`  WHERE rev_id IN ('10','20','30','40','-50','60') AND (rev_page = page_id);
+----+-------------+----------+-------+-------------------------------+---------+---------+-----------------------+-------+--------------------------+
| id | select_type | table    | type  | possible_keys                 | key     | key_len | ref                   | rows  | Extra                    |
+----+-------------+----------+-------+-------------------------------+---------+---------+-----------------------+-------+--------------------------+
|  1 | SIMPLE      | page     | index | PRIMARY                       | PRIMARY | 4       | NULL                  | 22982 | Using index              |
|  1 | SIMPLE      | revision | ref   | PRIMARY,rev_id,page_timestamp | PRIMARY | 4       | testwiki.page.page_id |     1 | Using where; Using index |
+----+-------------+----------+-------+-------------------------------+---------+---------+-----------------------+-------+--------------------------+
RELEASE-NOTES-1.19
includes/api/ApiPageSet.php