From: Amir Sarabadani Date: Mon, 24 Apr 2017 12:58:51 +0000 (+0430) Subject: Do not add limit to ApiQueryPagePropNames when database type is mysql X-Git-Tag: 1.31.0-rc.0~3415^2 X-Git-Url: https://git.cyclocoop.org/%7B%7B%20url_for%28%27static%27%2C%20filename=%27css/bootstrap.css%27%29%20%7D%7D?a=commitdiff_plain;h=e2ad38f8e94838a90ccc151d554969cf81558839;p=lhc%2Fweb%2Fwiklou.git Do not add limit to ApiQueryPagePropNames when database type is mysql It's a known bug in some versions of mysql (including WMF dbs) that it won't do a loose index scan when a limit is applied. Given that number of possible types is still very low, this shouldn't be a problem. More info: https://bugs.mysql.com/bug.php?id=61517 Bug: T115825 Change-Id: I4c3b885ac05b793088a92e054a38a36b9d07c0d4 --- diff --git a/includes/api/ApiQueryPagePropNames.php b/includes/api/ApiQueryPagePropNames.php index 4966bcde04..ff97668117 100644 --- a/includes/api/ApiQueryPagePropNames.php +++ b/includes/api/ApiQueryPagePropNames.php @@ -57,7 +57,11 @@ class ApiQueryPagePropNames extends ApiQueryBase { } $limit = $params['limit']; - $this->addOption( 'LIMIT', $limit + 1 ); + + // mysql has issues with limit in loose index T115825 + if ( $this->getDB()->getType() !== 'mysql' ) { + $this->addOption( 'LIMIT', $limit + 1 ); + } $result = $this->getResult(); $count = 0;