Re: exitArchiveRecovery woes

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: exitArchiveRecovery woes
Date: 2014-12-18 13:53:33
Message-ID: CA+TgmoYez=y0BHLu-xVtoWC-5-g19oFDMqFTcBnRxJ4j4qt=-g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Dec 17, 2014 at 8:40 AM, Heikki Linnakangas
<hlinnakangas(at)vmware(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2014-12-18 13:56:56 Re: Proposal: Log inability to lock pages during vacuum
Previous Message Michael Paquier 2014-12-18 13:23:30 Table-level log_autovacuum_min_duration