pgsql: Keep timeline history files restored from archive in pg_xlog. - Mailing list pgsql-committers

From Heikki Linnakangas
Subject pgsql: Keep timeline history files restored from archive in pg_xlog.
Date
Msg-id E1TpI4z-000265-UI@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Keep timeline history files restored from archive in pg_xlog.

The cascading standby patch in 9.2 changed the way WAL files are treated
when restored from the archive. Before, they were restored under a temporary
filename, and not kept in pg_xlog, but after the patch, they were copied
under pg_xlog. This is necessary for a cascading standby to find them, but
it also means that if the archive goes offline and a standby is restarted,
it can recover back to where it was using the files in pg_xlog. It also
means that if you take an offline backup from a standby server, it includes
all the required WAL files in pg_xlog.

However, the same change was not made to timeline history files, so if the
WAL segment containing the checkpoint record contains a timeline switch, you
will still get an error if you try to restart recovery without the archive,
or recover from an offline backup taken from the standby.

With this patch, timeline history files restored from archive are copied
into pg_xlog like WAL files are, so that pg_xlog contains all the files
required to recover. This is a corner-case pre-existing issue in 9.2, but
even more important in master where it's possible for a standby to follow a
timeline switch through streaming replication. To make that possible, the
timeline history files must be present in pg_xlog.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/60df192aea0e6458f20301546e11f7673c102101

Modified Files
--------------
src/backend/access/transam/timeline.c    |   11 ++++-
src/backend/access/transam/xlog.c        |   60 +-----------------------
src/backend/access/transam/xlogarchive.c |   75 ++++++++++++++++++++++++++++++
src/include/access/xlog_internal.h       |    1 +
4 files changed, 88 insertions(+), 59 deletions(-)


pgsql-committers by date:

Previous
From: Peter Eisentraut
Date:
Subject: pgsql: doc: Correct description of LDAP authentication
Next
From: Heikki Linnakangas
Date:
Subject: pgsql: Keep timeline history files restored from archive in pg_xlog.