postgresql/src/backend/access
Heikki Linnakangas 917dc7d239 Fix WAL-logging of FSM and VM truncation.
When a relation is truncated, it is important that the FSM is truncated as
well. Otherwise, after recovery, the FSM can return a page that has been
truncated away, leading to errors like:

ERROR:  could not read block 28991 in file "base/16390/572026": read only 0
of 8192 bytes

We were using MarkBufferDirtyHint() to dirty the buffer holding the last
remaining page of the FSM, but during recovery, that might in fact not
dirty the page, and the FSM update might be lost.

To fix, use the stronger MarkBufferDirty() function. MarkBufferDirty()
requires us to do WAL-logging ourselves, to protect from a torn page, if
checksumming is enabled.

Also fix an oversight in visibilitymap_truncate: it also needs to WAL-log
when checksumming is enabled.

Analysis by Pavan Deolasee.

Discussion: <CABOikdNr5vKucqyZH9s1Mh0XebLs_jRhKv6eJfNnD2wxTn=_9A@mail.gmail.com>
2016-10-19 14:26:05 +03:00
..
brin Rewrite PageIndexDeleteNoCompact into a form that only deletes 1 tuple. 2016-09-09 19:00:59 -04:00
common Drop server support for FE/BE protocol version 1.0. 2016-10-11 12:19:18 -04:00
gin Replace the built-in GIN array opclasses with a single polymorphic opclass. 2016-09-26 14:52:44 -04:00
gist Fix outdated comments, GIST search queue is not an RBTree anymore. 2016-09-20 11:38:25 +03:00
hash Remove unnecessary int2vector-specific hash function and equality operator. 2016-10-12 14:54:08 -04:00
heap Fix WAL-logging of FSM and VM truncation. 2016-10-19 14:26:05 +03:00
index Add SQL-accessible functions for inspecting index AM properties. 2016-08-13 18:31:14 -04:00
nbtree Add macros to make AllocSetContextCreate() calls simpler and safer. 2016-08-27 17:50:38 -04:00
rmgrdesc Remove useless code. 2016-09-23 10:44:50 -04:00
spgist Add macros to make AllocSetContextCreate() calls simpler and safer. 2016-08-27 17:50:38 -04:00
tablesample Update copyright for 2016 2016-01-02 13:33:40 -05:00
transam Extend framework from commit 53be0b1ad to report latch waits. 2016-10-04 11:01:42 -04:00
Makefile TABLESAMPLE, SQL Standard and extensible 2015-05-15 14:37:10 -04:00