Followup to creating the watchlist_expiry table in T240094: Create required table for new Watchlist Expiry feature, the purging mechanism should be added.
Considerations for this are following the comment https://phabricator.wikimedia.org/T240094#5852474 by @Anomie
Acceptance criteria
- Create a purging operation that starts a job with batches of deletes (from the comment above, the process includes:)
- Begin transaction
- Query a batch of wl_ids to delete (with a set limit)
- Delete the batch in two queries, DELETE FROM watchlist WHERE wl_id IN (...) and DELETE FROM watchlist_expiry WHERE we_item IN (...).
- Commit transaction and wait for replication
- Repeat if necessary (i.e. if $N rows were actually fetched), probably by rescheduling the job.
- The purging operation should be done every X edits, where X is a configuration variable that has a default but can be set separately per wiki.
- The operation must be contained behind a feature flag -- the same feature flag will be used for the entire product going forward.