postgresql/src/backend/access
Andres Freund e6799d5a53 Move page initialization from RelationAddExtraBlocks() to use.
Previously we initialized pages when bulk extending in
RelationAddExtraBlocks(). That has a major disadvantage: It ties
RelationAddExtraBlocks() to heap, as other types of storage are likely
to need different amounts of special space, have different amount of
free space (previously determined by PageGetHeapFreeSpace()).

That we're relying on initializing pages, but not WAL logging the
initialization, also means the risk for getting
"WARNING:  relation \"%s\" page %u is uninitialized --- fixing"
style warnings in vacuums after crashes/immediate shutdowns, is
considerably higher. The warning sounds much more serious than what
they are.

Fix those two issues together by not initializing pages in
RelationAddExtraPages() (but continue to do so in
RelationGetBufferForTuple(), which is linked much more closely to
heap), and accepting uninitialized pages as normal in
vacuumlazy.c. When vacuumlazy encounters an empty page it now adds it
to the FSM, but does nothing else.  We chose to not issue a debug
message, much less a warning in that case - it seems rarely useful,
and quite likely to scare people unnecessarily.

For now empty pages aren't added to the VM, because standbys would not
re-discover such pages after a promotion. In contrast to other sources
for empty pages, there's no corresponding WAL records triggering FSM
updates during replay.

Author: Andres Freund
Reviewed-By: Tom Lane
Discussion: https://postgr.es/m/20181219083945.6khtgm36mivonhva@alap3.anarazel.de
2019-01-28 13:15:11 -08:00
..
brin Revert "Avoid creation of the free space map for small heap relations." 2019-01-28 11:31:44 +05:30
common Simplify restriction handling of two-phase commit for temporary objects 2019-01-26 10:45:23 +09:00
gin Fix misc typos in comments. 2019-01-23 13:39:00 +02:00
gist Update copyright for 2019 2019-01-02 12:44:25 -05:00
hash Replace heapam.h includes with {table, relation}.h where applicable. 2019-01-21 10:51:37 -08:00
heap Move page initialization from RelationAddExtraBlocks() to use. 2019-01-28 13:15:11 -08:00
index Rename RelationData.rd_amroutine to rd_indam. 2019-01-21 17:36:55 -08:00
nbtree Move generic snapshot related code from tqual.h to snapmgr.h. 2019-01-21 17:06:41 -08:00
rmgrdesc Update copyright for 2019 2019-01-02 12:44:25 -05:00
spgist Move remaining code from tqual.[ch] to heapam.h / heapam_visibility.c. 2019-01-21 17:07:10 -08:00
table Introduce access/{table.h, relation.h}, for generic functions from heapam.h. 2019-01-21 10:51:36 -08:00
tablesample Don't include heapam.h from others headers. 2019-01-14 16:24:41 -08:00
transam Revert "Avoid creation of the free space map for small heap relations." 2019-01-28 11:31:44 +05:30
Makefile Introduce access/{table.h, relation.h}, for generic functions from heapam.h. 2019-01-21 10:51:36 -08:00