postgresql/src
Fujii Masao f1e07d5763 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:01:43 +09:00
..
backend Fix actual and potential double-frees around tuplesort usage. 2018-03-28 13:26:43 -04:00
bin Fix handling of files that source server removes during pg_rewind is running. 2018-03-29 04:01:43 +09:00
common Update copyright in recently added files 2017-07-26 18:17:18 -04:00
fe_utils Empty search_path in Autovacuum and non-psql/pgbench clients. 2018-02-26 07:39:47 -08:00
include Fix mishandling of quoted-list GUC values in pg_dump and ruleutils.c. 2018-03-21 20:03:28 -04:00
interfaces Fix make rules that generate multiple output files. 2018-03-23 13:45:38 -04:00
makefiles Always use -fPIC, not -fpic, when building shared libraries with gcc. 2017-06-01 13:32:55 -04:00
pl Fix make rules that generate multiple output files. 2018-03-23 13:45:38 -04:00
port Stamp 10.3. 2018-02-26 17:10:47 -05:00
template Remove "sco" and "unixware" ports. 2016-10-11 11:26:04 -04:00
test Fix make rules that generate multiple output files. 2018-03-23 13:45:38 -04:00
timezone Update time zone data files to tzdata release 2018c. 2018-01-27 16:42:36 -05:00
tools Fix up ecpg's configuration so it handles "long long int" in MSVC builds. 2018-02-27 16:46:52 -05:00
tutorial Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +02:00
DEVELOPERS Replace a couple of references to files that no longer exist in the source 2009-05-04 08:08:47 +00:00
Makefile Build src/test/isolation during "make" and "make install". 2017-11-22 20:18:52 -08:00
Makefile.global.in Be more thorough about cleaning out gcov litter. 2017-08-11 17:39:27 -04:00
Makefile.shlib Fix make rules that generate multiple output files. 2018-03-23 13:45:38 -04:00
nls-global.mk nls-global.mk: search build dir for source files, too 2016-06-07 18:55:18 -04:00