postgresql/src/include/access
Heikki Linnakangas 7b7521d657 Fix scenario where streaming standby gets stuck at a continuation record.
If a continuation record is split so that its first half has already been
removed from the master, and is only present in pg_wal, and there is a
recycled WAL segment in the standby server that looks like it would
contain the second half, recovery would get stuck. The code in
XLogPageRead() incorrectly started streaming at the beginning of the
WAL record, even if we had already read the first page.

Backpatch to 9.4. In principle, older versions have the same problem, but
without replication slots, there was no straightforward mechanism to
prevent the master from recycling old WAL that was still needed by standby.
Without such a mechanism, I think it's reasonable to assume that there's
enough slack in how many old segments are kept around to not run into this,
or you have a WAL archive.

Reported by Jonathon Nelson. Analysis and patch by Kyotaro HORIGUCHI, with
some extra comments by me.

Discussion: https://www.postgresql.org/message-id/CACJqAM3xVz0JY1XFDKPP%2BJoJAjoGx%3DGNuOAshEDWCext7BFvCQ%40mail.gmail.com
2018-05-05 01:35:12 +03:00
..
amapi.h Add SQL-accessible functions for inspecting index AM properties. 2016-08-13 18:31:14 -04:00
amvalidate.h Improve index AMs' opclass validation procedures. 2016-01-21 19:47:15 -05:00
attnum.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
brin.h Restructure index access method API to hide most of it at the C level. 2016-01-17 19:36:59 -05:00
brin_internal.h Restructure index access method API to hide most of it at the C level. 2016-01-17 19:36:59 -05:00
brin_page.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
brin_pageops.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
brin_revmap.h Add the "snapshot too old" feature 2016-04-08 14:36:30 -05:00
brin_tuple.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
brin_xlog.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
clog.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
commit_ts.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
genam.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
generic_xlog.h Improve API of GenericXLogRegister(). 2016-04-12 11:42:06 -04:00
gin.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
gin_private.h Fix broken cleanup interlock for GIN pending list. 2017-11-16 15:26:49 -05:00
gist.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
gist_private.h Fix outdated comments, GIST search queue is not an RBTree anymore. 2016-09-20 11:40:13 +03:00
gistscan.h Restructure index access method API to hide most of it at the C level. 2016-01-17 19:36:59 -05:00
hash.h Fix building of large (bigger than shared_buffers) hash indexes. 2016-06-24 16:57:36 -04:00
heapam.h Perform a lot more sanity checks when freezing tuples. 2017-12-14 18:20:48 -08:00
heapam_xlog.h Perform a lot more sanity checks when freezing tuples. 2017-12-14 18:20:48 -08:00
hio.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
htup.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
htup_details.h Change some test macros to return true booleans 2017-01-18 18:06:13 -03:00
itup.h Revert CREATE INDEX ... INCLUDING ... 2016-04-08 21:52:13 +03:00
multixact.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
nbtree.h Add SQL-accessible functions for inspecting index AM properties. 2016-08-13 18:31:14 -04:00
parallel.h Report an ERROR if a parallel worker fails to start properly. 2018-01-23 11:13:50 -05:00
printtup.h Stop the executor if no more tuples can be sent from worker to leader. 2016-06-06 14:52:58 -04:00
reloptions.h Restructure index access method API to hide most of it at the C level. 2016-01-17 19:36:59 -05:00
relscan.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
rewriteheap.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
rmgr.h Add rmgr callback to name xlog record types for display purposes. 2014-09-19 16:20:29 +02:00
rmgrlist.h Generic Messages for Logical Decoding 2016-04-06 10:05:41 +01:00
sdir.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
skey.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
slru.h Make all built-in lwlock tranche IDs fixed. 2016-02-02 06:45:55 -05:00
spgist.h Introduce traversalValue for SP-GiST scan 2016-03-30 18:29:28 +03:00
spgist_private.h Prevent query-lifespan memory leakage of SP-GiST traversal values. 2018-03-19 23:59:17 -04:00
stratnum.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
subtrans.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
sysattr.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
timeline.h pgindent run for 9.6 2016-06-09 18:02:36 -04:00
transam.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
tsmapi.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
tupconvert.h Fix ALTER TABLE / SET TYPE for irregular inheritance 2017-01-09 19:26:58 -03:00
tupdesc.h Backpatch introduction of TupleDescAttr(tupdesc, i). 2017-08-22 07:47:42 -07:00
tupmacs.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
tuptoaster.h Fix deletion of speculatively inserted TOAST on conflict 2016-08-17 17:03:36 -07:00
twophase.h Mark assorted variables PGDLLIMPORT. 2017-12-05 09:27:20 -05:00
twophase_rmgr.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
valid.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
visibilitymap.h Fix typos in comments. 2017-02-06 11:34:15 +02:00
xact.h Fix typos in comments. 2017-02-06 11:34:15 +02:00
xlog.h Fix backup canceling 2017-03-24 13:55:02 +03:00
xlog_fn.h Implement backup API functions for non-exclusive backups 2016-04-05 20:03:49 +02:00
xlog_internal.h Fix comment. 2017-08-01 08:08:32 +09:00
xlogdefs.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
xloginsert.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
xlogreader.h Fix scenario where streaming standby gets stuck at a continuation record. 2018-05-05 01:35:12 +03:00
xlogrecord.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
xlogutils.h XLogReader general code cleanup 2016-03-30 18:56:13 -03:00