postgresql/src
Heikki Linnakangas c4c227477b Fix bugs in cascading replication with recovery_target_timeline='latest'
The cascading replication code assumed that the current RecoveryTargetTLI
never changes, but that's not true with recovery_target_timeline='latest'.
The obvious upshot of that is that RecoveryTargetTLI in shared memory needs
to be protected by a lock. A less obvious consequence is that when a
cascading standby is connected, and the standby switches to a new target
timeline after scanning the archive, it will continue to stream WAL to the
cascading standby, but from a wrong file, ie. the file of the previous
timeline. For example, if the standby is currently streaming from the middle
of file 000000010000000000000005, and the timeline changes, the standby
will continue to stream from that file. However, the WAL on the new
timeline is in file 000000020000000000000005, so the standby sends garbage
from 000000010000000000000005 to the cascading standby, instead of the
correct WAL from file 000000020000000000000005.

This also fixes a related bug where a partial WAL segment is restored from
the archive and streamed to a cascading standby. The code assumed that when
a WAL segment is copied from the archive, it can immediately be fully
streamed to a cascading standby. However, if the segment is only partially
filled, ie. has the right size, but only N first bytes contain valid WAL,
that's not safe. That can happen if a partial WAL segment is manually copied
to the archive, or if a partial WAL segment is archived because a server is
started up on a new timeline within that segment. The cascading standby will
get confused if the WAL it received is not valid, and will get stuck until
it's restarted. This patch fixes that problem by not allowing WAL restored
from the archive to be streamed to a cascading standby until it's been
replayed, and thus validated.
2012-09-04 19:33:21 -07:00
..
backend Fix bugs in cascading replication with recovery_target_timeline='latest' 2012-09-04 19:33:21 -07:00
bin Change "restoring" to "processing" in message from pg_dump 2012-09-04 15:00:04 +02:00
include Fix bugs in cascading replication with recovery_target_timeline='latest' 2012-09-04 19:33:21 -07:00
interfaces libpq: Fix memory leak in URI parser 2012-08-23 22:33:04 -04:00
makefiles Remove BSD/OS (BSDi) port. There are no known users upgrading to 2012-05-03 10:58:44 -04:00
pl Split tuple struct defs from htup.h to htup_details.h 2012-08-30 16:52:35 -04:00
port Add strerror() string to chdir() error message 2012-08-28 23:01:23 -04:00
template Remove BSD/OS (BSDi) port. There are no known users upgrading to 2012-05-03 10:58:44 -04:00
test Fix serializable mode with index-only scans. 2012-09-04 21:13:11 -05:00
timezone Update time zone data files to tzdata release 2012e. 2012-08-14 10:54:24 -04:00
tools Remove src/tool/backend, now that the content is on the web site and wiki. 2012-09-04 12:38:33 -04:00
tutorial Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +02:00
bcc32.mak Remove useless whitespace at end of lines 2010-11-23 22:34:55 +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 Fix some oversights in distprep and maintainer-clean targets. 2011-03-10 00:04:05 -05:00
Makefile.global.in Remove configure flag --disable-shared, as it is no longer used by any 2012-08-30 16:26:53 -04:00
Makefile.shlib Remove configure flag --disable-shared, as it is no longer used by any 2012-08-30 16:26:53 -04:00
nls-global.mk Lots of doc corrections. 2012-04-23 22:43:09 -04:00
win32.mak Remove useless whitespace at end of lines 2010-11-23 22:34:55 +02:00