Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Meaningless incremental backup issue #125

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions backup.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ do_backup_database(parray *backup_list, pgBackupOption bkupopt)
pgBackup *prev_backup;

/* find last completed database backup */
prev_backup = catalog_get_last_data_backup(backup_list);
prev_backup = catalog_get_last_full_backup(backup_list);
if (prev_backup == NULL)
{
if (current.full_backup_on_error)
Expand Down Expand Up @@ -193,7 +193,7 @@ do_backup_database(parray *backup_list, pgBackupOption bkupopt)
uint32 xlogid, xrecoff;

/* find last completed database backup */
prev_backup = catalog_get_last_data_backup(backup_list);
prev_backup = catalog_get_last_full_backup(backup_list);
if (prev_backup == NULL || prev_backup->tli != current.tli)
{
if (current.full_backup_on_error)
Expand Down
9 changes: 5 additions & 4 deletions catalog.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,10 +263,10 @@ catalog_get_backup_list(const pgBackupRange *range)
}

/*
* Find the last completed database backup from the backup list.
* Find the last completed database full valid backup from the backup list.
*/
pgBackup *
catalog_get_last_data_backup(parray *backup_list)
catalog_get_last_full_backup(parray *backup_list)
{
int i;
pgBackup *backup = NULL;
Expand All @@ -276,8 +276,9 @@ catalog_get_last_data_backup(parray *backup_list)
{
backup = (pgBackup *) parray_get(backup_list, i);

/* we need completed database backup */
if (backup->status == BACKUP_STATUS_OK && HAVE_DATABASE(backup))
/* Return the first full valid backup. */
if (backup->backup_mode == BACKUP_MODE_FULL &&
backup->status == BACKUP_STATUS_OK)
return backup;
}

Expand Down
6 changes: 6 additions & 0 deletions delete.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ do_delete(pgBackupRange *range, bool force)
char backup_timestamp[20];
char given_timestamp[20];

if (force)
ereport(WARNING,
(errmsg("using force option will make some of the remaining backups unusable"),
errdetail("Any remaining incremental backups that are older than the oldest"
" available full backup cannot be restored.")));

amitlan marked this conversation as resolved.
Show resolved Hide resolved
/* DATE are always required */
if (!pgBackupRangeIsValid(range))
ereport(ERROR,
Expand Down
2 changes: 1 addition & 1 deletion pg_rman.h
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ extern void pgBackupValidate(pgBackup *backup, bool size_only, bool for_get_time
/* in catalog.c */
extern pgBackup *catalog_get_backup(time_t timestamp);
extern parray *catalog_get_backup_list(const pgBackupRange *range);
extern pgBackup *catalog_get_last_data_backup(parray *backup_list);
extern pgBackup *catalog_get_last_full_backup(parray *backup_list);
extern pgBackup *catalog_get_last_arclog_backup(parray *backup_list);
extern pgBackup *catalog_get_last_srvlog_backup(parray *backup_list);

Expand Down