Don't attempt to verify checksums on new pages
Teach both base backups and pg_verify_checksums that if a page is new, it does not have a checksum yet, so it shouldn't be verified. Noted by Tomas Vondra, review by David Steele.
This commit is contained in:
parent
90372729f4
commit
33cedf1474
@ -1446,8 +1446,10 @@ sendFile(const char *readfilename, const char *tarfilename, struct stat *statbuf
|
||||
* written only halfway and the checksum would not be valid.
|
||||
* However, replaying WAL would reinstate the correct page in
|
||||
* this case.
|
||||
* We also skip completely new pages, since they don't have
|
||||
* a checksum yet.
|
||||
*/
|
||||
if (PageGetLSN(page) < startptr)
|
||||
if (!PageIsNew(page) && PageGetLSN(page) < startptr)
|
||||
{
|
||||
checksum = pg_checksum_page((char *) page, blkno + segmentno * RELSEG_SIZE);
|
||||
phdr = (PageHeader) page;
|
||||
|
@ -106,6 +106,10 @@ scan_file(char *fn, int segmentno)
|
||||
}
|
||||
blocks++;
|
||||
|
||||
/* New pages have no checksum yet */
|
||||
if (PageIsNew(buf))
|
||||
continue;
|
||||
|
||||
csum = pg_checksum_page(buf, blockno + segmentno * RELSEG_SIZE);
|
||||
if (csum != header->pd_checksum)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user