Page MenuHomePhabricator

SI: Improve the GlobalBlockCheck class to batch lookups for global blocks and central IDs
Closed, ResolvedPublic

Description

Summary

In the QA of T418293: Suggested Investigations: Create a filter to filter out cases with no users blocked, it was seen that the GlobalBlockCheck is running slowly when many users are checked. We should batch the queries it performs to reduce the time it takes to execute

Background

  • GlobalBlocking currently has no way to lookup multiple global blocks for different targets at once
    • This functionality exists for MediaWiki core blocks
    • We need this functionality so that we can avoid making hundreds of queries where each query is per-user in GlobalBlockCheck
  • Additionally, GlobalBlockCheck calls ::centralIdFromLocalUser for each user which means a query per user
    • We should make use of the ::lookupAttachedUserNames method which we can call with multiple usernames at once

Technical details

As can be seen by this Excimer, the request with this filter takes a long time on just the GlobalBlockCheck:

image.png (615×1 px, 108 KB)

Acceptance criteria

  • The queries in GlobalBlockCheck are batched

Event Timeline

Change #1248094 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/extensions/GlobalBlocking@master] Add GlobalBlockLookup::getGlobalBlocksForCentralIds

https://gerrit.wikimedia.org/r/1248094

Change #1248110 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/extensions/CheckUser@master] Update GlobalBlockCheck to use batched queries

https://gerrit.wikimedia.org/r/1248110

Change #1248094 merged by jenkins-bot:

[mediawiki/extensions/GlobalBlocking@master] Add GlobalBlockLookup::getGlobalBlocksForCentralIds

https://gerrit.wikimedia.org/r/1248094

Change #1248110 merged by jenkins-bot:

[mediawiki/extensions/CheckUser@master] Update GlobalBlockCheck to use batched queries

https://gerrit.wikimedia.org/r/1248110

Dreamy_Jazz updated the task description. (Show Details)