mirror of
https://github.com/postgrespro/pg_probackup.git
synced 2025-02-08 14:28:36 +02:00
Simplify code for recovery target identification
Some unnecessary comments are removed and cleaned as well at the same time.
This commit is contained in:
parent
f77d141b7c
commit
96cfb3eb13
7
backup.c
7
backup.c
@ -175,11 +175,8 @@ do_backup_database(parray *backup_list, pgBackupOption bkupopt)
|
||||
prev_backup = catalog_get_last_data_backup(backup_list);
|
||||
if (prev_backup == NULL || prev_backup->tli != current.tli)
|
||||
{
|
||||
elog(ERROR_SYSTEM, _("There is indeed a full backup but it is not validated."
|
||||
"So I can't take any incremental backup."
|
||||
"Please validate it and retry."));
|
||||
/// elog(INFO, _("no previous full backup, performing a full backup instead"));
|
||||
/// current.backup_mode = BACKUP_MODE_FULL;
|
||||
elog(ERROR_SYSTEM, _("Full backup detected but it is not "
|
||||
"validated so incremental backup cannot be taken"));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
28
restore.c
28
restore.c
@ -205,8 +205,8 @@ base_backup_found:
|
||||
continue;
|
||||
|
||||
/* is the backup is necessary for restore to target timeline ? */
|
||||
//if (!satisfy_timeline(timelines, backup) && !satisfy_recovery_target(backup, rt))
|
||||
if (!satisfy_timeline(timelines, backup) || !satisfy_recovery_target(backup, rt))
|
||||
if (!satisfy_timeline(timelines, backup) ||
|
||||
!satisfy_recovery_target(backup, rt))
|
||||
continue;
|
||||
|
||||
if (verbose)
|
||||
@ -850,23 +850,13 @@ readTimeLineHistory(TimeLineID targetTLI)
|
||||
static bool
|
||||
satisfy_recovery_target(const pgBackup *backup, const pgRecoveryTarget *rt)
|
||||
{
|
||||
if(rt->xid_specified){
|
||||
// elog(INFO, "in satisfy_recovery_target:xid::%u:%u", backup->recovery_xid, rt->recovery_target_xid);
|
||||
if(backup->recovery_xid <= rt->recovery_target_xid)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
if(rt->time_specified){
|
||||
// elog(INFO, "in satisfy_recovery_target:time_t::%ld:%ld", backup->recovery_time, rt->recovery_target_time);
|
||||
if(backup->recovery_time <= rt->recovery_target_time)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
else{
|
||||
if(rt->xid_specified)
|
||||
return backup->recovery_xid <= rt->recovery_target_xid);
|
||||
|
||||
if (rt->time_specified)
|
||||
return backup->recovery_time <= rt->recovery_target_time);
|
||||
else
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
static bool
|
||||
@ -1049,7 +1039,7 @@ checkIfCreateRecoveryConf(const char *target_time,
|
||||
bool dummy_bool;
|
||||
pgRecoveryTarget *rt;
|
||||
|
||||
// init pgRecoveryTarget
|
||||
/* Initialize pgRecoveryTarget */
|
||||
rt = pgut_new(pgRecoveryTarget);
|
||||
rt->time_specified = false;
|
||||
rt->xid_specified = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user