Skip to content

Commit cc1d1ed

Browse files
author
Artur Zakirov
committed
Change retention purge command finish message
1 parent 8f37eb5 commit cc1d1ed

File tree

4 files changed

+15
-9
lines changed

4 files changed

+15
-9
lines changed

delete.c

+9-5
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ do_delete(time_t backup_id)
3636
/* Get complete list of backups */
3737
backup_list = catalog_get_backup_list(0);
3838
if (!backup_list)
39-
elog(ERROR, "No backup list found, can't process any more.");
39+
elog(ERROR, "no backup list found, can't process any more");
4040

4141
/* Find backup to be deleted */
4242
for (i = 0; i < parray_num(backup_list); i++)
@@ -143,7 +143,8 @@ do_retention_purge(void)
143143
time_t days_threshold = time(NULL) - (retention_window * 60 * 60 * 24);
144144
XLogRecPtr oldest_lsn = InvalidXLogRecPtr;
145145
TimeLineID oldest_tli;
146-
bool keep_next_backup = true; /* Do not delete first full backup */
146+
bool keep_next_backup = true; /* Do not delete first full backup */
147+
bool backup_deleted = false; /* At least one backup was deleted */
147148

148149
if (retention_redundancy > 0)
149150
elog(LOG, "REDUNDANCY=%u", retention_redundancy);
@@ -160,8 +161,7 @@ do_retention_purge(void)
160161
backup_list = catalog_get_backup_list(0);
161162
if (parray_num(backup_list) == 0)
162163
{
163-
elog(INFO, "backup list is empty");
164-
elog(INFO, "exit");
164+
elog(INFO, "backup list is empty, purging won't be executed");
165165
return 0;
166166
}
167167

@@ -207,6 +207,7 @@ do_retention_purge(void)
207207

208208
/* Delete backup and update status to DELETED */
209209
pgBackupDeleteFiles(backup);
210+
backup_deleted = true;
210211
}
211212

212213
/* Purge WAL files */
@@ -216,7 +217,10 @@ do_retention_purge(void)
216217
parray_walk(backup_list, pgBackupFree);
217218
parray_free(backup_list);
218219

219-
elog(INFO, "purging is finished");
220+
if (backup_deleted)
221+
elog(INFO, "purging finished");
222+
else
223+
elog(INFO, "no one backup was deleted by retention policy");
220224

221225
return 0;
222226
}

pg_probackup.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include <time.h>
1717
#include <sys/stat.h>
1818

19-
const char *PROGRAM_VERSION = "1.1.3";
19+
const char *PROGRAM_VERSION = "1.1.4";
2020
const char *PROGRAM_URL = "https://github.com/postgrespro/pg_probackup";
2121
const char *PROGRAM_EMAIL = "https://github.com/postgrespro/pg_probackup/issues";
2222

restore.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,10 @@ do_restore(time_t backup_id,
212212
}
213213

214214
/* create recovery.conf */
215-
create_recovery_conf(backup_id, target_time, target_xid,
216-
target_inclusive, base_backup->tli);
215+
dest_backup = (pgBackup *) parray_get(backups, last_diff_index);
216+
if (!dest_backup->stream || (target_time != NULL || target_xid != NULL))
217+
create_recovery_conf(backup_id, target_time, target_xid,
218+
target_inclusive, base_backup->tli);
217219

218220
/* cleanup */
219221
parray_walk(backups, pgBackupFree);

tests/expected/option_version.out

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
pg_probackup 1.1.3
1+
pg_probackup 1.1.4

0 commit comments

Comments
 (0)