pgsql: Delay reading timeline history file until it's fetched from mast - Mailing list pgsql-committers

From Heikki Linnakangas
Subject pgsql: Delay reading timeline history file until it's fetched from mast
Date
Msg-id E1Tqp6r-00025b-Dv@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Delay reading timeline history file until it's fetched from master.

Streaming replication can fetch any missing timeline history files from the
master, but recovery would read the timeline history file for the target
timeline before reading the checkpoint record, and before walreceiver has
had a chance to fetch it from the master. Delay reading it, and the sanity
checks involving timeline history, until after reading the checkpoint
record.

There is at least one scenario where this makes a difference: if you take
a base backup from a standby server right after a timeline switch, the
WAL segment containing the initial checkpoint record will begin with an
older timeline ID. Without the timeline history file, recovering that file
will fail as the older timeline ID is not recognized to be an ancestor of
the target timeline. If you try to recover from such a backup, using only
streaming replication to fetch the WAL, this patch is required for that to
work.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/ee994272ca50f70b53074f0febaec97e28f83c4e

Modified Files
--------------
src/backend/access/transam/xlog.c     |  140 ++++++++++++++++++++------------
src/backend/replication/walreceiver.c |    5 +-
2 files changed, 90 insertions(+), 55 deletions(-)


pgsql-committers by date:

Previous
From: Bruce Momjian
Date:
Subject: pgsql: Adjust a few pg_upgrade functions to return void.
Next
From: Heikki Linnakangas
Date:
Subject: pgsql: Tolerate timeline switches while "pg_basebackup -X fetch" is run