Re: Setting pd_lower in GIN metapage

Amit Langote <langote_amit_f8@lab.ntt.co.jp>

From: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
To: Michael Paquier <michael.paquier@gmail.com>, Tom Lane <tgl@sss.pgh.pa.us>
Cc: Masahiko Sawada <sawada.mshk@gmail.com>, Amit Kapila <amit.kapila16@gmail.com>, Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2017-09-07T01:42:20Z
Lists: pgsql-hackers
On 2017/09/07 8:51, Michael Paquier wrote:
> On Thu, Sep 7, 2017 at 5:49 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Amit Langote <Langote_Amit_f8@lab.ntt.co.jp> writes:
>>> On 2017/08/22 9:39, Michael Paquier wrote:
>>>> On Tue, Jun 27, 2017 at 4:56 PM, Amit Langote
>>>> <Langote_Amit_f8@lab.ntt.co.jp> wrote:
>>>>> I updated brin_mask() and spg_mask() in the attached updated patches so
>>>>> that they consider meta pages as containing unused space.
>>
>> I looked briefly at these patches.  I'm not sure that it's safe for the
>> mask functions to assume that meta pages always have valid pd_lower.
>> What happens when replaying log data concerning an old index that doesn't
>> have that field filled?
> 
> There will be inconsistency between the pages, and the masking check
> will complain. My point here is that wal_consistency_checking is
> primarily used by developers on newly-deployed clusters to check WAL
> consistency by using installcheck. So an upgraded cluster would see
> diffs because of that, but I would think that nobody would really face
> them.

I too tend to think that any users who use this masking facility would
know to expect to get these failures on upgraded clusters with invalid
pd_lower in meta pages.


(PS: I wonder if it is reasonable to allow configuring the error level
used when a masking failure occurs?  Currently, checkXLogConsistency()
will abort the process (FATAL))

> Perhaps we should document this point for wal_consistency_check?

Do you mean permanently under wal_consistency_check parameter
documentation or in the release notes under incompatibilities for the
affected index types?

Thanks,
Amit



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.