postgresql/src/include
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 Cosmetic improvement: use BKI_DEFAULT and BKI_LOOKUP in pg_language. 2018-04-29 13:26:26 -04:00
commands 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
datatype Update copyright for 2018 2018-01-02 23:30:12 -05:00
executor Fix SPI error cleanup and memory leak 2018-05-03 08:39:15 -04:00
fe_utils Post-feature-freeze pgindent run. 2018-04-26 14:47:16 -04:00
foreign Allow insert and update tuple routing and COPY for foreign tables. 2018-04-06 19:22:03 -04:00
jit Make PGJIT_* macros safer. 2018-04-23 04:48:08 -04:00
lib Fix a boatload of typos in C comments. 2018-04-01 15:01:28 -04:00
libpq Post-feature-freeze pgindent run. 2018-04-26 14:47:16 -04:00
mb Fix a boatload of typos in C comments. 2018-04-01 15:01:28 -04:00
nodes Post-feature-freeze pgindent run. 2018-04-26 14:47:16 -04:00
optimizer Post-feature-freeze pgindent run. 2018-04-26 14:47:16 -04:00
parser Post-feature-freeze pgindent run. 2018-04-26 14:47:16 -04:00
partitioning Initialize ExprStates once in run-time partition pruning 2018-04-24 14:03:10 -03:00
port Remove overzeleous assertions in pg_atomic_flag code. 2018-04-07 18:30:15 -07:00
portability Update copyright for 2018 2018-01-02 23:30:12 -05:00
postmaster Add comment explaining BGWORKER_BYPASS_ALLOWCONN 2018-04-23 10:31:22 +02:00
regex Update copyright for 2018 2018-01-02 23:30:12 -05:00
replication Post-feature-freeze pgindent run. 2018-04-26 14:47:16 -04:00
rewrite Revert MERGE patch 2018-04-12 11:22:56 +01:00
snowball Update copyright for 2018 2018-01-02 23:30:12 -05:00
statistics Update copyright for 2018 2018-01-02 23:30:12 -05:00
storage Fix some sloppiness in the new BufFileSize() and BufFileAppend() functions. 2018-05-02 17:23:13 +03:00
tcop Post-feature-freeze pgindent run. 2018-04-26 14:47:16 -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 Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
c.h Fix interaction of Perl and stdbool.h 2018-03-23 10:31:10 -04:00
fmgr.h Add expression compilation support to LLVM JIT provider. 2018-03-22 14:45:59 -07:00
funcapi.h Support INOUT arguments in procedures 2018-03-14 12:07:28 -04:00
getaddrinfo.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
getopt_long.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
Makefile Rearrange makefile rules for running Gen_fmgrtab.pl. 2018-05-03 17:54:18 -04:00
miscadmin.h Allow group access on PGDATA 2018-04-07 17:45:39 -04:00
pg_config_ext.h.in Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
pg_config_ext.h.win32 Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
pg_config_manual.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
pg_config.h.in Improve our method for probing the availability of ARM CRC instructions. 2018-05-02 18:06:43 -04:00
pg_config.h.win32 Change SIZEOF_BOOL to 1 for Windows. 2018-05-02 00:21:21 -04:00
pg_getopt.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
pg_trace.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
pgstat.h Revert "Allow on-line enabling and disabling of data checksums" 2018-04-09 19:03:42 +02:00
pgtar.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
pgtime.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
port.h Fix a boatload of typos in C comments. 2018-04-01 15:01:28 -04:00
postgres_ext.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
postgres_fe.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
postgres.h Move the extern declaration for ExceptionalCondition into c.h. 2018-02-14 19:43:33 -05:00
rusagestub.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
windowapi.h Update copyright for 2018 2018-01-02 23:30:12 -05:00