postgresql/src/backend
Tom Lane 81e334ce4e 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
2017-11-02 17:22:08 -04:00
..
access Set the metapage's pd_lower correctly in brin, gin, and spgist indexes. 2017-11-02 17:22:08 -04:00
bootstrap Exclude flex-generated code from coverage testing 2017-10-16 16:28:11 -04:00
catalog Fix typo in comment 2017-10-30 14:37:00 +01:00
commands Revert bogus fixes of HOT-freezing bug 2017-11-02 15:51:41 +01:00
executor Revert bogus fixes of HOT-freezing bug 2017-11-02 15:51:41 +01:00
foreign Abstract logic to allow for multiple kinds of child rels. 2017-04-03 22:41:31 -04:00
lib Allow to avoid NUL-byte management for stringinfos and use in format.c. 2017-10-11 16:01:52 -07:00
libpq Fix typo 2017-10-19 13:57:20 +02:00
main Change pg_ctl to detect server-ready by watching status in postmaster.pid. 2017-06-28 17:31:32 -04:00
nodes Support domains over composite types. 2017-10-26 13:47:45 -04:00
optimizer Teach planner to account for HAVING quals in aggregation plan nodes. 2017-11-02 11:24:12 -04:00
parser Dept of second thoughts: keep aliasp_item in sync with tlistitem. 2017-10-27 18:16:24 -04:00
po Translation updates 2017-08-07 13:55:34 -04:00
port Change pg_ctl to detect server-ready by watching status in postmaster.pid. 2017-06-28 17:31:32 -04:00
postmaster Fix autovacuum work item error handling 2017-10-30 15:52:02 +01:00
regex Mop-up for commit 85feb77aa0. 2017-09-22 11:35:12 -04:00
replication Exclude flex-generated code from coverage testing 2017-10-16 16:28:11 -04:00
rewrite Improve implementation of CRE-stack-flattening in map_variable_attnos(). 2017-10-13 13:43:55 -04:00
snowball Initial pgindent run with pg_bsd_indent version 2.0. 2017-06-21 14:39:04 -04:00
statistics Infer functional dependency past RelabelType 2017-10-12 17:23:47 +02:00
storage Don't exaggerate the number of temporary blocks read. 2017-10-31 14:56:09 +05:30
tcop Replace remaining uses of pq_sendint with pq_sendint{8,16,32}. 2017-10-11 21:00:46 -07:00
tsearch Mop-up for commit 85feb77aa0. 2017-09-22 11:35:12 -04:00
utils Fix ALTER TABLE code to update domain constraints when needed. 2017-11-01 13:32:23 -04:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
Makefile Inject $(ICU_LIBS) regardless of platform. 2017-08-20 21:22:18 -07:00
common.mk Add ICU_CFLAGS to global CPPFLAGS 2017-06-12 15:57:22 -04:00
nls.mk Translation updates 2017-05-15 12:19:54 -04:00