From: Tom Lane Date: Mon, 1 Dec 2003 16:53:42 +0000 (+0000) Subject: Force zero_damaged_pages to be effectively ON during recovery from WAL, X-Git-Tag: REL7_3_5~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8d802d4edfe6dca66e91109d933f61921e45aa3c;p=thirdparty%2Fpostgresql.git Force zero_damaged_pages to be effectively ON during recovery from WAL, since there is no need to worry about damaged pages when we are going to overwrite them anyway from the WAL. Per recent discussion. --- diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 35b1db79e84..fba8983d3ab 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.133.2.1 2003/04/04 00:32:57 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.133.2.2 2003/12/01 16:53:42 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -226,7 +226,13 @@ ReadBufferInternal(Relation reln, BlockNumber blockNum, if (status == SM_SUCCESS && !PageHeaderIsValid((PageHeader) MAKE_PTR(bufHdr->data))) { - if (zero_damaged_pages) + /* + * During WAL recovery, the first access to any data page should + * overwrite the whole page from the WAL; so a clobbered page + * header is not reason to fail. Hence, when InRecovery we may + * always act as though zero_damaged_pages is ON. + */ + if (zero_damaged_pages || InRecovery) { elog(WARNING, "Invalid page header in block %u of %s; zeroing out page", blockNum, RelationGetRelationName(reln));