postgresql/src/backend/access
Heikki Linnakangas 0668719801 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:34:53 +03:00
..
brin Post-feature-freeze pgindent run. 2018-04-26 14:47:16 -04:00
common Post-feature-freeze pgindent run. 2018-04-26 14:47:16 -04:00
gin Re-think predicate locking on GIN indexes. 2018-05-04 11:27:50 +03:00
gist Re-think predicate locking on GIN indexes. 2018-05-04 11:27:50 +03:00
hash Clean up warnings from -Wimplicit-fallthrough. 2018-05-01 19:35:08 -04:00
heap Don't mark pages all-visible spuriously 2018-05-04 18:24:45 -03:00
index Further cleanup of client dependencies on src/include/catalog headers. 2018-04-09 14:39:58 -04:00
nbtree Don't truncate away non-key attributes for leftmost downlinks. 2018-05-04 12:38:23 +03:00
rmgrdesc Handle XLOG_BTREE_META_CLEANUP in btree_desc() and btree_identify() 2018-04-19 09:27:56 +03:00
spgist Post-feature-freeze pgindent run. 2018-04-26 14:47:16 -04:00
tablesample Update copyright for 2018 2018-01-02 23:30:12 -05:00
transam Fix scenario where streaming standby gets stuck at a continuation record. 2018-05-05 01:34:53 +03:00
Makefile TABLESAMPLE, SQL Standard and extensible 2015-05-15 14:37:10 -04:00