The retention purge can delete a site a member is restoring #245

Closed
opened 2026-10-22 03:43:19 +00:00 by cgalo5758 · 1 comment
Owner

What happens

The retention purge reads the archived sites past the 30-day window once, then hard-deletes each on the farm and deletes its row without reading the site again. A member who restores one of those sites before the purge reaches it has the restore accepted, and the purge then deletes the site on the farm and deletes its row, whatever status the row has by then. If the restore had finished, the pool's usage also stays one above its active sites, because the purge writes no usage.

What should happen

The purge deletes a site only while its row is still archived and past the window and no lifecycle request on the site is open, checked at the delete. Otherwise it leaves the site to a later tick, as the sync already skips a site with an open request.

Where

internal/integrations/fedwiki/workflows/reconcile.go, PurgeExpiredArchivedActivity

Steps

Archive a site and move its archived_at back past 30 days, start a restore, and let the sync tick run while the restore's farm call is in progress.

Why it matters

A restore the console accepted ends with the member's site permanently deleted.

### What happens The retention purge reads the archived sites past the 30-day window once, then hard-deletes each on the farm and deletes its row without reading the site again. A member who restores one of those sites before the purge reaches it has the restore accepted, and the purge then deletes the site on the farm and deletes its row, whatever status the row has by then. If the restore had finished, the pool's usage also stays one above its active sites, because the purge writes no usage. ### What should happen The purge deletes a site only while its row is still archived and past the window and no lifecycle request on the site is open, checked at the delete. Otherwise it leaves the site to a later tick, as the sync already skips a site with an open request. ### Where `internal/integrations/fedwiki/workflows/reconcile.go`, `PurgeExpiredArchivedActivity` ### Steps Archive a site and move its `archived_at` back past 30 days, start a restore, and let the sync tick run while the restore's farm call is in progress. ### Why it matters A restore the console accepted ends with the member's site permanently deleted.
cgalo5758 added this to the Public launch milestone 2026-10-22 03:43:19 +00:00
cgalo5758 added the
kind
bug
area/fedwiki
labels 2026-10-22 03:43:19 +00:00
Author
Owner

The retention purge, the step at the end of each FedWiki sync run (hourly by default) that permanently deletes sites left archived for more than 30 days, no longer acts on a list it read once. For each site it now takes, in its own transaction, the lock every lifecycle request on that site takes at intake (a lifecycle request is the console's record of an archive, a restore or another change to a site on the wiki farm), then the site's row, and checks again that the row is still archived, still past the window, and that no request on the site is open. It holds both locks through the farm's delete and the row's delete. A site that a restore has reached, or that changed or disappeared in the meantime, is left to a later run. So a restore the console has accepted can no longer end with the site deleted, and since only archived sites with no open request are deleted, the pool's usage stays right. A farm that refuses the delete keeps the row; a farm that answers that the site is already gone counts as deleted. The lock order is written in docs/database-locks.md.

What it costs: while the farm's delete runs, which can take up to 30 seconds, a member's request on that same site waits on the lock, and a wait past the server's eight-second write timeout loses its answer (#290). A request made from a page loaded before the purge removed the site is still accepted and then declined when its work starts; that path is recorded on #284.

Commit: 0b34afa8

The retention purge, the step at the end of each FedWiki sync run (hourly by default) that permanently deletes sites left archived for more than 30 days, no longer acts on a list it read once. For each site it now takes, in its own transaction, the lock every lifecycle request on that site takes at intake (a lifecycle request is the console's record of an archive, a restore or another change to a site on the wiki farm), then the site's row, and checks again that the row is still archived, still past the window, and that no request on the site is open. It holds both locks through the farm's delete and the row's delete. A site that a restore has reached, or that changed or disappeared in the meantime, is left to a later run. So a restore the console has accepted can no longer end with the site deleted, and since only archived sites with no open request are deleted, the pool's usage stays right. A farm that refuses the delete keeps the row; a farm that answers that the site is already gone counts as deleted. The lock order is written in `docs/database-locks.md`. What it costs: while the farm's delete runs, which can take up to 30 seconds, a member's request on that same site waits on the lock, and a wait past the server's eight-second write timeout loses its answer (#290). A request made from a page loaded before the purge removed the site is still accepted and then declined when its work starts; that path is recorded on #284. Commit: 0b34afa8
Sign in to join this conversation.
No labels area/fedwiki
kind
bug
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: wiki-cafe/member-console#245