Fix. Pages read via SQL don't have checksum, so calculate it at the backup side. It's an arguable decision, but at least now we are able to test other possible issues.

This commit is contained in:
Anastasia
2017-12-27 19:34:07 +03:00
parent 59477414c6
commit c5f0787453
+9 -4
View File
@@ -233,7 +233,8 @@ backup_data_page(pgFile *file, XLogRecPtr prev_backup_start_lsn,
int try_again = 100;
bool page_is_valid = false;
BlockNumber absolute_blknum = file->segno * RELSEG_SIZE + blknum;
/*
* Read the page and verify its header and checksum.
* Under high write load it's possible that we've read partly
@@ -263,22 +264,26 @@ backup_data_page(pgFile *file, XLogRecPtr prev_backup_start_lsn,
(backup_mode == BACKUP_MODE_DIFF_PTRACK))
{
size_t page_size = 0;
PageHeader phdr = (PageHeader) page;
free(page);
page = NULL;
page = (Page) pg_ptrack_get_block(file->tblspcOid, file->relOid, blknum, &page_size);
page = (Page) pg_ptrack_get_block(file->tblspcOid, file->relOid, absolute_blknum, &page_size);
if (page == NULL)
{
elog(WARNING, "File %s, block %u, file was truncated",
file->path, blknum);
file->path, absolute_blknum);
return;
}
if (page_size != BLCKSZ)
elog(ERROR, "File: %s, block %u, expected block size %lu,"
"but read %d, try again",
file->path, blknum, page_size, BLCKSZ);
file->path, absolute_blknum, page_size, BLCKSZ);
((PageHeader) page)->pd_checksum = pg_checksum_page(page, absolute_blknum);
}