postgresql/src
Fujii Masao 09e96b3f35 Fix handling of files that source server removes during pg_rewind is running.
After processing the filemap to build the list of chunks that will be
fetched from the source to rewing the target server, it is possible that
a file which was previously processed is removed from the source.  A
simple example of such an occurence is a WAL segment which gets recycled
on the target in-between.  When the filemap is processed, files not
categorized as relation files are first truncated to prepare for its
full copy of which is going to be taken from the source, divided into a
set of junks.  However, for a recycled WAL segment, this would result in
a segment which has a zero-byte size.  With such an empty file,
post-rewind recovery thinks that records are saved but they are actually
not because of the truncation which happened when processing the
filemap, resulting in data loss.

In order to fix the problem, make sure that files which are found as
removed on the source when receiving chunks of them are as well deleted
on the target server for consistency.

Back-patch to 9.5 where pg_rewind was added.

Author: Tsunakawa Takayuki
Reviewed-by: Michael Paquier
Reported-by: Tsunakawa Takayuki

Discussion: https://postgr.es/m/0A3221C70F24FB45833433255569204D1F8DAAA2%40G01JPEXMBYT05
2018-03-29 04:00:21 +09:00
..
backend PL/pgSQL: Nested CALL with transactions 2018-03-28 13:31:27 -04:00
bin Fix handling of files that source server removes during pg_rewind is running. 2018-03-29 04:00:21 +09:00
common restrict -> pg_restrict 2018-03-15 10:02:59 -03:00
fe_utils Add \if support to pgbench 2018-03-22 17:42:03 +03:00
include PL/pgSQL: Nested CALL with transactions 2018-03-28 13:31:27 -04:00
interfaces libpq: PQhost to return active connected host or hostaddr 2018-03-27 12:32:18 -04:00
makefiles Always use -fPIC, not -fpic, when building shared libraries with gcc. 2017-06-01 13:32:55 -04:00
pl PL/pgSQL: Nested CALL with transactions 2018-03-28 13:31:27 -04:00
port Add an assertion that we don't pass NULL to snprintf("%s"). 2018-02-14 15:06:01 -05:00
template Force "restrict" not to be used when compiling with xlc. 2017-10-13 12:15:06 -07:00
test Make fast_default regression tests locale independent 2018-03-28 17:06:45 +10:30
timezone Update time zone data files to tzdata release 2018c. 2018-01-27 16:42:28 -05:00
tools Attempt to fix jsonb_plpython build on Windows 2018-03-28 11:49:23 -04:00
tutorial Update copyright for 2018 2018-01-02 23:30:12 -05:00
.gitignore
DEVELOPERS
Makefile Basic JIT provider and error handling infrastructure. 2018-03-21 19:28:28 -07:00
Makefile.global.in Support for optimizing and emitting code in LLVM JIT provider. 2018-03-22 11:05:22 -07:00
Makefile.shlib Fix make rules that generate multiple output files. 2018-03-23 13:46:00 -04:00
nls-global.mk nls-global.mk: search build dir for source files, too 2016-06-07 18:55:18 -04:00