@@ -373,7 +373,9 @@ do_restore_or_validate(time_t target_backup_id, pgRecoveryTarget *rt,
373373 }
374374 }
375375
376+ /* validate datafiles only */
376377 pgBackupValidate (tmp_backup , params );
378+
377379 /* After pgBackupValidate() only following backup
378380 * states are possible: ERROR, RUNNING, CORRUPT and OK.
379381 * Validate WAL only for OK, because there is no point
@@ -390,6 +392,7 @@ do_restore_or_validate(time_t target_backup_id, pgRecoveryTarget *rt,
390392 }
391393
392394 /* There is no point in wal validation of corrupted backups */
395+ // TODO: there should be a way for a user to request only(!) WAL validation
393396 if (!corrupted_backup )
394397 {
395398 /*
@@ -458,7 +461,7 @@ do_restore_or_validate(time_t target_backup_id, pgRecoveryTarget *rt,
458461 * throw an error.
459462 */
460463 if (params -> partial_db_list )
461- dbOid_exclude_list = get_dbOid_exclude_list (dest_backup , dest_files , params -> partial_db_list ,
464+ dbOid_exclude_list = get_dbOid_exclude_list (dest_backup , params -> partial_db_list ,
462465 params -> partial_restore_type );
463466
464467 /*
@@ -1185,19 +1188,22 @@ parseRecoveryTargetOptions(const char *target_time,
11851188 * we always convert it into exclude_list.
11861189 */
11871190parray *
1188- get_dbOid_exclude_list (pgBackup * backup , parray * files ,
1189- parray * datname_list , PartialRestoreType partial_restore_type )
1191+ get_dbOid_exclude_list (pgBackup * backup , parray * datname_list ,
1192+ PartialRestoreType partial_restore_type )
11901193{
11911194 int i ;
11921195 int j ;
1193- parray * database_map = NULL ;
1194- parray * dbOid_exclude_list = NULL ;
1195- pgFile * database_map_file = NULL ;
1196- pg_crc32 crc ;
1196+ // pg_crc32 crc ;
1197+ parray * database_map = NULL ;
1198+ parray * dbOid_exclude_list = NULL ;
1199+ pgFile * database_map_file = NULL ;
11971200 char path [MAXPGPATH ];
11981201 char database_map_path [MAXPGPATH ];
1202+ parray * files = NULL ;
1203+
1204+ files = get_backup_filelist (backup );
11991205
1200- /* make sure that database_map is in backup_content.control */
1206+ /* look for ' database_map' file in backup_content.control */
12011207 for (i = 0 ; i < parray_num (files ); i ++ )
12021208 {
12031209 pgFile * file = (pgFile * ) parray_get (files , i );
@@ -1218,11 +1224,11 @@ get_dbOid_exclude_list(pgBackup *backup, parray *files,
12181224 join_path_components (database_map_path , path , DATABASE_MAP );
12191225
12201226 /* check database_map CRC */
1221- crc = pgFileGetCRC (database_map_path , true, true, NULL , FIO_LOCAL_HOST );
1222-
1223- if (crc != database_map_file -> crc )
1224- elog (ERROR , "Invalid CRC of backup file \"%s\" : %X. Expected %X" ,
1225- database_map_file -> path , crc , database_map_file -> crc );
1227+ // crc = pgFileGetCRC(database_map_path, true, true, NULL, FIO_LOCAL_HOST);
1228+ //
1229+ // if (crc != database_map_file->crc)
1230+ // elog(ERROR, "Invalid CRC of backup file \"%s\" : %X. Expected %X",
1231+ // database_map_file->path, crc, database_map_file->crc);
12261232
12271233 /* get database_map from file */
12281234 database_map = read_database_map (backup );
@@ -1307,6 +1313,13 @@ get_dbOid_exclude_list(pgBackup *backup, parray *files,
13071313 elog (ERROR , "Failed to find a match in database_map of backup %s for partial restore" ,
13081314 base36enc (backup -> start_time ));
13091315
1316+ /* clean backup filelist */
1317+ if (files )
1318+ {
1319+ parray_walk (files , pgFileFree );
1320+ parray_free (files );
1321+ }
1322+
13101323 /* sort dbOid array in ASC order */
13111324 parray_qsort (dbOid_exclude_list , pgCompareOid );
13121325
0 commit comments