aboutsummaryrefslogtreecommitdiff
path: root/src/backend/replication/basebackup.c
diff options
context:
space:
mode:
authorMagnus Hagander <magnus@hagander.net>2018-04-15 14:05:56 +0200
committerMagnus Hagander <magnus@hagander.net>2018-04-15 14:05:56 +0200
commit33cedf1474a356fe510d4ad32c040c968ef27307 (patch)
tree9c74c9bfaf702289df4b393d1dd4a5b909665e90 /src/backend/replication/basebackup.c
parent90372729f4671ad5ad743b53a53e7ccbab92c4f8 (diff)
downloadpostgresql-33cedf1474a356fe510d4ad32c040c968ef27307.tar.gz
postgresql-33cedf1474a356fe510d4ad32c040c968ef27307.zip
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.
Diffstat (limited to 'src/backend/replication/basebackup.c')
-rw-r--r--src/backend/replication/basebackup.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/backend/replication/basebackup.c b/src/backend/replication/basebackup.c
index 50c052e9935..a79048d233d 100644
--- a/src/backend/replication/basebackup.c
+++ b/src/backend/replication/basebackup.c
@@ -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;