Re: pageinspect: Hash index support

Jesper Pedersen <jesper.pedersen@redhat.com>

From: Jesper Pedersen <jesper.pedersen@redhat.com>
To: Amit Kapila <amit.kapila16@gmail.com>
Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>, Michael Paquier <michael.paquier@gmail.com>, Ashutosh Sharma <ashu.coek88@gmail.com>, Jeff Janes <jeff.janes@gmail.com>, Alvaro Herrera <alvherre@2ndquadrant.com>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2016-09-26T17:42:06Z
Lists: pgsql-hackers
On 09/23/2016 01:56 AM, Amit Kapila wrote:
> While looking at patch, I noticed below code which seems somewhat problematic:
>
> + stat->max_avail = BLCKSZ - (BLCKSZ - phdr->pd_special + SizeOfPageHeaderData);
> +
> + /* page type (flags) */
> + if (opaque->hasho_flag & LH_META_PAGE)
> + stat->type = 'm';
> + else if (opaque->hasho_flag & LH_OVERFLOW_PAGE)
> + stat->type = 'v';
> + else if (opaque->hasho_flag & LH_BUCKET_PAGE)
> + stat->type = 'b';
> + else if (opaque->hasho_flag & LH_BITMAP_PAGE)
> + stat->type = 'i';
>
> In the above code, it appears that you are trying to calculate
> max_avail space for all pages in same way.  Don't you need to
> calculate it differently for bitmap page or meta page as they don't
> share the same format as other type of pages?
>

Correct, however the max_avail calculation was removed in v6, since we 
don't display average item size anymore.

Thanks for the feedback !

Best regards,
  Jesper



Commits

  1. Fix incorrect typecast.

  2. In pageinspect/hashfuncs.c, avoid crashes on alignment-picky machines.

  3. pageinspect: Support hash indexes.

  4. Add uuid to the set of types supported by contrib/btree_gist.

  5. Allow CREATE EXTENSION to follow extension update paths.