1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2024-12-11 11:41:33 +02:00

[Issue #328] Do not delete invalid full backups within retention redundancy range

This commit is contained in:
Grigory Smolkin 2021-02-17 12:52:35 +03:00
parent 04bab3e927
commit 316f0d267b

View File

@ -227,13 +227,14 @@ do_retention_internal(parray *backup_list, parray *to_keep_list, parray *to_purg
{ {
pgBackup *backup = (pgBackup *) parray_get(backup_list, i); pgBackup *backup = (pgBackup *) parray_get(backup_list, i);
/* Consider only valid FULL backups for Redundancy */ if (backup->backup_mode == BACKUP_MODE_FULL)
if (instance_config.retention_redundancy > 0 &&
backup->backup_mode == BACKUP_MODE_FULL &&
(backup->status == BACKUP_STATUS_OK ||
backup->status == BACKUP_STATUS_DONE))
{ {
n_full_backups++; /* Consider only valid FULL backups for Redundancy fulfillment */
if (backup->status == BACKUP_STATUS_OK ||
backup->status == BACKUP_STATUS_DONE)
{
n_full_backups++;
}
/* Add every FULL backup that satisfy Redundancy policy to separate list */ /* Add every FULL backup that satisfy Redundancy policy to separate list */
if (n_full_backups <= instance_config.retention_redundancy) if (n_full_backups <= instance_config.retention_redundancy)
@ -413,7 +414,10 @@ do_retention_internal(parray *backup_list, parray *to_keep_list, parray *to_purg
pinning_window ? pinning_window : instance_config.retention_window, pinning_window ? pinning_window : instance_config.retention_window,
action); action);
if (backup->backup_mode == BACKUP_MODE_FULL) /* Only valid full backups are count to something */
if (backup->backup_mode == BACKUP_MODE_FULL &&
(backup->status == BACKUP_STATUS_OK ||
backup->status == BACKUP_STATUS_DONE))
cur_full_backup_num++; cur_full_backup_num++;
} }
} }