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>
Cc: Masahiko Sawada <sawada.mshk@gmail.com>,
Amit Kapila <amit.kapila16@gmail.com>, Tom Lane <tgl@sss.pgh.pa.us>,
Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2017-06-26T06:54:07Z
Lists: pgsql-hackers
Attachments
- 0001-Set-pd_lower-correctly-in-the-GIN-metapage.patch (text/plain) patch 0001
- 0002-Set-pd_lower-correctly-in-the-BRIN-index-metapage.patch (text/plain) patch 0002
- 0003-Set-pd_lower-correctly-in-the-SP-GiST-index-metapage.patch (text/plain) patch 0003
On 2017/06/26 10:54, Michael Paquier wrote: > On Fri, Jun 23, 2017 at 11:17 AM, Amit Langote > <Langote_Amit_f8@lab.ntt.co.jp> wrote: >> That was it, thanks for the pointer. > > GinInitMetabuffer() sets up pd_lower and pd_upper anyway using > PageInit so the check of PageIsVerified is guaranteed to work in any > case. Upgraded pages will still have their pd_lower set to the > previous values, and new pages will have the optimization. So this > patch is actually harmless for past pages, while newer ones are seen > as more compressible. Right. >> Attached updated patch, which I confirmed, passes wal_consistency_check = gin. > > I have spent some time looking at this patch, playing with pg_upgrade > to check the state of the page upgraded. And this looks good to me. Thanks for the review. > One thing that I noticed is that this optimization could as well > happen for spgist meta pages. What do others think? I agree. As Sawada-san mentioned, brin metapage code can use a similar patch. So attached are three patches for gin, brin, and sp-gist respectively. Both brin and sp-gist cases didn't require any special consideration for passing wal_consistency_checking, as the patch didn't cause brin and sp-gist metapages to become invalid when recreated on standby (remember that patch 0001 needed to be updated for that). Thanks, Amit
Commits
-
Flag index metapages as standard-format in xlog.c calls.
- 4c11d2c559e7 11.0 landed
-
Set the metapage's pd_lower correctly in brin, gin, and spgist indexes.
- 81e334ce4e6d 11.0 landed