Re: Setting pd_lower in GIN metapage

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Michael Paquier <michael.paquier@gmail.com>
Cc: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>, Masahiko Sawada <sawada.mshk@gmail.com>, Amit Kapila <amit.kapila16@gmail.com>, Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2017-09-07T03:59:16Z
Lists: pgsql-hackers
Michael Paquier <michael.paquier@gmail.com> writes:
> On Thu, Sep 7, 2017 at 5:49 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> 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.

That doesn't seem like a pleasant outcome to me.  The WAL consistency
check code is supposed to complain if there's some kind of replication
or replay failure, and this cannot be categorized as either.

The idea I'd had was to apply the masking only if pd_lower >=
SizeOfPageHeaderData, or if you wanted to be stricter, only if
pd_lower != 0.

			regards, tom lane


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.