mirror of
https://github.com/zulip/zulip.git
synced 2025-10-23 04:52:12 +00:00
pg_backup_and_purge: Properly preserve needed base backups.
Without `FIND_FULL`, `wal_g delete before ...` will fail, rather than delete a base backup which is needed by the delta backups after it. By passing `FIND_FULL`[^1], we tell it explicitly that we're OK preserving files before the specified one, as long as they are necessary for the delta chain. [^1]: https://github.com/wal-g/wal-g/blob/master/docs/README.md#delete
This commit is contained in:
committed by
Tim Abbott
parent
936c2b54cb
commit
30f71639f0
@@ -73,7 +73,14 @@ for line in lines[1:]:
|
||||
one_month_ago = now - timedelta(days=30)
|
||||
for date in sorted(backups.keys(), reverse=True):
|
||||
if date < one_month_ago:
|
||||
subprocess.check_call(["env-wal-g", "delete", "--confirm", "before", backups[date]])
|
||||
# We pass `FIND_FULL` such that if delta backups are being
|
||||
# used, we keep the prior FULL backup and all of the deltas
|
||||
# that we need. In practice, this means that if we're doing
|
||||
# weekly full backups (`backups_incremental = 6`), we only
|
||||
# delete any data once a week.
|
||||
subprocess.check_call(
|
||||
["env-wal-g", "delete", "--confirm", "before", "FIND_FULL", backups[date]]
|
||||
)
|
||||
# Because we're going from most recent to least recent, we
|
||||
# only have to do one delete operation
|
||||
break
|
||||
|
Reference in New Issue
Block a user