mirror of
https://github.com/postgrespro/pg_probackup.git
synced 2025-03-20 21:38:44 +02:00
Use *_FILE_CRC32 macroses instead of *_TRADITIONAL_CRC32
This commit is contained in:
parent
640d1c9df4
commit
990d67a49e
@ -307,7 +307,7 @@ remote_copy_file(PGconn *conn, pgFile* file)
|
||||
to_path, strerror(errno_tmp));
|
||||
}
|
||||
|
||||
INIT_TRADITIONAL_CRC32(file->crc);
|
||||
INIT_FILE_CRC32(false, file->crc);
|
||||
|
||||
/* read from stream and write to backup file */
|
||||
while (1)
|
||||
@ -333,14 +333,14 @@ remote_copy_file(PGconn *conn, pgFile* file)
|
||||
{
|
||||
write_buffer_size = Min(row_length, sizeof(buf));
|
||||
memcpy(buf, copybuf, write_buffer_size);
|
||||
COMP_TRADITIONAL_CRC32(file->crc, buf, write_buffer_size);
|
||||
COMP_FILE_CRC32(false, file->crc, buf, write_buffer_size);
|
||||
|
||||
/* TODO calc checksum*/
|
||||
if (fwrite(buf, 1, write_buffer_size, out) != write_buffer_size)
|
||||
{
|
||||
errno_tmp = errno;
|
||||
/* oops */
|
||||
FIN_TRADITIONAL_CRC32(file->crc);
|
||||
FIN_FILE_CRC32(false, file->crc);
|
||||
fclose(out);
|
||||
PQfinish(conn);
|
||||
elog(ERROR, "cannot write to \"%s\": %s", to_path,
|
||||
@ -364,7 +364,7 @@ remote_copy_file(PGconn *conn, pgFile* file)
|
||||
}
|
||||
|
||||
file->write_size = (int64) file->read_size;
|
||||
FIN_TRADITIONAL_CRC32(file->crc);
|
||||
FIN_FILE_CRC32(false, file->crc);
|
||||
|
||||
fclose(out);
|
||||
}
|
||||
|
18
src/data.c
18
src/data.c
@ -487,7 +487,7 @@ compress_and_backup_page(pgFile *file, BlockNumber blknum,
|
||||
blknum, header.compressed_size, write_buffer_size); */
|
||||
|
||||
/* Update CRC */
|
||||
COMP_TRADITIONAL_CRC32(*crc, write_buffer, write_buffer_size);
|
||||
COMP_FILE_CRC32(false, *crc, write_buffer, write_buffer_size);
|
||||
|
||||
/* write data page */
|
||||
if(fwrite(write_buffer, 1, write_buffer_size, out) != write_buffer_size)
|
||||
@ -547,13 +547,13 @@ backup_data_file(backup_files_arg* arguments,
|
||||
/* reset size summary */
|
||||
file->read_size = 0;
|
||||
file->write_size = 0;
|
||||
INIT_TRADITIONAL_CRC32(file->crc);
|
||||
INIT_FILE_CRC32(false, file->crc);
|
||||
|
||||
/* open backup mode file for read */
|
||||
in = fopen(file->path, PG_BINARY_R);
|
||||
if (in == NULL)
|
||||
{
|
||||
FIN_TRADITIONAL_CRC32(file->crc);
|
||||
FIN_FILE_CRC32(false, file->crc);
|
||||
|
||||
/*
|
||||
* If file is not found, this is not en error.
|
||||
@ -658,7 +658,7 @@ backup_data_file(backup_files_arg* arguments,
|
||||
to_path, strerror(errno));
|
||||
fclose(in);
|
||||
|
||||
FIN_TRADITIONAL_CRC32(file->crc);
|
||||
FIN_FILE_CRC32(false, file->crc);
|
||||
|
||||
/*
|
||||
* If we have pagemap then file in the backup can't be a zero size.
|
||||
@ -927,7 +927,7 @@ copy_file(const char *from_root, const char *to_root, pgFile *file)
|
||||
struct stat st;
|
||||
pg_crc32 crc;
|
||||
|
||||
INIT_TRADITIONAL_CRC32(crc);
|
||||
INIT_FILE_CRC32(false, crc);
|
||||
|
||||
/* reset size summary */
|
||||
file->read_size = 0;
|
||||
@ -937,7 +937,7 @@ copy_file(const char *from_root, const char *to_root, pgFile *file)
|
||||
in = fopen(file->path, PG_BINARY_R);
|
||||
if (in == NULL)
|
||||
{
|
||||
FIN_TRADITIONAL_CRC32(crc);
|
||||
FIN_FILE_CRC32(false, crc);
|
||||
file->crc = crc;
|
||||
|
||||
/* maybe deleted, it's not error */
|
||||
@ -986,7 +986,7 @@ copy_file(const char *from_root, const char *to_root, pgFile *file)
|
||||
strerror(errno_tmp));
|
||||
}
|
||||
/* update CRC */
|
||||
COMP_TRADITIONAL_CRC32(crc, buf, read_len);
|
||||
COMP_FILE_CRC32(false, crc, buf, read_len);
|
||||
|
||||
file->read_size += read_len;
|
||||
}
|
||||
@ -1013,14 +1013,14 @@ copy_file(const char *from_root, const char *to_root, pgFile *file)
|
||||
strerror(errno_tmp));
|
||||
}
|
||||
/* update CRC */
|
||||
COMP_TRADITIONAL_CRC32(crc, buf, read_len);
|
||||
COMP_FILE_CRC32(false, crc, buf, read_len);
|
||||
|
||||
file->read_size += read_len;
|
||||
}
|
||||
|
||||
file->write_size = (int64) file->read_size;
|
||||
/* finish CRC calculation and store into pgFile */
|
||||
FIN_TRADITIONAL_CRC32(crc);
|
||||
FIN_FILE_CRC32(false, crc);
|
||||
file->crc = crc;
|
||||
|
||||
/* update file permission */
|
||||
|
Loading…
x
Reference in New Issue
Block a user