Page MenuHomePhabricator

Remove SiteLinkStore::clear() and Store::clear()
Closed, ResolvedPublic

Description

I just came across the SiteLinkTable::clear() method, which truncates the whole wb_items_per_site table (as a delete() with conditions '*'). If this method is ever called in production, I assume it will immediately cause replication lag to skyrocket as the replicas struggle to delete millions and millions of rows – not to mention the functionality impact of suddenly losing all connections between pages and items (compare T249565), or that the table would take at least several hours to rebuild (compare T249596, and that was after a backup of the table had been restored). In other words, this looks like a footgun, an accident waiting to happen.

Fortunately, SiteLinkStore::clear() (the parent interface method) is apparently only called from one place in the code, SqlStore::clear(); and Store::clear() (ditto) is never called anywhere at all. I suggest we unceremoniously remove both of these methods and their implementations.

Event Timeline

Change 682675 had a related patch set uploaded (by Lucas Werkmeister (WMDE); author: Lucas Werkmeister (WMDE)):

[mediawiki/extensions/Wikibase@master] Remove clear() methods from store interfaces+classes

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

Change 682675 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Remove clear() methods from store interfaces+classes

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