Re: exitArchiveRecovery woes - Mailing list pgsql-hackers

From Robert Haas
Subject Re: exitArchiveRecovery woes
Date
Msg-id CA+TgmoYez=y0BHLu-xVtoWC-5-g19oFDMqFTcBnRxJ4j4qt=-g@mail.gmail.com
Whole thread Raw
In response to exitArchiveRecovery woes  (Heikki Linnakangas <hlinnakangas@vmware.com>)
Responses Re: exitArchiveRecovery woes  (Heikki Linnakangas <hlinnakangas@vmware.com>)
List pgsql-hackers
On Wed, Dec 17, 2014 at 8:40 AM, Heikki Linnakangas
<hlinnakangas@vmware.com> wrote:
> At the end of archive recovery, we copy the last segment from the old
> timeline, to initialize the first segment on the new timeline. For example,
> if the timeline switch happens in the middle of WAL segment
> 000000010000000000000005, the whole 000000010000000000000005 segment is
> copied to become 000000020000000000000005. The copying is necessary, so that
> the new segment contains valid data up to the switch point.
>
> However, we wouldn't really need to copy the whole segment, copying up to
> the switch point would be enough. In fact, copying the whole segment is a
> bad idea, because the copied WAL looks valid on the new timeline too.

Your proposed change makes sense to me, but why do we need the segment
to contain valid data up to the switch point?  It seems like the
switch between timelines should be "crisper": replay WAL on the old
timeline only from the old segment, and from the new timeline only on
the new segment.  Anything else seems like an invitation to unending
corner-case bugs.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Table-level log_autovacuum_min_duration
Next
From: Robert Haas
Date:
Subject: Re: Proposal: Log inability to lock pages during vacuum