MaxSem has uploaded a new change for review.
https://gerrit.wikimedia.org/r/79761
Change subject: Disable slow list=allusers&auactiveusers query in miser mode
......................................................................
Disable slow list=allusers&auactiveusers query in miser mode
Bug: 52979
Example slow query that was frying our servers yesterday:
> EXPLAIN SELECT /* ApiQueryAllUsers::execute MaxSem */ COUNT(*) AS
> recentedits,user_name,user_id FROM `user` FORCE INDEX (user_name) INNER JOIN
> `recentchanges` ON ((rc_user_text=user_name)) WHERE (rc_log_type IS NULL OR
> rc_log_type != 'newusers') AND (rc_timestamp >= '20130720085133') GROUP BY
> rc_user_text ORDER BY rc_user_text LIMIT 501\G
*************************** 1. row ***************************
id: 1
select_type: SIMPLE
table: recentchanges
type: range
possible_keys: rc_timestamp,rc_user_text
key: rc_timestamp
key_len: 16
ref: NULL
rows: 3007662
Extra: Using index condition; Using where; Rowid-ordered scan; Using
temporary; Using filesort
Change-Id: I7cdd298c15ff729410b24085e65e702218f534da
---
M includes/api/ApiQueryAllUsers.php
1 file changed, 7 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/61/79761/1
diff --git a/includes/api/ApiQueryAllUsers.php
b/includes/api/ApiQueryAllUsers.php
index 1948a51..4ea51b4 100644
--- a/includes/api/ApiQueryAllUsers.php
+++ b/includes/api/ApiQueryAllUsers.php
@@ -151,7 +151,12 @@
}
if ( $params['activeusers'] ) {
- global $wgActiveUserDays;
+ global $wgActiveUserDays, $wgMiserMode;
+
+ if ( !$wgMiserMode ) {
+ $this->dieUsage( 'Active users listing is
disabled in miser mode', 'activeusersdisabled' );
+ }
+
$this->addTables( 'recentchanges' );
$this->addJoinConds( array( 'recentchanges' => array(
@@ -432,6 +437,7 @@
public function getPossibleErrors() {
return array_merge( parent::getPossibleErrors(), array(
array( 'code' => 'group-excludegroup', 'info' => 'group
and excludegroup cannot be used together' ),
+ array( 'code' => 'activeusersdisabled', 'info' =>
'Active users listing is disabled in miser mode' ),
) );
}
--
To view, visit https://gerrit.wikimedia.org/r/79761
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7cdd298c15ff729410b24085e65e702218f534da
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: MaxSem <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits