Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

pg_backup_and_purge: Properly preserve needed base backups.

Alex Vandiver30f71639f066
diff --git a/puppet/zulip/files/postgresql/pg_backup_and_purge b/puppet/zulip/files/postgresql/pg_backup_and_purge
index 6d1b87c5025..f4a036edd95 100755
--- a/puppet/zulip/files/postgresql/pg_backup_and_purge
+++ b/puppet/zulip/files/postgresql/pg_backup_and_purge
@@ -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