postgresql/src/backend
Heikki Linnakangas 990fe3c4ed Fix more issues with cascading replication and timeline switches.
When a standby server follows the master using WAL archive, and it chooses
a new timeline (recovery_target_timeline='latest'), it only fetches the
timeline history file for the chosen target timeline, not any other history
files that might be missing from pg_xlog. For example, if the current
timeline is 2, and we choose 4 as the new recovery target timeline, the
history file for timeline 3 is not fetched, even if it's part of this
server's history. That's enough for the standby itself - the history file
for timeline 4 includes timeline 3 as well - but if a cascading standby
server wants to recover to timeline 3, it needs the history file. To fix,
when a new recovery target timeline is chosen, try to copy any missing
history files from the archive to pg_xlog between the old and new target
timeline.

A second similar issue was with the WAL files. When a standby recovers from
archive, and it reaches a segment that contains a switch to a new timeline,
recovery fetches only the WAL file labelled with the new timeline's ID. The
file from the new timeline contains a copy of the WAL from the old timeline
up to the point where the switch happened, and recovery recovers it from the
new file. But in streaming replication, walsender only tries to read it
from the old timeline's file. To fix, change walsender to read it from the
new file, so that it behaves the same as recovery in that sense, and doesn't
try to open the possibly nonexistent file with the old timeline's ID.
2013-01-23 10:19:20 +02:00
..
access Fix more issues with cascading replication and timeline switches. 2013-01-23 10:19:20 +02:00
bootstrap Improve handling of ereport(ERROR) and elog(ERROR). 2013-01-13 18:40:09 -05:00
catalog Refactor ALTER some-obj RENAME implementation 2013-01-21 12:06:41 -03:00
commands Fix a few small bugs in yesterday's event trigger patch. 2013-01-22 21:37:01 -05:00
executor Fix obsolete SQL syntax in comment. 2013-01-14 15:48:12 -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 Add infrastructure for storing a VARIADIC ANY function's VARIADIC flag. 2013-01-21 20:26:15 -05:00
optimizer Add infrastructure for storing a VARIADIC ANY function's VARIADIC flag. 2013-01-21 20:26:15 -05:00
parser Add infrastructure for storing a VARIADIC ANY function's VARIADIC flag. 2013-01-21 20:26:15 -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 Fix more issues with cascading replication and timeline switches. 2013-01-23 10:19:20 +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 Unbreak lock conflict detection for Hot Standby. 2013-01-18 11:52:28 -05:00
tcop Add ddl_command_end support for event triggers. 2013-01-21 18:00:24 -05:00
tsearch Update copyrights for 2013 2013-01-01 17:15:01 -05:00
utils Add infrastructure for storing a VARIADIC ANY function's VARIADIC flag. 2013-01-21 20:26:15 -05:00
.gitignore Add gitignore for mingw/cygwin build outputs 2011-06-09 18:11:47 +02:00
Makefile Update copyrights for 2013 2013-01-01 17:15:01 -05:00
common.mk Call check_keywords.pl in maintainer-check 2012-02-27 13:53:12 +02:00
nls.mk Split out XLog reading as an independent facility 2013-01-16 16:12:53 -03:00