Force zero_damaged_pages to be effectively ON during recovery from WAL,
authorTom Lane <[email protected]>
Mon, 1 Dec 2003 16:53:30 +0000 (16:53 +0000)
committerTom Lane <[email protected]>
Mon, 1 Dec 2003 16:53:30 +0000 (16:53 +0000)
since there is no need to worry about damaged pages when we are going to
overwrite them anyway from the WAL.  Per recent discussion.

src/backend/storage/buffer/bufmgr.c

index f155619fa91edaf6d7837824d050df3d7dc41f18..85d62914e86ded3dda9698a1840e004c0e040d28 100644 (file)
@@ -227,7 +227,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)
                        {
                                ereport(WARNING,
                                                (errcode(ERRCODE_DATA_CORRUPTED),