Skip to content

Commit 33cedf1

Browse files
committed
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.
1 parent 9037272 commit 33cedf1

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/backend/replication/basebackup.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1446,8 +1446,10 @@ sendFile(const char *readfilename, const char *tarfilename, struct stat *statbuf
14461446
* written only halfway and the checksum would not be valid.
14471447
* However, replaying WAL would reinstate the correct page in
14481448
* this case.
1449+
* We also skip completely new pages, since they don't have
1450+
* a checksum yet.
14491451
*/
1450-
if (PageGetLSN(page) < startptr)
1452+
if (!PageIsNew(page) && PageGetLSN(page) < startptr)
14511453
{
14521454
checksum = pg_checksum_page((char *) page, blkno + segmentno * RELSEG_SIZE);
14531455
phdr = (PageHeader) page;

src/bin/pg_verify_checksums/pg_verify_checksums.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@ scan_file(char *fn, int segmentno)
106106
}
107107
blocks++;
108108

109+
/* New pages have no checksum yet */
110+
if (PageIsNew(buf))
111+
continue;
112+
109113
csum = pg_checksum_page(buf, blockno + segmentno * RELSEG_SIZE);
110114
if (csum != header->pd_checksum)
111115
{

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy