postgresql/src/backend
Heikki Linnakangas b0daba57bb Tolerate timeline switches while "pg_basebackup -X fetch" is running.
If you take a base backup from a standby server with "pg_basebackup -X
fetch", and the timeline switches while the backup is being taken, the
backup used to fail with an error "requested WAL segment %s has already
been removed". This is because the server-side code that sends over the
required WAL files would not construct the WAL filename with the correct
timeline after a switch.

Fix that by using readdir() to scan pg_xlog for all the WAL segments in the
range, regardless of timeline.

Also, include all timeline history files in the backup, if taken with
"-X fetch". That fixes another related bug: If a timeline switch happened
just before the backup was initiated in a standby, the WAL segment
containing the initial checkpoint record contains WAL from the older
timeline too. Recovery will not accept that without a timeline history file
that lists the older timeline.

Backpatch to 9.2. Versions prior to that were not affected as you could not
take a base backup from a standby before 9.2.
2013-01-03 19:51:00 +02:00
..
access Tolerate timeline switches while "pg_basebackup -X fetch" is running. 2013-01-03 19:51:00 +02:00
bootstrap Fix IsUnderPostmaster/EXEC_BACKEND confusion 2013-01-02 18:39:20 -03:00
catalog Update copyrights for 2013 2013-01-01 17:15:01 -05:00
commands Update copyrights for 2013 2013-01-01 17:15:01 -05:00
executor Update copyrights for 2013 2013-01-01 17:15:01 -05:00
foreign Update copyrights for 2013 2013-01-01 17:15:01 -05:00
lib Update copyrights for 2013 2013-01-01 17:15:01 -05:00
libpq Update copyrights for 2013 2013-01-01 17:15:01 -05:00
main Update copyrights for 2013 2013-01-01 17:15:01 -05:00
nodes Update copyrights for 2013 2013-01-01 17:15:01 -05:00
optimizer Update copyrights for 2013 2013-01-01 17:15:01 -05:00
parser Update copyrights for 2013 2013-01-01 17:15:01 -05:00
po Translation updates 2011-08-17 14:07:46 +03:00
port Update copyrights for 2013 2013-01-01 17:15:01 -05:00
postmaster Make sure MaxBackends is always set 2013-01-02 14:39:11 -03:00
regex Update copyrights for 2013 2013-01-01 17:15:01 -05:00
replication Tolerate timeline switches while "pg_basebackup -X fetch" is running. 2013-01-03 19:51:00 +02:00
rewrite Update copyrights for 2013 2013-01-01 17:15:01 -05:00
snowball Update copyrights for 2013 2013-01-01 17:15:01 -05:00
storage Update copyrights for 2013 2013-01-01 17:15:01 -05:00
tcop Fix IsUnderPostmaster/EXEC_BACKEND confusion 2013-01-02 18:39:20 -03:00
tsearch Update copyrights for 2013 2013-01-01 17:15:01 -05:00
utils Fix IsUnderPostmaster/EXEC_BACKEND confusion 2013-01-02 18:39:20 -03:00
.gitignore Add gitignore for mingw/cygwin build outputs 2011-06-09 18:11:47 +02:00
common.mk Call check_keywords.pl in maintainer-check 2012-02-27 13:53:12 +02:00
Makefile Update copyrights for 2013 2013-01-01 17:15:01 -05:00
nls.mk Sort file list when creating gettext-files 2011-12-27 20:20:56 +02:00