Skip to content

Commit fd91652

Browse files
committed
[Issue #92] Improvements pointed out by review
1 parent 4db8821 commit fd91652

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

src/backup.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,9 @@ do_backup_instance(PGconn *backup_conn)
200200

201201
prev_backup = catalog_get_last_data_backup(backup_list, current.tli, current.start_time);
202202
if (prev_backup == NULL)
203-
elog(ERROR, "Valid backup on current timeline is not found. "
204-
"Create new FULL backup before an incremental one.");
203+
elog(ERROR, "Valid backup on current timeline %X is not found. "
204+
"Create new FULL backup before an incremental one.",
205+
current.tli);
205206

206207
pgBackupGetPath(prev_backup, prev_backup_filelist_path,
207208
lengthof(prev_backup_filelist_path), DATABASE_FILE_LIST);

src/catalog.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -467,10 +467,7 @@ catalog_get_last_data_backup(parray *backup_list, TimeLineID tli, time_t current
467467

468468
/* Failed to find valid FULL backup to fulfill ancestor role */
469469
if (!full_backup)
470-
{
471-
elog(WARNING, "Failed to find a valid backup chain");
472470
return NULL;
473-
}
474471

475472
elog(INFO, "Latest valid FULL backup: %s",
476473
base36enc(full_backup->start_time));
@@ -480,7 +477,7 @@ catalog_get_last_data_backup(parray *backup_list, TimeLineID tli, time_t current
480477
{
481478
pgBackup *backup = (pgBackup *) parray_get(backup_list, i);
482479

483-
/* only valid descendants are acceptable */
480+
/* only valid descendants are acceptable for evaluation */
484481
if ((backup->status == BACKUP_STATUS_OK ||
485482
backup->status == BACKUP_STATUS_DONE))
486483
{
@@ -505,9 +502,9 @@ catalog_get_last_data_backup(parray *backup_list, TimeLineID tli, time_t current
505502
continue;
506503

507504
/* chain is ok */
508-
case 2 :
509-
/* Yes, we could call is_parent() earlier, after choosing the ancestor,
510-
* but this way we have an opportunity to report about all possible
505+
case 2:
506+
/* Yes, we could call is_parent() earlier - after choosing the ancestor,
507+
* but this way we have an opportunity to detect and report all possible
511508
* anomalies.
512509
*/
513510
if (is_parent(full_backup->start_time, backup, true))

src/delete.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,14 +225,15 @@ do_retention_internal(parray *backup_list, parray *to_keep_list, parray *to_purg
225225
{
226226
pgBackup *backup = (pgBackup *) parray_get(backup_list, i);
227227

228-
/* Consider only valid backups for Redundancy */
228+
/* Consider only valid FULL backups for Redundancy */
229229
if (instance_config.retention_redundancy > 0 &&
230230
backup->backup_mode == BACKUP_MODE_FULL &&
231231
(backup->status == BACKUP_STATUS_OK ||
232232
backup->status == BACKUP_STATUS_DONE))
233233
{
234234
n_full_backups++;
235235

236+
/* Add every FULL backup that satisfy Redundancy policy to separate list */
236237
if (n_full_backups <= instance_config.retention_redundancy)
237238
{
238239
if (!redundancy_full_backup_list)
@@ -260,7 +261,7 @@ do_retention_internal(parray *backup_list, parray *to_keep_list, parray *to_purg
260261
bool redundancy_keep = false;
261262
pgBackup *backup = (pgBackup *) parray_get(backup_list, (size_t) i);
262263

263-
/* check if backups FULL parent is in redundancy list */
264+
/* check if backup`s FULL ancestor is in redundancy list */
264265
if (redundancy_full_backup_list)
265266
{
266267
pgBackup *full_backup = find_parent_full_backup(backup);
@@ -283,7 +284,6 @@ do_retention_internal(parray *backup_list, parray *to_keep_list, parray *to_purg
283284
* TODO: consider that ERROR backup most likely to have recovery_time == 0
284285
*/
285286
if ((days_threshold == 0 || (days_threshold > backup->recovery_time)) &&
286-
// (instance_config.retention_redundancy <= (n_full_backups - cur_full_backup_num)))
287287
(instance_config.retention_redundancy == 0 || !redundancy_keep))
288288
{
289289
/* This backup is not guarded by retention

0 commit comments

Comments
 (0)