Re: Setting pd_lower in GIN metapage

Amit Kapila <amit.kapila16@gmail.com>

From: Amit Kapila <amit.kapila16@gmail.com>
To: Michael Paquier <michael.paquier@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>, Masahiko Sawada <sawada.mshk@gmail.com>, Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2017-09-20T03:49:01Z
Lists: pgsql-hackers
On Wed, Sep 20, 2017 at 4:25 AM, Michael Paquier
<michael.paquier@gmail.com> wrote:
> On Wed, Sep 20, 2017 at 12:47 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Amit Kapila <amit.kapila16@gmail.com> writes:
>>> On Tue, Sep 19, 2017 at 9:27 AM, Michael Paquier
>>> <michael.paquier@gmail.com> wrote:
>>>> I am not saying that no index AMs take advantage FPW compressibility
>>>> for their meta pages. There are cases like this one, as well as one
>>>> code path in BRIN where this is useful, and it is useful as well when
>>>> logging FPWs of the init forks for unlogged relations.
>>
>>> Hmm, why is it useful for logging FPWs of the init forks for unlogged
>>> relations?  We don't use REGBUF_STANDARD in those cases.
>>
>> But if we started to do so, that would be a concrete benefit of this
>> patch ...
>
> In the proposed set of patches, all the empty() routines part of index
> AMs which use log_newpage_buffer() (brin, gin, spgst) are doing the
> right thing by updating log_newpage_buffer(). btree also should have
> its call to log_newpage updated in btbuildempty(), and your patch is
> missing that.
>

We can add that for btree patch.

> Also, _hash_init() would need some extra work to
> generate FPWs, but I don't think that it is necessary per its handling
> of a per-record meta data either. So REGBUF_STANDARD could be just
> removed from there, and there is actually no need to patch
> src/backend/access/hash at all.
>

I think there is no need to remove it.  As per discussion above, we
want to keep REGBUF_STANDARD for all metapage initializations for the
matter of consistency and that will be useful for
wal_consistency_checking in which case we anyway need full page image.


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


Commits

  1. Flag index metapages as standard-format in xlog.c calls.

  2. Set the metapage's pd_lower correctly in brin, gin, and spgist indexes.