1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2025-07-16 07:14:15 +02:00

Change retention purge command finish message

This commit is contained in:
Artur Zakirov
2017-03-27 15:24:42 +03:00
parent 8f37eb5afa
commit cc1d1edbac
4 changed files with 15 additions and 9 deletions

View File

@ -36,7 +36,7 @@ do_delete(time_t backup_id)
/* Get complete list of backups */ /* Get complete list of backups */
backup_list = catalog_get_backup_list(0); backup_list = catalog_get_backup_list(0);
if (!backup_list) if (!backup_list)
elog(ERROR, "No backup list found, can't process any more."); elog(ERROR, "no backup list found, can't process any more");
/* Find backup to be deleted */ /* Find backup to be deleted */
for (i = 0; i < parray_num(backup_list); i++) for (i = 0; i < parray_num(backup_list); i++)
@ -144,6 +144,7 @@ do_retention_purge(void)
XLogRecPtr oldest_lsn = InvalidXLogRecPtr; XLogRecPtr oldest_lsn = InvalidXLogRecPtr;
TimeLineID oldest_tli; TimeLineID oldest_tli;
bool keep_next_backup = true; /* Do not delete first full backup */ bool keep_next_backup = true; /* Do not delete first full backup */
bool backup_deleted = false; /* At least one backup was deleted */
if (retention_redundancy > 0) if (retention_redundancy > 0)
elog(LOG, "REDUNDANCY=%u", retention_redundancy); elog(LOG, "REDUNDANCY=%u", retention_redundancy);
@ -160,8 +161,7 @@ do_retention_purge(void)
backup_list = catalog_get_backup_list(0); backup_list = catalog_get_backup_list(0);
if (parray_num(backup_list) == 0) if (parray_num(backup_list) == 0)
{ {
elog(INFO, "backup list is empty"); elog(INFO, "backup list is empty, purging won't be executed");
elog(INFO, "exit");
return 0; return 0;
} }
@ -207,6 +207,7 @@ do_retention_purge(void)
/* Delete backup and update status to DELETED */ /* Delete backup and update status to DELETED */
pgBackupDeleteFiles(backup); pgBackupDeleteFiles(backup);
backup_deleted = true;
} }
/* Purge WAL files */ /* Purge WAL files */
@ -216,7 +217,10 @@ do_retention_purge(void)
parray_walk(backup_list, pgBackupFree); parray_walk(backup_list, pgBackupFree);
parray_free(backup_list); parray_free(backup_list);
elog(INFO, "purging is finished"); if (backup_deleted)
elog(INFO, "purging finished");
else
elog(INFO, "no one backup was deleted by retention policy");
return 0; return 0;
} }

View File

@ -16,7 +16,7 @@
#include <time.h> #include <time.h>
#include <sys/stat.h> #include <sys/stat.h>
const char *PROGRAM_VERSION = "1.1.3"; const char *PROGRAM_VERSION = "1.1.4";
const char *PROGRAM_URL = "https://github.com/postgrespro/pg_probackup"; const char *PROGRAM_URL = "https://github.com/postgrespro/pg_probackup";
const char *PROGRAM_EMAIL = "https://github.com/postgrespro/pg_probackup/issues"; const char *PROGRAM_EMAIL = "https://github.com/postgrespro/pg_probackup/issues";

View File

@ -212,6 +212,8 @@ base_backup_found:
} }
/* create recovery.conf */ /* create recovery.conf */
dest_backup = (pgBackup *) parray_get(backups, last_diff_index);
if (!dest_backup->stream || (target_time != NULL || target_xid != NULL))
create_recovery_conf(backup_id, target_time, target_xid, create_recovery_conf(backup_id, target_time, target_xid,
target_inclusive, base_backup->tli); target_inclusive, base_backup->tli);

View File

@ -1 +1 @@
pg_probackup 1.1.3 pg_probackup 1.1.4