Description
Hello!
I think pg_probackup need something like backup aging mechanism.
How it should work:
- Let say at the 1 day of month we make full backup of database and set its max age 12 months(or 365 day whenever). Lets it id is 1
- After that we also make full backup say at every sunday and set its max age at 30 days their id is say 10 20 30 40
- During week we make incremental backup.
- Every day we have retention policy work and delete our expired backup with their age > max_age we set in p 1 and 2
After 30 days have passed we have in our backup repo something like that:
Full backup (id 1 29 or more days ago) ==> Full backup (id 10 28 days ago) ==> Full backup (id 20 21 days ago) ==>Full backup (id 30 14 days ago) ==>Full backup (id 40 7 days ago) ==>Incremental backup ==> Incremental backup...==> now
After 30 days have passed and retention mechanism clear aged backup we have in our repo:
Full backup (id 1) ==> Full backup (id 20 ) ==> Full backup (id 30) ==>Full backup (id 40) ==> Full backup (id 50 ) ==> Incremental backup ==> Incremental backup...==> now
As you can see there is no full backup with id = 10 because its age is greater than its max_age set on p 2. and retention policy removed it from backup chain
and so on...
With this feature in mind pg_probackup can make some simple(or maybe complex) backup archive policy without using any external tools.