mirror of
https://github.com/postgrespro/pg_probackup.git
synced 2025-01-08 13:44:32 +02:00
Fix checksums for segno > 0
This commit is contained in:
parent
55686d33c7
commit
f69e780d37
14
backup.c
14
backup.c
@ -1106,6 +1106,20 @@ add_files(parray *files, const char *root, bool add_root, bool is_pgdata)
|
||||
continue;
|
||||
|
||||
file->is_datafile = true;
|
||||
{
|
||||
int find_dot;
|
||||
char *text_segno;
|
||||
for(find_dot = path_len-1; file->path[find_dot] != '.' && find_dot >= 0; find_dot--);
|
||||
if (find_dot <= 0)
|
||||
continue;
|
||||
|
||||
text_segno = file->path + find_dot + 1;
|
||||
/* in future we will need check all chars */
|
||||
if (!isdigit(text_segno[0]))
|
||||
continue;
|
||||
|
||||
file->segno = (int) strtol(text_segno, NULL, 10);
|
||||
}
|
||||
}
|
||||
parray_concat(files, list_file);
|
||||
}
|
||||
|
5
data.c
5
data.c
@ -185,8 +185,9 @@ backup_data_file(const char *from_root, const char *to_root,
|
||||
elog(ERROR, "File: %s blknum %u have wrong page header.", file->path, blknum);
|
||||
}
|
||||
|
||||
|
||||
if(current.checksum_version &&
|
||||
pg_checksum_page(page.data, header.block) != ((PageHeader) page.data)->pd_checksum)
|
||||
pg_checksum_page(page.data, file->segno * RELSEG_SIZE + blknum) != ((PageHeader) page.data)->pd_checksum)
|
||||
{
|
||||
if (try_checksum)
|
||||
{
|
||||
@ -307,7 +308,7 @@ backup_data_file(const char *from_root, const char *to_root,
|
||||
}
|
||||
|
||||
if(current.checksum_version &&
|
||||
pg_checksum_page(page.data, header.block) != ((PageHeader) page.data)->pd_checksum)
|
||||
pg_checksum_page(page.data, file->segno * RELSEG_SIZE + blknum) != ((PageHeader) page.data)->pd_checksum)
|
||||
{
|
||||
if (try_checksum)
|
||||
elog(WARNING, "File: %s blknum %u have wrong checksum, try again", file->path, blknum);
|
||||
|
Loading…
Reference in New Issue
Block a user