Re: GIN pageinspect functions

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Peter Geoghegan <pg(at)heroku(dot)com>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: GIN pageinspect functions
Date: 2014-11-20 03:52:14
Message-ID: CAB7nPqRuiDr9r6M_9CzucpQj786OiHAP1TTokteVHJOu6BQ6Sw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Nov 19, 2014 at 7:01 AM, Peter Geoghegan <pg(at)heroku(dot)com> wrote:
> On Tue, Nov 4, 2014 at 7:26 AM, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>> I think these functions will be quite useful for debugging purpose
>> and we already have similar function's for other index (btree).
>
> This patch has bitrotted. I attach rebased revision, for the
> convenience of others - V1.3 of pageinspect will now incorporate both
> GIN stuff, and BRIN stuff. Seems like this patch was affected by the
> recent problems with header includes - that's fixed.

Thanks for the updated version! That's a cool timing, I wanted to move
this patch forward these days... I think as well that it would be a
useful addition for pageinspect (and I was in need of them yesterday,
and soon today btw).

> Amit wrote:
> 1. Documentation seems to be missing, other API's exposed
> via pageinspect are documented at:
> http://www.postgresql.org/docs/devel/static/pageinspect.html
Done.

> 2.
> +CREATE FUNCTION gin_metapage(IN page bytea,
> + OUT pending_head bigint,
> + OUT pending_tail bigint,
> + OUT version int4)
> +AS 'MODULE_PATHNAME', 'gin_metapage'
> +LANGUAGE C STRICT;
> a. Isn't it better to name the function as gin_metap(..) similar to
> existing function bt_metap(..)?
I actually liked more gin_metapage_info, a name similar to the
newly-introduced brin indexes.

> b. Can this function have a similar signature as bt_metap() which means
> it should take input as relname?
That's mostly a matter of taste but I think we should definitely pass
a raw page to it as it is now. This has the advantage to add an extra
check if the page passed is really a meta page of not, something
useful for development.

> 3. Can gin_dataleafpage() API have similar name and signature as
> API bt_page_items() exposed for btree?
What about gin_leafpage_items then?

> 4. Can we have any better name for gin_pageopaq (other API name's
> in this module are self explanatory)?
gin_page_opaque_info? Because we get back information about the opaque
portion of the page. Feel free if you have any better idea.

Updated patch, with some more things improved and cleaned up (addition
of header of ginfuncs.c, addition of array of decoded item pointers
for compressed data leaf pages), is attached.

One last thing not only interesting for this patch: it may be good to
expose DatumGetItemPointer and ItemPointerGetDatum in for extensions
analyzing content of pages. I am not sure where though, a place like
utils/*.h may be useful. Thoughts?
Regards,
--
Michael

Attachment Content-Type Size
20141120_pageinspect_gin_v3.patch application/x-patch 14.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2014-11-20 04:02:59 Nitpicky doc corrections for BRIN functions of pageinspect
Previous Message Amit Langote 2014-11-20 03:27:30 Re: On partitioning