diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2014-11-13 19:47:44 +0200 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2014-11-13 20:02:09 +0200 |
commit | 8fc23a9ed0a040d039431ef79b1bf166395ed180 (patch) | |
tree | 8e9b0b6fba1a54727dc186c831b0f615224f3fe4 /contrib/postgres_fdw/postgres_fdw.c | |
parent | 955b4ba7f6948359efcef1c47035d382f937e9f3 (diff) | |
download | postgresql-8fc23a9ed0a040d039431ef79b1bf166395ed180.tar.gz postgresql-8fc23a9ed0a040d039431ef79b1bf166395ed180.zip |
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.
Diffstat (limited to 'contrib/postgres_fdw/postgres_fdw.c')
0 files changed, 0 insertions, 0 deletions