Re: Getting to 8.3 beta1 - Mailing list pgsql-hackers

From Simon Riggs
Subject Re: Getting to 8.3 beta1
Date
Msg-id 1190911532.4194.127.camel@ebony.site
Whole thread Raw
In response to Re: Getting to 8.3 beta1  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Getting to 8.3 beta1
List pgsql-hackers
On Thu, 2007-09-27 at 12:26 -0400, Tom Lane wrote:
> I wrote:
> > Looking back at your original discussion of the bug,
> > http://archives.postgresql.org/pgsql-hackers/2007-06/msg00234.php
> > I'm wondering why you chose option #3 rather than option #4?
> > I still find the proposed patch a bit crufty.
> 
> In particular, it seems like a patch per #4 would be a one-liner:
> 
> *** src/backend/access/transam/xlog.c.orig    Wed Sep 26 18:36:30 2007
> --- src/backend/access/transam/xlog.c    Thu Sep 27 12:20:56 2007
> ***************
> *** 5092,5101 ****
>        *
>        * If we stopped short of the end of WAL during recovery, then we are
>        * generating a new timeline and must assign it a unique new ID.
>        * Otherwise, we can just extend the timeline we were in when we ran out
>        * of WAL.
>        */
> !     if (needNewTimeLine)
>       {
>           ThisTimeLineID = findNewestTimeLine(recoveryTargetTLI) + 1;
>           ereport(LOG,
> --- 5092,5103 ----
>        *
>        * If we stopped short of the end of WAL during recovery, then we are
>        * generating a new timeline and must assign it a unique new ID.
> +      * We also force a new timeline when recovering from an archive, to avoid
> +      * problems with trying to overwrite existing archived segments.
>        * Otherwise, we can just extend the timeline we were in when we ran out
>        * of WAL.
>        */
> !     if (needNewTimeLine || (InArchiveRecovery && XLogArchivingActive()))
>       {
>           ThisTimeLineID = findNewestTimeLine(recoveryTargetTLI) + 1;
>           ereport(LOG,

AFAICS the correct test would be
if (InArchiveRecovery)

since needNewTimeLine can only be true iff InArchiveRecovery is true.

It's often a good idea to disable archive_mode when doing a recovery to
avoid trying to send files to the same archive as the primary, which
would then also fail. So requiring XLogArchivingActive() also may not be
desirable.

--  Simon Riggs 2ndQuadrant  http://www.2ndQuadrant.com



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Getting to 8.3 beta1
Next
From: Simon Riggs
Date:
Subject: Re: Getting to 8.3 beta1