postgresql/src/backend
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
..
access Fix scenario where streaming standby gets stuck at a continuation record. 2018-05-05 01:34:53 +03:00
bootstrap Rationalize handling of array type names in bootstrap data. 2018-04-17 18:29:11 -04:00
catalog Fix precedence problem in new Perl code. 2018-05-04 09:46:35 -04:00
commands Clean up warnings from -Wimplicit-fallthrough. 2018-05-01 19:35:08 -04:00
executor Fix SPI error cleanup and memory leak 2018-05-03 08:39:15 -04:00
foreign Remove bogus "extern" annotations on function definitions. 2018-02-19 12:07:44 -05:00
jit Further -Wimplicit-fallthrough cleanup. 2018-05-01 19:53:48 -07:00
lib Post-feature-freeze pgindent run. 2018-04-26 14:47:16 -04:00
libpq Post-feature-freeze pgindent run. 2018-04-26 14:47:16 -04:00
main
nodes Fix incorrect field type for PlannedStmt.jitFlags in outfuncs/readfuncs. 2018-04-28 16:46:24 -04:00
optimizer Post-feature-freeze pgindent run. 2018-04-26 14:47:16 -04:00
parser Clean up warnings from -Wimplicit-fallthrough. 2018-05-01 19:35:08 -04:00
partitioning Post-feature-freeze pgindent run. 2018-04-26 14:47:16 -04:00
po
port Remove investigative code for can't-reattach-to-shared-memory errors. 2018-05-01 13:06:31 -04:00
postmaster Further improve code for probing the availability of ARM CRC instructions. 2018-05-03 11:32:57 -04:00
regex Clean up warnings from -Wimplicit-fallthrough. 2018-05-01 19:35:08 -04:00
replication Fix some assorted compiler warnings on Windows. 2018-05-01 19:38:26 -04:00
rewrite Simplify view-expansion code in rewriteHandler.c. 2018-04-14 21:01:03 -04:00
snowball
statistics Fix bogus code for extracting extended-statistics data from syscache. 2018-05-02 12:23:00 -04:00
storage Re-think predicate locking on GIN indexes. 2018-05-04 11:27:50 +03:00
tcop Fix SPI error cleanup and memory leak 2018-05-03 08:39:15 -04:00
tsearch Post-feature-freeze pgindent run. 2018-04-26 14:47:16 -04:00
utils Rearrange makefile rules for running Gen_fmgrtab.pl. 2018-05-03 17:54:18 -04:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
common.mk Remove PARTIAL_LINKING build mode. 2018-03-30 17:33:04 -07:00
Makefile Rearrange makefile rules for running Gen_fmgrtab.pl. 2018-05-03 17:54:18 -04:00
nls.mk Translation updates 2017-05-15 12:19:54 -04:00