1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2025-07-15 07:04:14 +02:00

Fix remote delta backup

This commit is contained in:
Konstantin Knizhnik
2019-01-18 00:37:18 +03:00
parent 3b144bbe2b
commit be78ca6ee2
3 changed files with 7 additions and 7 deletions

View File

@ -819,7 +819,7 @@ do_backup_instance(void)
{ {
pgFile *file = (pgFile *) parray_get(xlog_files_list, i); pgFile *file = (pgFile *) parray_get(xlog_files_list, i);
if (S_ISREG(file->mode)) if (S_ISREG(file->mode))
calc_file_checksum(file); calc_file_checksum(file, FIO_BACKUP_HOST);
/* Remove file path root prefix*/ /* Remove file path root prefix*/
if (strstr(file->path, database_path) == file->path) if (strstr(file->path, database_path) == file->path)
{ {
@ -2029,7 +2029,7 @@ pg_stop_backup(pgBackup *backup)
if (backup_files_list) if (backup_files_list)
{ {
file = pgFileNew(backup_label, true, FIO_BACKUP_HOST); file = pgFileNew(backup_label, true, FIO_BACKUP_HOST);
calc_file_checksum(file); calc_file_checksum(file, FIO_BACKUP_HOST);
free(file->path); free(file->path);
file->path = strdup(PG_BACKUP_LABEL_FILE); file->path = strdup(PG_BACKUP_LABEL_FILE);
parray_append(backup_files_list, file); parray_append(backup_files_list, file);
@ -2073,7 +2073,7 @@ pg_stop_backup(pgBackup *backup)
{ {
file = pgFileNew(tablespace_map, true, FIO_BACKUP_HOST); file = pgFileNew(tablespace_map, true, FIO_BACKUP_HOST);
if (S_ISREG(file->mode)) if (S_ISREG(file->mode))
calc_file_checksum(file); calc_file_checksum(file, FIO_BACKUP_HOST);
free(file->path); free(file->path);
file->path = strdup(PG_TABLESPACE_MAP_FILE); file->path = strdup(PG_TABLESPACE_MAP_FILE);
parray_append(backup_files_list, file); parray_append(backup_files_list, file);
@ -2319,7 +2319,7 @@ backup_files(void *arg)
if (prev_file && file->exists_in_prev && if (prev_file && file->exists_in_prev &&
buf.st_mtime < current.parent_backup) buf.st_mtime < current.parent_backup)
{ {
calc_file_checksum(file); calc_file_checksum(file, FIO_DB_HOST);
/* ...and checksum is the same... */ /* ...and checksum is the same... */
if (EQ_TRADITIONAL_CRC32(file->crc, (*prev_file)->crc)) if (EQ_TRADITIONAL_CRC32(file->crc, (*prev_file)->crc))
skip = true; /* ...skip copying file. */ skip = true; /* ...skip copying file. */

View File

@ -1414,11 +1414,11 @@ get_wal_file(const char *from_path, const char *to_path)
* PG_TABLESPACE_MAP_FILE and PG_BACKUP_LABEL_FILE. * PG_TABLESPACE_MAP_FILE and PG_BACKUP_LABEL_FILE.
*/ */
void void
calc_file_checksum(pgFile *file) calc_file_checksum(pgFile *file, fio_location location)
{ {
Assert(S_ISREG(file->mode)); Assert(S_ISREG(file->mode));
file->crc = pgFileGetCRC(file->path, true, false, &file->read_size, FIO_BACKUP_HOST); file->crc = pgFileGetCRC(file->path, true, false, &file->read_size, location);
file->write_size = file->read_size; file->write_size = file->read_size;
} }

View File

@ -555,7 +555,7 @@ extern void push_wal_file(const char *from_path, const char *to_path,
bool is_compress, bool overwrite); bool is_compress, bool overwrite);
extern void get_wal_file(const char *from_path, const char *to_path); extern void get_wal_file(const char *from_path, const char *to_path);
extern void calc_file_checksum(pgFile *file); extern void calc_file_checksum(pgFile *file, fio_location location);
extern bool check_file_pages(pgFile *file, XLogRecPtr stop_lsn, extern bool check_file_pages(pgFile *file, XLogRecPtr stop_lsn,
uint32 checksum_version, uint32 backup_version); uint32 checksum_version, uint32 backup_version);