1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-07-05 00:28:52 +02:00

Add time-based retention for full backups.

The --repo-retention-full-type option allows retention of full backups based on a time period, specified in days.

The new option will default to 'count' and therefore will not affect current installations. Setting repo-retention-full-type to 'time' will allow the user to use a time period, in days, to indicate full backup retention. Using this method, a full backup can be expired only if the time the backup completed is older than the number of days set with repo-retention-full (calculated from the moment the 'expire' command is run) and at least one full backup meets the retention period. If archive retention has not been configured, then the default settings will expire archives that are prior to the oldest retained full backup. For example, if there are three full backups ending in times that are 25 days old (F1), 20 days old (F2) and 10 days old (F3), then if the full retention period is 15 days, then only F1 will be expired; F2 will be retained because F1 is not at least 15 days old.
This commit is contained in:
Cynthia Shang
2020-05-08 15:25:03 -04:00
committed by GitHub
parent e873ad6da0
commit cdebfb09e0
21 changed files with 572 additions and 103 deletions

View File

@ -370,10 +370,13 @@ testRun(void)
"NOTE: WAL segments required to make a backup consistent are always retained\n"
"until the backup is expired regardless of how this option is configured.\n"
"\n"
"If this value is not set, then the archive to expire will default to the\n"
"repo-retention-full (or repo-retention-diff) value corresponding to the\n"
"repo-retention-archive-type if set to full (or diff). This will ensure that WAL\n"
"is only expired for backups that are already expired.\n"
"If this value is not set and repo-retention-full-type is count (default), then\n"
"the archive to expire will default to the repo-retention-full (or\n"
"repo-retention-diff) value corresponding to the repo-retention-archive-type if\n"
"set to full (or diff). This will ensure that WAL is only expired for backups\n"
"that are already expired. If repo-retention-full-type is time, then this value\n"
"will default to removing archives that are earlier than the oldest full backup\n"
"retained after satisfying the repo-retention-full setting.\n"
"\n"
"This option must be set if repo-retention-archive-type is set to incr. If disk\n"
"space is at a premium, then this setting, in conjunction with\n"