mirror of
https://github.com/postgrespro/pg_probackup.git
synced 2024-12-04 10:44:46 +02:00
add parent_backup_link to pgBackup structure. No usage for now
This commit is contained in:
parent
6d709fb51c
commit
e71312cc03
@ -256,6 +256,8 @@ catalog_get_backup_list(time_t requested_backup_id)
|
||||
parray *backups = NULL;
|
||||
pgBackup *backup = NULL;
|
||||
|
||||
int i;
|
||||
|
||||
/* open backup instance backups directory */
|
||||
date_dir = opendir(backup_instance_path);
|
||||
if (date_dir == NULL)
|
||||
@ -283,6 +285,7 @@ catalog_get_backup_list(time_t requested_backup_id)
|
||||
/* read backup information from BACKUP_CONTROL_FILE */
|
||||
snprintf(backup_conf_path, MAXPGPATH, "%s/%s", date_path, BACKUP_CONTROL_FILE);
|
||||
backup = readBackupControlFile(backup_conf_path);
|
||||
backup->backup_id = backup->start_time;
|
||||
|
||||
/* ignore corrupted backups */
|
||||
if (backup)
|
||||
@ -316,6 +319,30 @@ catalog_get_backup_list(time_t requested_backup_id)
|
||||
|
||||
parray_qsort(backups, pgBackupCompareIdDesc);
|
||||
|
||||
/* Link incremental backups with their ancestors.*/
|
||||
for (i = 0; i < parray_num(backups); i++)
|
||||
{
|
||||
pgBackup *curr = parray_get(backups, i);
|
||||
|
||||
int j;
|
||||
|
||||
if (curr->backup_mode == BACKUP_MODE_FULL)
|
||||
continue;
|
||||
|
||||
for (j = i+1; j < parray_num(backups); j++)
|
||||
{
|
||||
pgBackup *ancestor = parray_get(backups, j);
|
||||
|
||||
if (ancestor->start_time == curr->parent_backup)
|
||||
{
|
||||
curr->parent_backup_link = ancestor;
|
||||
/* elog(INFO, "curr %s, ancestor %s j=%d", base36enc_dup(curr->start_time),
|
||||
base36enc_dup(ancestor->start_time), j); */
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return backups;
|
||||
|
||||
err_proc:
|
||||
|
@ -184,6 +184,8 @@ typedef struct pgBackupConfig
|
||||
int compress_level;
|
||||
} pgBackupConfig;
|
||||
|
||||
typedef struct pgBackup pgBackup;
|
||||
|
||||
/* Information about single backup stored in backup.conf */
|
||||
typedef struct pgBackup
|
||||
{
|
||||
@ -226,6 +228,7 @@ typedef struct pgBackup
|
||||
time_t parent_backup; /* Identifier of the previous backup.
|
||||
* Which is basic backup for this
|
||||
* incremental backup. */
|
||||
pgBackup *parent_backup_link;
|
||||
char *primary_conninfo; /* Connection parameters of the backup
|
||||
* in the format suitable for recovery.conf */
|
||||
} pgBackup;
|
||||
|
@ -203,6 +203,7 @@ do_restore_or_validate(time_t target_backup_id,
|
||||
}
|
||||
|
||||
/* If we already found dest_backup, look for full backup. */
|
||||
/* TODO Now, as we have all backups linked, we can probably get rid of that?"*/
|
||||
if (dest_backup)
|
||||
{
|
||||
if (current_backup->backup_mode == BACKUP_MODE_FULL)
|
||||
|
@ -315,6 +315,7 @@ pgBackup_init(pgBackup *backup)
|
||||
backup->wal_block_size = XLOG_BLCKSZ;
|
||||
backup->stream = false;
|
||||
backup->parent_backup = 0;
|
||||
backup->parent_backup_link = NULL;
|
||||
backup->primary_conninfo = NULL;
|
||||
backup->server_version[0] = '\0';
|
||||
}
|
||||
|
@ -283,6 +283,7 @@ do_validate_instance(void)
|
||||
elog(ERROR, "Failed to get backup list.");
|
||||
|
||||
/* Valiate each backup along with its xlog files. */
|
||||
/* TODO Maybe use parent_backup_link instead of looking for backups in the list */
|
||||
for (i = 0; i < parray_num(backups); i++)
|
||||
{
|
||||
pgBackup *base_full_backup = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user