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

From Ashutosh Sharma
Subject Re: [HACKERS] pageinspect and hash indexes
Date
Msg-id CAE9k0PmNERn-ZL6JLONfwxCmaLeYPWtyZPLOvHHAxehwxs-krQ@mail.gmail.com
Whole thread Raw
In response to [HACKERS] pageinspect and hash indexes  (Jeff Janes <jeff.janes@gmail.com>)
Responses Re: [HACKERS] pageinspect and hash indexes  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: [HACKERS] pageinspect and hash indexes  (Amit Kapila <amit.kapila16@gmail.com>)
List pgsql-hackers
On Fri, Mar 17, 2017 at 10:54 PM, Jeff Janes <jeff.janes@gmail.com> wrote:
> While trying to figure out some bloating in the newly logged hash indexes,
> I'm looking into the type of each page in the index.  But I get an error:
>
> psql -p 9876 -c "select hash_page_type(get_raw_page('foo_index_idx',x)) from
> generate_series(1650,1650) f(x)"
>
> ERROR:  page is not a hash page
> DETAIL:  Expected 0000ff80, got 00000000.
>
> The contents of the page are:
>
> \xa4000000d8f203bf65c900001800f01ff01f0420...
>
> (where the elided characters at the end are all zero)
>
> What kind of page is that actually?

it is basically either a newly allocated bucket page or a freed overflow page.

You are seeing this error because of following change in the WAL patch
for hash index,

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.

And isn't it unhelpful to have the
> pageinspect module throw errors, rather than returning a dummy value to
> indicate there was an error?

Well, this is something not specific to hash index. So, I have no answer :)

--
With Regards,
Ashutosh Sharma
EnterpriseDB:http://www.enterprisedb.com





--
With Regards,
Ashutosh Sharma
EnterpriseDB:http://www.enterprisedb.com



pgsql-hackers by date:

Previous
From: Jeff Janes
Date:
Subject: [HACKERS] free space map and visibility map
Next
From: Peter Eisentraut
Date:
Subject: [HACKERS] Re: [COMMITTERS] pgsql: Remove objname/objargs split for referring toobjects