jenkins-bot has submitted this change and it was merged. Change subject: Simplify "load-recent-authors" query ......................................................................
Simplify "load-recent-authors" query This might avoid confusing the query planner for pages edited mostly by the same bot user many times. Bug: T116557 Change-Id: Ife87695a4f16d549e8a46780aca4219b28310343 --- M AbuseFilterVariableHolder.php 1 file changed, 11 insertions(+), 13 deletions(-) Approvals: Legoktm: Looks good to me, approved jenkins-bot: Verified diff --git a/AbuseFilterVariableHolder.php b/AbuseFilterVariableHolder.php index 5c816c5..6f56bc6 100644 --- a/AbuseFilterVariableHolder.php +++ b/AbuseFilterVariableHolder.php @@ -490,27 +490,25 @@ $result = ''; break; } - - $dbr = wfGetDB( DB_SLAVE ); - $sqlTmp = $dbr->selectSQLText( + // Get the last 100 edit authors with a trivial query (avoid T116557) + $revAuthors = wfGetDB( DB_SLAVE )->selectFieldValues( 'revision', - array( 'rev_user_text', 'rev_timestamp' ), + 'rev_user_text', array( 'rev_page' => $title->getArticleID() ), __METHOD__, // Some pages have < 10 authors but many revisions (e.g. bot pages) array( 'ORDER BY' => 'rev_timestamp DESC', 'LIMIT' => 100 ) ); - $res = $dbr->query( - "SELECT rev_user_text FROM ($sqlTmp) AS tmp " . - "GROUP BY rev_user_text ORDER BY MAX(rev_timestamp) DESC LIMIT 10", - __METHOD__ - ); - + // Get the last 10 distinct authors within this set of edits $users = array(); - foreach( $res as $row ) { - $users[] = $row->rev_user_text; + foreach ( $revAuthors as $author ) { + $users[$author] = 1; + if ( count( $users ) >= 10 ) { + break; + } } - $result = $users; + + $result = array_keys( $users ); break; case 'load-first-author': $title = Title::makeTitle( $parameters['namespace'], $parameters['title'] ); -- To view, visit https://gerrit.wikimedia.org/r/260634 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ife87695a4f16d549e8a46780aca4219b28310343 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/AbuseFilter Gerrit-Branch: master Gerrit-Owner: Aaron Schulz <asch...@wikimedia.org> Gerrit-Reviewer: Jackmcbarn <jackmcb...@gmail.com> Gerrit-Reviewer: Legoktm <legoktm.wikipe...@gmail.com> Gerrit-Reviewer: Se4598 <se4...@gmx.de> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits