pgsql: Delay reading timeline history file until it's fetched from mast

From: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Delay reading timeline history file until it's fetched from mast
Date: 2013-01-03 18:01:41
Message-ID: E1Tqp6r-00025b-Dv@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2013-01-03 23:35:11 pgsql: Prevent creation of postmaster's TCP socket during pg_upgrade te
Previous Message Bruce Momjian 2013-01-03 02:20:54 pgsql: Adjust a few pg_upgrade functions to return void.