diff --git a/src/data.c b/src/data.c index b8edf443..21a30692 100644 --- a/src/data.c +++ b/src/data.c @@ -1026,8 +1026,8 @@ restore_data_file_internal(pioReader_i in, pioDBWriter_i out, pgFile *file, uint } size_t -restore_non_data_file(parray *parent_chain, pgBackup *dest_backup, - pgFile *dest_file, pioDBWriter_i out, const char *to_fullpath, +restore_non_data_file(parray *parent_chain, pgBackup *dest_backup, pgFile *dest_file, + pioDrive_i out_drive, pioDBWriter_i out, const char *to_fullpath, bool already_exists) { char from_root[MAXPGPATH]; @@ -1113,11 +1113,16 @@ restore_non_data_file(parray *parent_chain, pgBackup *dest_backup, { /* compare checksums of already existing file and backup file */ pg_crc32 file_crc; - if (tmp_file->forkName == cfm && - tmp_file->uncompressed_size > tmp_file->write_size) - file_crc = fio_get_crc32_truncated(FIO_DB_HOST, to_fullpath, false); - else - file_crc = fio_get_crc32(FIO_DB_HOST, to_fullpath, false, false); + bool truncated; + + truncated = tmp_file->forkName == cfm && + tmp_file->uncompressed_size > tmp_file->write_size; + + file_crc = $i(pioGetCRC32, out_drive, .path = to_fullpath, + .truncated = truncated, .err = &err); + + if ($haserr(err)) + ft_logerr(FT_FATAL, $errmsg(err), "Non-data file CRC32"); if (file_crc == tmp_file->crc) { diff --git a/src/pg_probackup.h b/src/pg_probackup.h index 5d694cf9..ad0b04de 100644 --- a/src/pg_probackup.h +++ b/src/pg_probackup.h @@ -1042,8 +1042,8 @@ extern void backup_non_data_file(pioDrive_i from, pioDrive_i to, extern size_t restore_data_file(parray *parent_chain, pgFile *dest_file, pioDBWriter_i out, const char *to_fullpath, bool use_bitmap, PageState *checksum_map, XLogRecPtr shift_lsn, datapagemap_t *lsn_map, bool use_headers); -extern size_t restore_non_data_file(parray *parent_chain, pgBackup *dest_backup, - pgFile *dest_file, pioDBWriter_i out, const char *to_fullpath, +extern size_t restore_non_data_file(parray *parent_chain, pgBackup *dest_backup, pgFile *dest_file, + pioDrive_i out_drive, pioDBWriter_i out, const char *to_fullpath, bool already_exists); extern bool create_empty_file(const char *to_root, fio_location to_location, pgFile *file); diff --git a/src/restore.c b/src/restore.c index 0b8a5d4c..8734d785 100644 --- a/src/restore.c +++ b/src/restore.c @@ -1273,8 +1273,9 @@ restore_files(void *arg) { /* Destination file is non-data file */ arguments->restored_bytes += restore_non_data_file(arguments->parent_chain, - arguments->dest_backup, dest_file, out, to_fullpath, - already_exists); + arguments->dest_backup, dest_file, + $reduce(pioDrive, db_drive), out, + to_fullpath, already_exists); } done: