Skip to content

Pause retention sweep while there is an in-progress migration - #6206

Open
rbev wants to merge 2 commits into
warwick/migration-engine-1from
pause-sweep
Open

rbev wants to merge 2 commits into
warwick/migration-engine-1from
pause-sweep

Conversation

@rbev

@rbev rbev commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

Retention can delete SQL rows while the background migration still relies on them. A resolved or archived message deleted before the copier reaches it can return as unresolved. Group comments can also disappear before their messages arrive.

Check persisted migration checkpoints before taking the sweep lock. If any category is neither Complete nor Abandoned, log the unfinished categories and return without starting a sweep. This applies to scheduled sweeps and manual purges, including after a restart.

The purge API returns HTTP 400 with status error and a reason naming the unfinished categories. A refused attempt leaves the sweep status unchanged. Retention resumes at the next scheduled check once every category finishes. SQL storage can grow beyond its retention period while a category remains unfinished.

@rbev rbev self-assigned this Nov 30, 2026
class RetentionSweeper(
// caller-supplied cutoffs.
//
// Deletes nothing while a migration checkpoint is unfinished: docs/migration/ravendb-to-sql-migration-system-design.md#retention-during-migration

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can read code, is there point to this comment?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants