Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit342496e

Browse files
author
Michael Paquier
committed
Fix incremental and archive backup removal on delete command
The previous algorithm was smart enough to remove full backups olderthan the given number of generations, but not enough to removeincremental and archive backups. This resulted in keeping in the backuplist a set of incremental and archive backups older than the latestfull backup allowed. As it is useless to keep them, the deletionalgorithm is made smarter to take that into account and remove all ofthem cleanly only when necessary.
1 parentc812fa3 commit342496e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

‎delete.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ pgBackupDelete(int keep_generations, int keep_days)
8080
intbackup_num;
8181
time_tdays_threshold=current.start_time- (keep_days*60*60*24);
8282

83-
8483
if (verbose)
8584
{
8685
chargenerations_str[100];
@@ -116,20 +115,21 @@ pgBackupDelete(int keep_generations, int keep_days)
116115
backup_num=0;
117116
for (i=0;i<parray_num(backup_list);i++)
118117
{
119-
pgBackup*backup= (pgBackup*)parray_get(backup_list,i);
118+
pgBackup*backup= (pgBackup*)parray_get(backup_list,i);
119+
intbackup_num_evaluate=backup_num;
120120

121121
elog(LOG,"%s() %lu",__FUNCTION__,backup->start_time);
122122

123123
/*
124124
* When a validate full backup was found, we can delete the
125-
* backup that is older than it.
125+
* backup that is older than it using the number of generations.
126126
*/
127-
if (backup->backup_mode>=BACKUP_MODE_FULL&&
127+
if (backup->backup_mode==BACKUP_MODE_FULL&&
128128
backup->status==BACKUP_STATUS_OK)
129129
backup_num++;
130130

131131
/* Evaluate if this backup is eligible for removal */
132-
if (backup_num <=keep_generations&&
132+
if (backup_num_evaluate+1 <=keep_generations&&
133133
keep_generations!=KEEP_INFINITE)
134134
{
135135
/* Do not include the latest full backup in this count */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp