Page MenuHomePhabricator

Resetting an option to default value with api's action=options triggers unneeded delete in UserOptionsManager
Closed, ResolvedPublicBUG REPORT

Description

List of steps to reproduce (step by step, including full links if applicable):

  • Use Special:ApiSandbox to set any option to the default value (Special:ApiSandbox#action=options&format=json&change=watchdefault%3D1)
  • Have a look at the logs, there is a delete statement for the user_properties table and the default option.
  • Rerun the api
  • There is still a delete, but there is never a row for this delete, it was deleted in the first step

What happens?:
If an app triggered many requests to the api's action=options to set options to the default value, it trigger delete statement and give pressure for the database, see T301433#7699716 for the problem/analyze

What should have happened instead?:
No delete is needed, there is no such a row
This would avoid the database (write) interaction for that unneeded web requests

Software version (if not a Wikimedia wiki), browser information, screenshots, other information, etc.: master

Event Timeline

Change 761706 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/core@master] Avoid deletes in UserOptionsManager for unchanged default values

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

Umherirrender triaged this task as Low priority.

Change 761706 merged by jenkins-bot:

[mediawiki/core@master] UserOptionsManager: Avoid DB delete queries for unchanged default values

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