Re: [GENERAL] Would like to below scenario is possible for gettingpage/block corruption - Mailing list pgsql-general

From Michael Paquier
Subject Re: [GENERAL] Would like to below scenario is possible for gettingpage/block corruption
Date
Msg-id CAB7nPqQxHoyTT=2jcXQzVOOFxqL=q4xU2w-pNS+Bf-HZ+mTERg@mail.gmail.com
Whole thread Raw
In response to [GENERAL] Would like to below scenario is possible for getting page/block corruption  (Sreekanth Palluru <sree4pg@gmail.com>)
Responses Re: [GENERAL] Would like to below scenario is possible for gettingpage/block corruption
List pgsql-general
On Fri, Dec 9, 2016 at 9:46 AM, Sreekanth Palluru <sree4pg@gmail.com> wrote:
> Hi ,
> I am working on page corruption issue want to know if below scenario is
> possible
>
> 1)  Insert command from client , I understand heap_insert is called from
> heampam.c
> 2) Let us say table is full and relation is extended and added a new block
> 3) Tuple is inserted into new page for the block RelationPutHeapTuple/hio.c
> 4) Later  WAL record is inserted  through recptr = XLogInsert(RM_HEAP_ID,
> info);
> 5) Then backend update the PageHeader with WAL LSN details  PageSetLSN(page,
> recptr);
>
> If my server got crashed after step 4) is there a possibility that after
> postgres database restart I get  below error when I access the relation or
> vacuum is run on this relation or taking backup through pg_dump  ?
> ERROR:  invalid page header in block 204 of relation base/16413/16900 ?

So the block is corrupted. You may want to move to another server.

> or
> Postgres can automatically recover the page  without throwing any error ?

At crash recovery, Postgres would redo things from a point where
everything was consistent on disk. If this corrupted page made it to
disk, there is not much that can be done except restoring from a
backup. You could as well zero_damaged_pages to help here, but you
would lose the data on this page, still you would be able to perform
pg_dump and get back as much data as you can. At the same time,
corruption can spread as well as if that's a hardware problem, so you
are just seeing the beginning of a series of problems.
--
Michael


pgsql-general by date:

Previous
From: Metare Solve
Date:
Subject: Re: [GENERAL] Looking for an online mentor
Next
From: John R Pierce
Date:
Subject: Re: [GENERAL] Looking for an online mentor