pgbackrest.git / summary / log / commit / refs
commit e8c7d7aca69dae3ff14cf0065815bced3f2002f1
Author: David Steele <github@thelabyrinth.net>
Date: Sat Feb 22 14:05:58 2014 +0000
When archive_retention_type is full, use the oldest backup if there are fewer than required
pg_backrest_backup.pm | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/pg_backrest_backup.pm b/pg_backrest_backup.pm
index 4b6cb3696..0ecb3add3 100644
--- a/pg_backrest_backup.pm
+++ b/pg_backrest_backup.pm
@@ -1485,7 +1485,16 @@ sub backup_expire
if (!defined($strArchiveRetentionBackup))
{
- return;
+ if ($strArchiveRetentionType eq "full" && scalar @stryPath > 0)
+ {
+ &log(INFO, "fewer than required backups for retention, but since archive_retention_type = full using oldest full backup");
+ $strArchiveRetentionBackup = $stryPath[scalar @stryPath - 1];
+ }
+
+ if (!defined($strArchiveRetentionBackup))
+ {
+ return;
+ }
}
# Get the archive logs that need to be kept. To be cautious we will keep all the archive logs starting from this backup
@@ -1497,7 +1506,7 @@ sub backup_expire
if (!defined($strArchiveLast))
{
- confess &log(INFO, "invalid archive location retrieved ${strArchiveRetentionBackup}");
+ confess &log(ERROR, "invalid archive location retrieved ${strArchiveRetentionBackup}");
}
&log(INFO, "archive retention starts at " . $strArchiveLast);
[parent: 9270a6789206]