Re: [HACKERS] pageinspect: Hash index support - Mailing list pgsql-hackers

From Jesper Pedersen
Subject Re: [HACKERS] pageinspect: Hash index support
Date
Msg-id 4f9c865b-0f79-83a7-a540-1533706c24ee@redhat.com
Whole thread Raw
In response to Re: [HACKERS] pageinspect: Hash index support  (Ashutosh Sharma <ashu.coek88@gmail.com>)
Responses Re: [HACKERS] pageinspect: Hash index support  (Ashutosh Sharma <ashu.coek88@gmail.com>)
Re: [HACKERS] pageinspect: Hash index support  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
List pgsql-hackers
Hi,

On 01/18/2017 04:54 AM, Ashutosh Sharma wrote:
>> Is there a reason for keeping the input arguments for
>> hash_bitmap_info() different from hash_page_items()?
>>
>
> Yes, there are two reasons behind it.
>
> Firstly, we need metapage to identify the bitmap page that holds the
> information about the overflow page passed as an input to this
> function.
>
> Secondly, we will have to input overflow block number as an input to
> this function so as to determine the overflow bit number which can be
> used further to identify the bitmap page.
>
> +   /* Read the metapage so we can determine which bitmap page to use */
> +   metabuf = _hash_getbuf(indexRel, HASH_METAPAGE, HASH_READ, LH_META_PAGE);
> +   metap = HashPageGetMeta(BufferGetPage(metabuf));
> +
> +   /* Identify overflow bit number */
> +   ovflbitno = _hash_ovflblkno_to_bitno(metap, ovflblkno);
> +
> +   bitmappage = ovflbitno >> BMPG_SHIFT(metap);
> +   bitmapbit = ovflbitno & BMPG_MASK(metap);
> +
> +   if (bitmappage >= metap->hashm_nmaps)
> +       ereport(ERROR,
> +               (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
> +                errmsg("invalid overflow bit number %u", ovflbitno)));
> +
> +   bitmapblkno = metap->hashm_mapp[bitmappage];
>
>

As discussed off-list (along with my patch that included some of these 
fixes), it would require calculation from the user to be able to provide 
the necessary pages through get_raw_page().

Other ideas on how to improve this are most welcome.

> Apart from above comments, the attached patch also handles all the
> comments from Mithun.
>

Please, include a version number for your patch files in the future.

Fixed in this version:

* verify_hash_page: Display magic in hex, like hash_metapage_info
* Update header for hash_page_type

Moving the patch back to 'Needs Review'.

Best regards,
  Jesper


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Attachment

pgsql-hackers by date:

Previous
From: Vladimir Rusinov
Date:
Subject: Re: [HACKERS] [PATCH] Rename pg_switch_xlog to pg_switch_wal
Next
From: Jeff Janes
Date:
Subject: Re: [HACKERS] move collation import to backend