From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@postgresql.org
Subject: pgsql: Set the metapage's pd_lower correctly in brin, gin, and spgist i
Date: Thu, 02 Nov 2017 21:22:17 +0000
Message-ID: <E1eAMwL-0005IL-Fr@gemulon.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>
Set the metapage's pd_lower correctly in brin, gin, and spgist indexes.
Previously, these index types left the pd_lower field set to the default
SizeOfPageHeaderData, which is really a lie because it ought to point past
whatever space is being used for metadata. The coding accidentally failed
to fail because we never told xlog.c that the metapage is of standard
format --- but that's not very good, because it impedes WAL consistency
checking, and in some cases prevents compression of full-page images.
To fix, ensure that we set pd_lower correctly, not only when creating a
metapage but whenever we write it out (these apparently redundant steps are
needed to cope with pg_upgrade'd indexes that don't yet contain the right
value). This allows telling xlog.c that the page is of standard format.
The WAL consistency check mask functions are made to mask only if pd_lower
appears valid, which I think is likely unnecessary complication, since
any metapage appearing in a v11 WAL stream should contain valid pd_lower.
But it doesn't cost much to be paranoid.
Amit Langote, reviewed by Michael Paquier and Amit Kapila
Discussion: https://postgr.es/m/0d273805-0e9e-ec1a-cb84-d4da400b8f85@lab.ntt.co.jp
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/81e334ce4e6d687d548e60ad8954b7dfd9e568a2
Modified Files
--------------
src/backend/access/brin/brin.c | 4 ++--
src/backend/access/brin/brin_pageops.c | 10 +++++++++-
src/backend/access/brin/brin_revmap.c | 15 +++++++++++++--
src/backend/access/brin/brin_xlog.c | 21 +++++++++++++++++++--
src/backend/access/gin/ginfast.c | 26 +++++++++++++++++++++++---
src/backend/access/gin/gininsert.c | 4 ++--
src/backend/access/gin/ginutil.c | 20 +++++++++++++++++++-
src/backend/access/gin/ginxlog.c | 25 ++++++++++---------------
src/backend/access/spgist/spginsert.c | 4 ++--
src/backend/access/spgist/spgutils.c | 24 ++++++++++++++++++++++--
src/backend/access/spgist/spgxlog.c | 7 ++++---
11 files changed, 125 insertions(+), 35 deletions(-)
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us
Subject: Re: pgsql: Set the metapage's pd_lower correctly in brin, gin, and spgist i
In-Reply-To: <E1eAMwL-0005IL-Fr@gemulon.postgresql.org>
References: <E1eAMwL-0005IL-Fr@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox