postgresql/src/backend/postmaster
Heikki Linnakangas abfd192b1b Allow a streaming replication standby to follow a timeline switch.
Before this patch, streaming replication would refuse to start replicating
if the timeline in the primary doesn't exactly match the standby. The
situation where it doesn't match is when you have a master, and two
standbys, and you promote one of the standbys to become new master.
Promoting bumps up the timeline ID, and after that bump, the other standby
would refuse to continue.

There's significantly more timeline related logic in streaming replication
now. First of all, when a standby connects to primary, it will ask the
primary for any timeline history files that are missing from the standby.
The missing files are sent using a new replication command TIMELINE_HISTORY,
and stored in standby's pg_xlog directory. Using the timeline history files,
the standby can follow the latest timeline present in the primary
(recovery_target_timeline='latest'), just as it can follow new timelines
appearing in an archive directory.

START_REPLICATION now takes a TIMELINE parameter, to specify exactly which
timeline to stream WAL from. This allows the standby to request the primary
to send over WAL that precedes the promotion. The replication protocol is
changed slightly (in a backwards-compatible way although there's little hope
of streaming replication working across major versions anyway), to allow
replication to stop when the end of timeline reached, putting the walsender
back into accepting a replication command.

Many thanks to Amit Kapila for testing and reviewing various versions of
this patch.
2012-12-13 19:17:32 +02:00
..
autovacuum.c Remove unnecessary "head" arguments from some dlist/slist functions. 2012-10-18 19:04:20 -04:00
bgwriter.c Make xlog_internal.h includable in frontend context. 2012-12-13 14:59:13 +02:00
checkpointer.c Make xlog_internal.h includable in frontend context. 2012-12-13 14:59:13 +02:00
fork_process.c Support Linux's oom_score_adj API as well as the older oom_adj API. 2012-06-13 15:35:52 -04:00
Makefile Refactor xlog.c to create src/backend/postmaster/startup.c 2011-11-02 14:25:01 +00:00
pgarch.c Make xlog_internal.h includable in frontend context. 2012-12-13 14:59:13 +02:00
pgstat.c Split up process latch initialization for more-fail-soft behavior. 2012-10-14 22:59:56 -04:00
postmaster.c Allow a streaming replication standby to follow a timeline switch. 2012-12-13 19:17:32 +02:00
startup.c Allow a streaming replication standby to follow a timeline switch. 2012-12-13 19:17:32 +02:00
syslogger.c Fix syslogger to not fail when log_rotation_age exceeds 2^31 milliseconds. 2012-11-18 16:16:39 -05:00
walwriter.c Close un-owned SMgrRelations at transaction end. 2012-10-17 12:38:21 -04:00