postgresql/src/backend
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
..
access Fix bugs in cascading replication with recovery_target_timeline='latest' 2012-09-04 19:33:21 -07:00
bootstrap Split tuple struct defs from htup.h to htup_details.h 2012-08-30 16:52:35 -04:00
catalog Split tuple struct defs from htup.h to htup_details.h 2012-08-30 16:52:35 -04:00
commands Split tuple struct defs from htup.h to htup_details.h 2012-08-30 16:52:35 -04:00
executor Fix serializable mode with index-only scans. 2012-09-04 21:13:11 -05:00
foreign Split tuple struct defs from htup.h to htup_details.h 2012-08-30 16:52:35 -04:00
lib Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
libpq Support having multiple Unix-domain sockets per postmaster. 2012-08-10 17:27:15 -04:00
main Unify calling conventions for postgres/postmaster sub-main functions 2012-06-25 21:30:12 +03:00
nodes Drop cheap-startup-cost paths during add_path() if we don't need them. 2012-09-01 18:16:24 -04:00
optimizer Drop cheap-startup-cost paths during add_path() if we don't need them. 2012-09-01 18:16:24 -04:00
parser Split tuple struct defs from htup.h to htup_details.h 2012-08-30 16:52:35 -04:00
po Translation updates 2011-08-17 14:07:46 +03:00
port Remove misleading hints about reducing the System V request size. 2012-07-03 10:07:47 -04:00
postmaster Split tuple struct defs from htup.h to htup_details.h 2012-08-30 16:52:35 -04:00
regex Prevent corner-case core dump in rfree(). 2012-07-15 13:27:54 -04:00
replication Fix bugs in cascading replication with recovery_target_timeline='latest' 2012-09-04 19:33:21 -07:00
rewrite Split tuple struct defs from htup.h to htup_details.h 2012-08-30 16:52:35 -04:00
snowball Remove configure flag --disable-shared, as it is no longer used by any 2012-08-30 16:26:53 -04:00
storage Split tuple struct defs from htup.h to htup_details.h 2012-08-30 16:52:35 -04:00
tcop Remove some useless trailing whitespace 2012-09-04 09:17:14 +02:00
tsearch Split tuple struct defs from htup.h to htup_details.h 2012-08-30 16:52:35 -04:00
utils Fix to_date() and to_timestamp() to allow specification of the day of 2012-09-03 22:52:44 -04: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 Fix incorrect make maintainer-clean rule. 2012-04-07 18:16:50 -04:00
nls.mk Sort file list when creating gettext-files 2011-12-27 20:20:56 +02:00