Skip to content

feat: support batching of janitor cleanup#5469

Closed
eakmanrq wants to merge 1 commit intomainfrom
eakmanrq/allow_batching_janitor_cleanup
Closed

feat: support batching of janitor cleanup#5469
eakmanrq wants to merge 1 commit intomainfrom
eakmanrq/allow_batching_janitor_cleanup

Conversation

@eakmanrq
Copy link
Collaborator

@eakmanrq eakmanrq commented Oct 1, 2025

Prior to this PR, janitor would always read all expired snapshots into memory. This is fine during normal operations but if for some reason janitor has not run for a while this can result in a lot of snapshots being read into memory.

This PR allows users to configure the janitor to batch up what is being processed. It does this by adjusting the "current_ts" (batch_start) and then incrementing this by the provided batch_size_seconds. So for example a user could provide the following to process the last 7 days of expired snapshots 1 day at a time:

sqlmesh janitor --batch-start "7 days ago" --batch-seconds 86400

@eakmanrq eakmanrq force-pushed the eakmanrq/allow_batching_janitor_cleanup branch from 205a558 to c23e6cd Compare October 1, 2025 23:19
@eakmanrq eakmanrq force-pushed the eakmanrq/allow_batching_janitor_cleanup branch from c23e6cd to 45e6f8e Compare October 1, 2025 23:30
@eakmanrq
Copy link
Collaborator Author

eakmanrq commented Oct 2, 2025

Going to re-implement with doing paging at the database level and let the user control the batch sizes.

@eakmanrq eakmanrq closed this Oct 2, 2025
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