postgresql/src/backend/access
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
..
brin Set the metapage's pd_lower correctly in brin, gin, and spgist indexes. 2017-11-02 17:22:08 -04:00
common Replace remaining uses of pq_sendint with pq_sendint{8,16,32}. 2017-10-11 21:00:46 -07:00
gin Set the metapage's pd_lower correctly in brin, gin, and spgist indexes. 2017-11-02 17:22:08 -04:00
gist For wal_consistency_checking, mask page checksum as well as page LSN. 2017-09-22 14:28:22 -04:00
hash Remove lsn from HashScanPosData. 2017-09-26 09:16:45 -04:00
heap Revert bogus fixes of HOT-freezing bug 2017-11-02 15:51:41 +01:00
index Phase 3 of pgindent updates. 2017-06-21 15:35:54 -04:00
nbtree For wal_consistency_checking, mask page checksum as well as page LSN. 2017-09-22 14:28:22 -04:00
rmgrdesc Remove dedicated B-tree root-split record types. 2017-08-16 12:24:40 +03:00
spgist Set the metapage's pd_lower correctly in brin, gin, and spgist indexes. 2017-11-02 17:22:08 -04:00
tablesample Update copyright via script for 2017 2017-01-03 13:48:53 -05:00
transam Fix problems with the "role" GUC and parallel query. 2017-10-29 12:58:40 +05:30
Makefile TABLESAMPLE, SQL Standard and extensible 2015-05-15 14:37:10 -04:00