Commit 33cedf14 authored by Magnus Hagander's avatar Magnus Hagander

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.
parent 90372729
......@@ -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)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment