remove fio_get_crc32 from restore_non_data_file

This commit is contained in:
Yura Sokolov
2022-12-20 04:55:20 +03:00
parent 5898a66c39
commit 5164bb1ea0
3 changed files with 17 additions and 11 deletions
+12 -7
View File
@@ -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)
{
+2 -2
View File
@@ -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);
+3 -2
View File
@@ -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: