-
Notifications
You must be signed in to change notification settings - Fork 423
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
backup retention logic in /scripts/postgres_backup.sh is broken if basebackup frequency is low #425
Comments
I fell into just this trap. Migrating from logical backups to wal archiving and basebackups, we reduced the number of base backups to 3 per week due to the increased basebackup size and the low-ish change volume of our instance. Now, our monitors are going off as backup storage is skyrocketing, since no backups are deleted. As for the suggested change: I don't get why we have to go by days at all. Just let it do what it says on the tin - "NUM_BACKUPS_TO_RETAIN", and do a |
Oh, never mind. I didn't realize that this existed only in wal-g (which we are using), but not in wal-e. |
Removes saveguard to leave at least as many backups as BACKUP_NUM_TO_RETAIN fixes zalando#425
Removes safeguard to leave at least as many backups as BACKUP_NUM_TO_RETAIN fixes zalando#425
If base backup is infrequently executed (less than daily) the logic in postgres_backup will fail to ever execute any cleanup. The LAST variable counts only backups that are inside the retention interval, which for less than daily backups means less than $DAYS_TO_RETAIN; even when there are enough backups in total available, the delete operation never gets called. Here's a better logic IMO:
The text was updated successfully, but these errors were encountered: