Re: [HACKERS] [PATCH] pageinspect function to decode infomasks

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Craig Ringer <craig(at)2ndquadrant(dot)com>, Ashutosh Sharma <ashu(dot)coek88(at)gmail(dot)com>, Julien Rouhaud <rjuju123(at)gmail(dot)com>, Peter Geoghegan <pg(at)bowt(dot)ie>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Abhijit Menon-Sen <ams(at)2ndquadrant(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Pavan Deolasee <pavan(dot)deolasee(at)2ndquadrant(dot)com>
Subject: Re: [HACKERS] [PATCH] pageinspect function to decode infomasks
Date: 2019-09-08 07:36:36
Message-ID: CAA4eK1LPvgUS3ZJ9vsLQ7qsoEWpZsD5fwyzCsgMHkBcu+6-XAQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Sep 5, 2019 at 2:17 PM Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> wrote:
>
> Thanks. I hope the attached new patch fixes this issue.
>

*
+-- decode infomask flags as human readable flag names
+CREATE FUNCTION heap_infomask_flags(
+ infomask integer,
+ infomask2 integer,
+ decode_combined boolean DEFAULT false)
+RETURNS text[]
+AS 'MODULE_PATHNAME', 'heap_infomask_flags'

Isn't it better to name this function as tuple_infomask_flags or
something like that? The other functions that start their name with
heap take page as input. Also, I think the index-related functions
that start with index name take blk/page as input.

*
+ <varlistentry>
+ <term>
+ <function>heap_infomask_flags(infomask integer, infomask2
integer, decode_combined bool) returns text[]</function>
+ <indexterm>
+ <primary>heap_infomask_flags</primary>
+ </indexterm>
+ </term>
+ <listitem>
+ <para>
+ <function>heap_infomask_flags</function> decodes the
+ <structfield>t_infomask</structfield> and
+ <structfield>t_infomask2</structfield> returned by
+ <function>heap_page_items</function> into a human-readable
+ array of flag names. This can be used to see the tuple hint bits etc.
+ </para>

I think it is better to use one example for this function as we do for
other functions in this doc.

*
+ <para>
+ If decode_combined is set, combination flags like
+ <literal>HEAP_XMIN_FROZEN</literal> are output instead of raw
+ flags, <literal>HEAP_XMIN_COMMITTED</literal> and
+ <literal>HEAP_XMIN_INVALID</literal>. Default value is
+ <literal>false</literal>.
+ </para>

decode_combined should use parameter marker (like
<parameter>decode_combined</parameter>). Instead of saying
"decode_combined" is set, you can use true/false terminology as that
is what we use for this parameter. See explanation of "do_detoast"
that is used in function tuple_data_split in the same doc
(pageinspect.sgml) for reference.

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrey Borodin 2019-09-08 08:21:30 Re: amcheck verification for GiST
Previous Message Fabien COELHO 2019-09-08 04:35:41 Re: moonjelly vs tsearch