Fix job deletion notification and add vacuum#717
Merged
gabriel-samfira merged 2 commits intocloudbase:mainfrom Apr 13, 2026
Merged
Fix job deletion notification and add vacuum#717gabriel-samfira merged 2 commits intocloudbase:mainfrom
gabriel-samfira merged 2 commits intocloudbase:mainfrom
Conversation
When DeleteInactionableJobs runs, we need to first fetch jobs that match then remove them. This is done to get the IDs of the jobs we are removing so that we can send a notification of the action. Otherwise, database watchers are never notified. This change also adds a vacuum routine to free up space taken by the sqlite database. Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
We don't want to recreate the entire DB on every vacuum, as that would potentially be expensive (depending on DB size) and would block writes while vacuum runs. Switching to incremental_vacuum allows us to only free up pages that have been marked as free. This adds some overhead as sqlite needs to keep track of freed pages, but it's better than potentially using up a lot of disk space while vacuum runs and blocking writes for a long time. Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When DeleteInactionableJobs runs, we need to first fetch jobs that match then remove them. This is done to get the IDs of the jobs we are removing so that we can send a notification of the action. Otherwise, database watchers are never notified.
This change also adds a vacuum routine to free up space taken by the sqlite database.