postgresql/src/include/storage
Heikki Linnakangas 681dbe7d45 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:00:51 +02:00
..
backendid.h Update copyright for the year 2010. 2010-01-02 16:58:17 +00:00
block.h Remove tabs after spaces in C comments 2014-05-06 11:26:25 -04:00
buf.h Update copyright for the year 2010. 2010-01-02 16:58:17 +00:00
buf_internals.h Remove tabs after spaces in C comments 2014-05-06 11:26:25 -04:00
buffile.h Update copyright for the year 2010. 2010-01-02 16:58:17 +00:00
bufmgr.h Fix race condition between hot standby and restoring a full-page image. 2014-11-13 20:00:51 +02:00
bufpage.h Remove tabs after spaces in C comments 2014-05-06 11:26:25 -04:00
fd.h pgindent run for 9.0 2010-02-26 02:01:40 +00:00
freespace.h Update copyright for the year 2010. 2010-01-02 16:58:17 +00:00
fsm_internals.h Update copyright for the year 2010. 2010-01-02 16:58:17 +00:00
indexfsm.h Update copyright for the year 2010. 2010-01-02 16:58:17 +00:00
ipc.h Remove tabs after spaces in C comments 2014-05-06 11:26:25 -04:00
item.h Update copyright for the year 2010. 2010-01-02 16:58:17 +00:00
itemid.h Remove tabs after spaces in C comments 2014-05-06 11:26:25 -04:00
itemptr.h Remove tabs after spaces in C comments 2014-05-06 11:26:25 -04:00
large_object.h Update copyright for the year 2010. 2010-01-02 16:58:17 +00:00
lmgr.h Fix performance problems with autovacuum truncation in busy workloads. 2013-01-23 13:40:19 -06:00
lock.h Remove tabs after spaces in C comments 2014-05-06 11:26:25 -04:00
lwlock.h pgindent run for 9.0 2010-02-26 02:01:40 +00:00
off.h Update copyright for the year 2010. 2010-01-02 16:58:17 +00:00
pg_sema.h Remove tabs after spaces in C comments 2014-05-06 11:26:25 -04:00
pg_shmem.h Remove tabs after spaces in C comments 2014-05-06 11:26:25 -04:00
pmsignal.h Marginal code cleanup for streaming replication. 2010-08-23 17:20:08 +00:00
pos.h Remove tabs after spaces in C comments 2014-05-06 11:26:25 -04:00
proc.h Remove tabs after spaces in C comments 2014-05-06 11:26:25 -04:00
procarray.h Ensure no xid gaps during Hot Standby startup 2013-06-23 14:50:38 +01:00
procsignal.h pgindent run for 9.0 2010-02-26 02:01:40 +00:00
relfilenode.h Remove tabs after spaces in C comments 2014-05-06 11:26:25 -04:00
s_lock.h Fix typo in solaris spinlock fix. 2014-09-09 23:48:08 +02:00
shmem.h Update copyright for the year 2010. 2010-01-02 16:58:17 +00:00
sinval.h pgindent run for 9.0 2010-02-26 02:01:40 +00:00
sinvaladt.h Remove tabs after spaces in C comments 2014-05-06 11:26:25 -04:00
smgr.h Remove tabs after spaces in C comments 2014-05-06 11:26:25 -04:00
spin.h Update copyright for the year 2010. 2010-01-02 16:58:17 +00:00
standby.h Don't advance checkPoint.nextXid near the end of a checkpoint sequence. 2012-12-02 15:20:15 -05:00