Re: Streaming replication and WAL archive interactions - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: Streaming replication and WAL archive interactions
Date
Msg-id 5537F7AD.1060604@iki.fi
Whole thread Raw
In response to Re: Streaming replication and WAL archive interactions  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: Streaming replication and WAL archive interactions
List pgsql-hackers
On 04/22/2015 10:21 PM, Robert Haas wrote:
> On Wed, Apr 22, 2015 at 3:01 PM, Heikki Linnakangas <hlinnaka@iki.fi> wrote:
>> For example, imagine that perform point-in-time recovery to WAL position
>> 0/1237E568, on timeline 1. That falls within segment
>> 000000010000000000000012. Then we end recovery, and switch to timeline 2.
>> After the switch, and some more WAL-logged actions, we'll have these files
>> in pg_xlog:
>>
>> 000000010000000000000011
>> 000000010000000000000012
>> 000000020000000000000012
>> 000000020000000000000013
>> 000000020000000000000014
>
> Is the 000000010000000000000012 file a "partial" segment of the sort
> you're proposing to no longer achive?

If you did pure archive recovery, with no streaming replication 
involved, then no. If it was created by streaming replication, and the 
replication had not filled the whole segment yet, then yes, it would be 
a partial segment.

>> Note that there are two segments ending in "12". They both have the same
>> point up to offset 0x37E568, corresponding to the switch point 0/1237E568.
>> After that, the contents diverge: the segment on the new timeline contains a
>> checkpoint/end-of-recovery record at that point, followed by new WAL
>> belonging to the new timeline.
>
> Check.
>
>> Recovery knows about that, so that if you set recovery target to timeline 2,
>> and it needs the WAL at the beginning of segment 12 (still belonging to
>> timeline 1), it will try to restoring both "000000010000000000000012" and
>> "000000020000000000000012".
>
> What if you set the recovery target to timeline 3?

It depends how timeline 3 was created. If timeline 3 was forked off from 
timeline 2, then recovery would find it. If it was forked off directly 
from timeline 1, then no.

- Heikki




pgsql-hackers by date:

Previous
From: Petr Jelinek
Date:
Subject: Re: TABLESAMPLE patch
Next
From: Alvaro Herrera
Date:
Subject: Re: cache lookup error for shell type creation with incompatible output function (DDL deparsing bug)