@@ -168,13 +168,14 @@ do_restore_or_validate(time_t target_backup_id, pgRecoveryTarget *rt,
168
168
* Save it as dest_backup
169
169
*/
170
170
dest_backup = current_backup ;
171
- dest_backup_index = i - 1 ;
172
171
}
173
172
}
174
173
175
174
if (dest_backup == NULL )
176
175
elog (ERROR , "Backup satisfying target options is not found." );
177
176
177
+ dest_backup_index = get_backup_index_number (backups , dest_backup );
178
+
178
179
/* If we already found dest_backup, look for full backup. */
179
180
if (dest_backup -> backup_mode == BACKUP_MODE_FULL )
180
181
base_full_backup = dest_backup ;
@@ -264,12 +265,13 @@ do_restore_or_validate(time_t target_backup_id, pgRecoveryTarget *rt,
264
265
* and avoid relying on sort order anymore.
265
266
*/
266
267
base_full_backup = tmp_backup ;
267
- base_full_backup_index = get_backup_index_number (backups , base_full_backup );
268
268
}
269
269
270
270
if (base_full_backup == NULL )
271
271
elog (ERROR , "Full backup satisfying target options is not found." );
272
272
273
+ base_full_backup_index = get_backup_index_number (backups , base_full_backup );
274
+
273
275
/*
274
276
* Ensure that directories provided in tablespace mapping are valid
275
277
* i.e. empty or not exist.
@@ -284,7 +286,7 @@ do_restore_or_validate(time_t target_backup_id, pgRecoveryTarget *rt,
284
286
285
287
/*
286
288
* Validate backups from base_full_backup to dest_backup.
287
- * At this moment we are sure that parent chain is intact.
289
+ * At this point we are sure that parent chain is intact.
288
290
*/
289
291
for (i = base_full_backup_index ; i >= dest_backup_index ; i -- )
290
292
{
0 commit comments