@@ -91,10 +91,16 @@ do_restore_or_validate(time_t target_backup_id, pgRecoveryTarget *rt,
91
91
/*
92
92
* [PGPRO-1164] If BACKUP_ID is not provided for restore command,
93
93
* 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.
94
101
*/
95
102
96
- if (is_restore &&
97
- target_backup_id == INVALID_BACKUP_ID &&
103
+ if (target_backup_id == INVALID_BACKUP_ID &&
98
104
(current_backup -> status != BACKUP_STATUS_OK &&
99
105
current_backup -> status != BACKUP_STATUS_DONE ))
100
106
{
@@ -1033,7 +1039,7 @@ parseRecoveryTargetOptions(const char *target_time,
1033
1039
if (parse_time (target_time , & dummy_time , false))
1034
1040
rt -> target_time = dummy_time ;
1035
1041
else
1036
- elog (ERROR , "Invalid value for --recovery-target-time option %s" ,
1042
+ elog (ERROR , "Invalid value for ' --recovery-target-time' option %s" ,
1037
1043
target_time );
1038
1044
}
1039
1045
@@ -1051,7 +1057,7 @@ parseRecoveryTargetOptions(const char *target_time,
1051
1057
#endif
1052
1058
rt -> target_xid = dummy_xid ;
1053
1059
else
1054
- elog (ERROR , "Invalid value for --recovery-target-xid option %s" ,
1060
+ elog (ERROR , "Invalid value for ' --recovery-target-xid' option %s" ,
1055
1061
target_xid );
1056
1062
}
1057
1063
@@ -1064,7 +1070,7 @@ parseRecoveryTargetOptions(const char *target_time,
1064
1070
if (parse_lsn (target_lsn , & dummy_lsn ))
1065
1071
rt -> target_lsn = dummy_lsn ;
1066
1072
else
1067
- elog (ERROR , "Invalid value of --recovery-target-lsn option %s" ,
1073
+ elog (ERROR , "Invalid value of ' --recovery-target-lsn' option %s" ,
1068
1074
target_lsn );
1069
1075
}
1070
1076
@@ -1074,7 +1080,7 @@ parseRecoveryTargetOptions(const char *target_time,
1074
1080
if (parse_bool (target_inclusive , & dummy_bool ))
1075
1081
rt -> target_inclusive = dummy_bool ;
1076
1082
else
1077
- elog (ERROR , "Invalid value for --recovery-target-inclusive option %s" ,
1083
+ elog (ERROR , "Invalid value for ' --recovery-target-inclusive' option %s" ,
1078
1084
target_inclusive );
1079
1085
}
1080
1086
@@ -1083,7 +1089,7 @@ parseRecoveryTargetOptions(const char *target_time,
1083
1089
{
1084
1090
if ((strcmp (target_stop , "immediate" ) != 0 )
1085
1091
&& (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" ,
1087
1093
target_stop );
1088
1094
1089
1095
recovery_target_specified ++ ;
@@ -1103,7 +1109,7 @@ parseRecoveryTargetOptions(const char *target_time,
1103
1109
if ((strcmp (target_action , "pause" ) != 0 )
1104
1110
&& (strcmp (target_action , "promote" ) != 0 )
1105
1111
&& (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" ,
1107
1113
target_action );
1108
1114
1109
1115
rt -> target_action = target_action ;
0 commit comments