Last modified: 2013-07-15 15:56:29 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T49490, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 47490 - resetUserTokens.php not usable on large wikis
resetUserTokens.php not usable on large wikis
Status: NEW
Product: MediaWiki
Classification: Unclassified
Maintenance scripts (Other open bugs)
1.22.0
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
deploysprint-13
: performance
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-04-22 02:11 UTC by Tim Starling
Modified: 2013-07-15 15:56 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Tim Starling 2013-04-22 02:11:38 UTC
resetUserTokens.php calls User::saveSettings(), which is fast enough for most things, but far too slow for the task of modifying every user in the database. It may even have scary side-effects like preference normalisation. 

Also, the main SELECT query is not batched and may use a lot of memory.

What's needed is something that just does updates user_token for each user and nothing else. Calling authentication plugin hooks while this is going on is probably harmful: CentralAuth can more efficiently update gu_auth_token in a script of its own.

MySQL doesn't provide a particularly convenient method for updating multiple rows at a time with different literal values, but something like this seems to be possible:

CREATE TEMPORARY TABLE new_tokens (nt_user_id int, nt_token varbinary(32));
INSERT INTO new_tokens VALUES (...), (...), ...;
UPDATE user SET user_token = (SELECT nt_token FROM new_tokens WHERE nt_user_id=user_id) WHERE user_id BETWEEN ... AND ...;

Maybe if the rows were updated in batches of 50 or so, a large wiki could have its tokens reset in a reasonable amount of time.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links