Обсуждение: [ADMIN] Would like to below scenario is possible for getting page/block corruption

Поиск
Список
Период
Сортировка

[ADMIN] Would like to below scenario is possible for getting page/block corruption

От
Sreekanth Palluru
Дата:
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 ?

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

Appreciate your valuable response on this 

--
Regards
Sreekanth

Re: [ADMIN] Would like to below scenario is possible for gettingpage/block corruption

От
Shreeyansh Dba
Дата:
Hi Sreekanth,

I doubt auto-recover of the page might be possible, as the header of the page is no more valid & corrupted and not sure whether the corruption occurred in relation of a data or index block.

We have seen some occurrences like this before which got rectified by performing reindexing and vacuum full operations on index or entire table. 

If the corrupted relation is a data block & reindexing didn't help, based on your current backup strategy,  logical (pg)dump/restore) or PITR  may help in recovering  from corruption problems provided having in tact valid backups before you faced this error.


Hope this helps you in getting required solution.


Please feel free to reach us if you have any queries.

On Fri, Dec 9, 2016 at 6:16 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 ?

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

Appreciate your valuable response on this 

--
Regards
Sreekanth



--

Re: [ADMIN] Would like to below scenario is possible for gettingpage/block corruption

От
Sreekanth Palluru
Дата:
shreeyansh,
we have issue with relation and we have fixed this using setting zero_damaged_pages and then running vacuum fullbon relatuon.

I am looking at possibility of PG introducing corruption if relation extends and before it updates new page with pageheader in memory and crash happens?

Is this possible? Does PG updates pageheader when relation get extends?
If so what details it writes? Or will it be null?

On 09/12/2016 8:56 PM, "Shreeyansh Dba" <shreeyansh2014@gmail.com> wrote:
Hi Sreekanth,

I doubt auto-recover of the page might be possible, as the header of the page is no more valid & corrupted and not sure whether the corruption occurred in relation of a data or index block.

We have seen some occurrences like this before which got rectified by performing reindexing and vacuum full operations on index or entire table. 

If the corrupted relation is a data block & reindexing didn't help, based on your current backup strategy,  logical (pg)dump/restore) or PITR  may help in recovering  from corruption problems provided having in tact valid backups before you faced this error.


Hope this helps you in getting required solution.


Please feel free to reach us if you have any queries.

On Fri, Dec 9, 2016 at 6:16 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 ?

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

Appreciate your valuable response on this 

--
Regards
Sreekanth



--

Re: [GENERAL] Re: [ADMIN] Would like to below scenario is possiblefor getting page/block corruption

От
Michael Paquier
Дата:
On Sun, Dec 11, 2016 at 12:00 PM, Sreekanth Palluru <sree4pg@gmail.com> wrote:
> I am looking at possibility of PG introducing corruption if relation extends and before it updates new page with
pageheaderin memory and crash happens? 
>
> Is this possible?

No.

> Does PG updates pageheader when relation get extends?

You need to look at smgrextend() when extension an on-disk relation
file. The page is written in a correct shape.

> If so what details it writes? Or will it be null?
--
Michael