@@ -91,10 +91,16 @@ do_restore_or_validate(time_t target_backup_id, pgRecoveryTarget *rt,
9191/*
9292 * [PGPRO-1164] If BACKUP_ID is not provided for restore command,
9393 * we must find the first valid(!) backup.
94+
95+ * If target_backup_id is not provided, we can be sure that
96+ * PITR for restore or validate is requested.
97+ * So we can assume that user is more interested in recovery to specific point
98+ * in time and NOT interested in revalidation of invalid backups.
99+ * So based on that assumptions we should choose only OK and DONE backups
100+ * as candidates for validate and restore.
94101 */
95102
96- if (is_restore &&
97- target_backup_id == INVALID_BACKUP_ID &&
103+ if (target_backup_id == INVALID_BACKUP_ID &&
98104(current_backup -> status != BACKUP_STATUS_OK &&
99105current_backup -> status != BACKUP_STATUS_DONE ))
100106{
@@ -1033,7 +1039,7 @@ parseRecoveryTargetOptions(const char *target_time,
10331039if (parse_time (target_time ,& dummy_time , false))
10341040rt -> target_time = dummy_time ;
10351041else
1036- elog (ERROR ,"Invalid value for --recovery-target-time option %s" ,
1042+ elog (ERROR ,"Invalid value for' --recovery-target-time' option %s" ,
10371043target_time );
10381044}
10391045
@@ -1051,7 +1057,7 @@ parseRecoveryTargetOptions(const char *target_time,
10511057#endif
10521058rt -> target_xid = dummy_xid ;
10531059else
1054- elog (ERROR ,"Invalid value for --recovery-target-xid option %s" ,
1060+ elog (ERROR ,"Invalid value for' --recovery-target-xid' option %s" ,
10551061target_xid );
10561062}
10571063
@@ -1064,7 +1070,7 @@ parseRecoveryTargetOptions(const char *target_time,
10641070if (parse_lsn (target_lsn ,& dummy_lsn ))
10651071rt -> target_lsn = dummy_lsn ;
10661072else
1067- elog (ERROR ,"Invalid value of --recovery-target-lsn option %s" ,
1073+ elog (ERROR ,"Invalid value of' --recovery-target-lsn' option %s" ,
10681074target_lsn );
10691075}
10701076
@@ -1074,7 +1080,7 @@ parseRecoveryTargetOptions(const char *target_time,
10741080if (parse_bool (target_inclusive ,& dummy_bool ))
10751081rt -> target_inclusive = dummy_bool ;
10761082else
1077- elog (ERROR ,"Invalid value for --recovery-target-inclusive option %s" ,
1083+ elog (ERROR ,"Invalid value for' --recovery-target-inclusive' option %s" ,
10781084target_inclusive );
10791085}
10801086
@@ -1083,7 +1089,7 @@ parseRecoveryTargetOptions(const char *target_time,
10831089{
10841090if ((strcmp (target_stop ,"immediate" )!= 0 )
10851091&& (strcmp (target_stop ,"latest" )!= 0 ))
1086- elog (ERROR ,"Invalid value for --recovery-target option %s" ,
1092+ elog (ERROR ,"Invalid value for' --recovery-target' option %s" ,
10871093target_stop );
10881094
10891095recovery_target_specified ++ ;
@@ -1103,7 +1109,7 @@ parseRecoveryTargetOptions(const char *target_time,
11031109if ((strcmp (target_action ,"pause" )!= 0 )
11041110&& (strcmp (target_action ,"promote" )!= 0 )
11051111&& (strcmp (target_action ,"shutdown" )!= 0 ))
1106- elog (ERROR ,"Invalid value for --recovery-target-action option %s" ,
1112+ elog (ERROR ,"Invalid value for' --recovery-target-action' option %s" ,
11071113target_action );
11081114
11091115rt -> target_action = target_action ;