postgresql/src/backend/access
Heikki Linnakangas 81c4508196 Fix race condition between hot standby and restoring a full-page image.
There was a window in RestoreBackupBlock where a page would be zeroed out,
but not yet locked. If a backend pinned and locked the page in that window,
it saw the zeroed page instead of the old page or new page contents, which
could lead to missing rows in a result set, or errors.

To fix, replace RBM_ZERO with RBM_ZERO_AND_LOCK, which atomically pins,
zeroes, and locks the page, if it's not in the buffer cache already.

In stable branches, the old RBM_ZERO constant is renamed to RBM_DO_NOT_USE,
to avoid breaking any 3rd party extensions that might use RBM_ZERO. More
importantly, this avoids renumbering the other enum values, which would
cause even bigger confusion in extensions that use ReadBufferExtended, but
haven't been recompiled.

Backpatch to all supported versions; this has been racy since hot standby
was introduced.
2014-11-13 20:02:37 +02:00
..
brin BRIN: fix bug in xlog backup block counting 2014-11-10 18:13:49 -03:00
common Rename pending_list_cleanup_size to gin_pending_list_limit. 2014-11-13 12:14:48 +09:00
gin Rename pending_list_cleanup_size to gin_pending_list_limit. 2014-11-13 12:14:48 +09:00
gist Remove obsolete cases from GiST update redo code. 2014-11-07 15:13:02 +02:00
hash Fix race condition between hot standby and restoring a full-page image. 2014-11-13 20:02:37 +02:00
heap Fix race condition between hot standby and restoring a full-page image. 2014-11-13 20:02:37 +02:00
index Split builtins.h to a new header ruleutils.h 2014-10-08 18:10:47 -03:00
nbtree Use the sortsupport infrastructure in more cases. 2014-11-07 15:50:55 -05:00
rmgrdesc Fix some coding issues in BRIN 2014-11-08 00:31:03 -03:00
spgist Fix generation of SP-GiST vacuum WAL records. 2014-11-07 21:17:46 +02:00
transam Fix race condition between hot standby and restoring a full-page image. 2014-11-13 20:02:37 +02:00
Makefile BRIN: Block Range Indexes 2014-11-07 16:38:14 -03:00