mirror of
https://github.com/postgrespro/pg_probackup.git
synced 2024-11-25 09:01:48 +02:00
[Issue #169] merge: handle the case of crash right after deletion of the target incremental backup. It should be possible to rerun merge by using the backup ID of deleted backup as an argument
This commit is contained in:
parent
7b342e3946
commit
15228f3553
26
src/merge.c
26
src/merge.c
@ -106,6 +106,27 @@ do_merge(time_t backup_id)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Handle the case of crash right after deletion of the target
|
||||
* incremental backup. We still can recover from this.
|
||||
* Iterate over backups and look for the FULL backup with
|
||||
* MERGED status, that has merge-target-id eqial to backup_id.
|
||||
*/
|
||||
if (dest_backup == NULL)
|
||||
{
|
||||
for (i = 0; i < parray_num(backups); i++)
|
||||
{
|
||||
pgBackup *backup = (pgBackup *) parray_get(backups, i);
|
||||
|
||||
if (backup->status == BACKUP_STATUS_MERGED &&
|
||||
backup->merge_dest_backup == backup_id)
|
||||
{
|
||||
dest_backup = backup;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (dest_backup == NULL)
|
||||
elog(ERROR, "Target backup %s was not found", base36enc(backup_id));
|
||||
|
||||
@ -776,6 +797,11 @@ merge_rename:
|
||||
full_backup->root_dir, destination_path, strerror(errno));
|
||||
}
|
||||
|
||||
/* If we crash here, it will produce full backup in MERGED
|
||||
* status, located in directory with wrong backup id.
|
||||
* It should not be a problem.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Merging finished, now we can safely update ID of the FULL backup
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user