postgresql/src/backend
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
..
access Fix WAL-logging of FSM and VM truncation. 2016-10-19 14:26:05 +03:00
bootstrap Fix a bunch of places that called malloc and friends with no NULL check. 2016-08-30 18:22:43 -04:00
catalog Fix another bug in merging of inherited CHECK constraints. 2016-10-13 17:05:14 -04:00
commands Drop server support for FE/BE protocol version 1.0. 2016-10-11 12:19:18 -04:00
executor Use more efficient hashtable for execGrouping.c to speed up hash aggregation. 2016-10-14 17:22:51 -07:00
foreign Remove GetUserMappingId() and GetUserMappingById(). 2016-07-22 11:32:23 -04:00
lib Clarify the new Red-Black post-order traversal code a bit. 2016-09-04 15:02:06 +03:00
libpq Revert "Replace PostmasterRandom() with a stronger way of generating randomness." 2016-10-18 16:28:23 +03:00
main Repair a bit of pgindent damage. 2016-06-09 18:09:17 -04:00
nodes Use more efficient hashtable for tidbitmap.c to speed up bitmap scans. 2016-10-14 16:08:11 -07:00
optimizer Use more efficient hashtable for execGrouping.c to speed up hash aggregation. 2016-10-14 17:22:51 -07:00
parser Add ALTER EXTENSION ADD/DROP ACCESS METHOD, and use it in pg_upgrade. 2016-10-02 14:31:28 -04:00
po Translation updates 2016-08-08 11:08:00 -04:00
port Try to find out the actual hugepage size when making a MAP_HUGETLB request. 2016-10-13 15:06:46 -04:00
postmaster Revert "Replace PostmasterRandom() with a stronger way of generating randomness." 2016-10-18 16:28:23 +03:00
regex Make locale-dependent regex character classes work for large char codes. 2016-09-05 17:06:29 -04:00
replication libpqwalreceiver needs to link with libintl when using --enable-nls. 2016-10-07 21:12:25 -04:00
rewrite Improve parser's and planner's handling of set-returning functions. 2016-09-13 13:54:24 -04:00
snowball Update copyright for 2016 2016-01-02 13:33:40 -05:00
storage Fix WAL-logging of FSM and VM truncation. 2016-10-19 14:26:05 +03:00
tcop Drop server support for FE/BE protocol version 1.0. 2016-10-11 12:19:18 -04:00
tsearch Add macros to make AllocSetContextCreate() calls simpler and safer. 2016-08-27 17:50:38 -04:00
utils Fix cidin() to handle values above 2^31 platform-independently. 2016-10-18 12:24:46 -04:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
common.mk Remove maintainer-check target, fold into normal build 2013-10-10 20:11:56 -04:00
Makefile Refer to OS X as "macOS", except for the port name which is still "darwin". 2016-09-25 15:40:57 -04:00
nls.mk Remove trailing slashes from directories in find command 2015-09-18 22:06:54 -04:00