Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9da90b6

Browse files
committed
PGPRO-2573: rename 'Purge' and 'Keep' to 'Expired' and 'Active' for retention message, minor changes for comments
1 parent 33ad944 commit 9da90b6

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed

src/delete.c

+19-15
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,16 @@ do_delete(time_t backup_id)
110110
parray_free(backup_list);
111111
}
112112

113+
/*
114+
* Merge and purge backups by retention policy. Retention policy is configured by
115+
* retention_redundancy and retention_window variables.
116+
*
117+
* Invalid backups handled in Oracle style, so invalid backups are ignored
118+
* for the purpose of retention fulfillment,
119+
* i.e. CORRUPT full backup do not taken in account when deteremine
120+
* which FULL backup should be keeped for redundancy obligation(only valid do),
121+
* but if invalid backup is not guarded by retention - it is removed
122+
*/
113123
int do_retention(void)
114124
{
115125
parray *backup_list = NULL;
@@ -122,7 +132,6 @@ int do_retention(void)
122132
/* Get a complete list of backups. */
123133
backup_list = catalog_get_backup_list(INVALID_BACKUP_ID);
124134

125-
/* sanity */
126135
if (parray_num(backup_list) == 0)
127136
backup_list_is_empty = true;
128137

@@ -136,14 +145,13 @@ int do_retention(void)
136145
if (instance_config.retention_redundancy == 0 &&
137146
instance_config.retention_window == 0)
138147
{
139-
/* Retention is disabled but we still can cleanup wal
140-
*/
148+
/* Retention is disabled but we still can cleanup wal */
141149
elog(WARNING, "Retention policy is not set");
142150
if (!delete_wal)
143151
return 0;
144152
}
145153
else
146-
/* At least one retention policy is active */
154+
/* At least one retention policy is active */
147155
retention_is_set = true;
148156
}
149157

@@ -182,15 +190,9 @@ int do_retention(void)
182190

183191
}
184192

185-
/*
186-
* Merge and purge backups by retention policy. Retention policy is configured by
187-
* retention_redundancy and retention_window variables.
188-
*
189-
* Invalid backups handled in Oracle style, so invalid backups are ignored
190-
* for the purpose of retention fulfillment,
191-
* i.e. CORRUPT full backup do not taken in account when deteremine
192-
* which FULL backup should be keeped for redundancy obligation(only valid do),
193-
* but if invalid backup is not guarded by retention - it is removed
193+
/* Evaluate every backup by retention policies and populate purge and keep lists.
194+
* Also for every backup print proposed action('Active' or 'Expired') according
195+
* to active retention policies.
194196
*/
195197
static void
196198
do_retention_internal(parray *backup_list, parray *to_keep_list, parray *to_purge_list)
@@ -326,12 +328,12 @@ do_retention_internal(parray *backup_list, parray *to_keep_list, parray *to_purg
326328
cur_full_backup_num = 1;
327329
for (i = 0; i < parray_num(backup_list); i++)
328330
{
329-
char *action = "Keep";
331+
char *action = "Active";
330332

331333
pgBackup *backup = (pgBackup *) parray_get(backup_list, i);
332334

333335
if (parray_bsearch(to_purge_list, backup, pgBackupCompareIdDesc))
334-
action = "Purge";
336+
action = "Expired";
335337

336338
if (backup->recovery_time == 0)
337339
actual_window = 0;
@@ -352,6 +354,7 @@ do_retention_internal(parray *backup_list, parray *to_keep_list, parray *to_purg
352354
}
353355
}
354356

357+
/* Merge partially expired incremental chains */
355358
static void
356359
do_retention_merge(parray *backup_list, parray *to_keep_list, parray *to_purge_list)
357360
{
@@ -494,6 +497,7 @@ do_retention_merge(parray *backup_list, parray *to_keep_list, parray *to_purge_l
494497

495498
}
496499

500+
/* Purge expired backups */
497501
static void
498502
do_retention_purge(parray *to_keep_list, parray *to_purge_list)
499503
{

0 commit comments

Comments
 (0)