Re: [HACKERS] pageinspect and hash indexes - Mailing list pgsql-hackers

From Amit Kapila
Subject Re: [HACKERS] pageinspect and hash indexes
Date
Msg-id CAA4eK1KH=ivEaZY8QSdaFSPJG_=ajaz7m-SaqCH0XRJkyg44DA@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS] pageinspect and hash indexes  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Sat, Mar 18, 2017 at 1:42 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Ashutosh Sharma <ashu.coek88@gmail.com> writes:
>> Basically, when we started working on WAL for hash index, we found
>> that WAL routine 'XLogReadBufferExtended' does not expect a page to be
>> completely zero page else it returns Invalid Buffer. To fix this, we
>> started initializing freed overflow page or new bucket pages using
>> _hash_pageinit() which basically initialises page header portion but
>> not it's special area where page type information is present. That's
>> why you are seeing an ERROR saying 'page is not a hash page'. Actually
>> pageinspect module needs to handle this type of page. Currently it is
>> just handling zero pages but not an empty pages. I will submit a patch
>> for this.
>
> That seems like entirely the wrong approach.  You should make the special
> space valid, instead, so that tools like pg_filedump can make sense of
> the page.
>

We were not aware that external tools like pg_filedump are dependent
on special space of index, but after looking at the code of
pg_filedump, I agree with you that we need to initialize the special
space in this case (free overflow page).  I think we can mark such a
page type as LH_UNUSED_PAGE  and then initialize the other fields of
special space.  Nonetheless, I think we still need modifications in
hashfuncs.c so that it can understand this type of page.


-- 
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: [HACKERS] [PATCH v1] Add and report the new "in_hot_standby" GUC pseudo-variable.
Next
From: Amit Kapila
Date:
Subject: Re: [HACKERS] pageinspect and hash indexes