Skip to content

Implement manual retention sweep - #5845

Draft
rbev wants to merge 2 commits into
masterfrom
allow-manual-retention-sweep
Draft

Implement manual retention sweep#5845
rbev wants to merge 2 commits into
masterfrom
allow-manual-retention-sweep

Conversation

@rbev

@rbev rbev commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

This pull request introduces a manual data retention sweep API for ServiceControl, enabling users to trigger and monitor retention sweeps via new endpoints. It includes new API contracts, permission management, and enhancements to the EFCore persistence layer to support manual and scheduled sweeps, including proper status reporting and concurrency control. Additionally, it ensures that unsupported operations on RavenDB are handled gracefully.

Manual Retention Sweep API and EFCore Support:

  • Introduced new API contracts: RetentionSweepRequest, RetentionSweepResponse, and RetentionSweepStatus to enable manual triggering and status polling for data retention sweeps (src/ServiceControl.Api/Contracts/RetentionSweepRequest.cs, RetentionSweepResponse.cs, RetentionSweepStatus.cs). [1] [2] [3]
  • Added the IRetentionApi interface defining methods for starting a sweep and retrieving sweep status, with support for indicating when the operation is not supported (e.g., on RavenDB) (src/ServiceControl.Api/IRetentionApi.cs).
  • Enhanced the EFCore RetentionSweeper to support manual sweeps with caller-supplied cutoffs, concurrency control to prevent overlapping sweeps, and detailed status reporting for the new API (src/ServiceControl.Persistence.EFCore/Infrastructure/RetentionSweeper.cs, BasePersistence.cs). [1] [2] [3] [4] [5] [6] [7]

API Permissions and Roles:

  • Added a new permission constant ErrorRetentionSweep and included it in the admin role permissions to control access to the manual retention sweep API (src/ServiceControl.Infrastructure/Auth/Permissions.cs, RolePermissions.cs). [1] [2]


return response.Status switch
{
"started" => Accepted(response),

@rbev rbev Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

these statuses should probably be an enum

@rbev
rbev requested review from abparticular, johnsimons and warwickschroeder and removed request for johnsimons September 2, 2026 07:25
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.

1 participant