Re: Updated version of pg_receivexlog

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Ants Aasma <ants(at)cybertec(dot)at>
Cc: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, Jaime Casanova <jaime(at)2ndquadrant(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Updated version of pg_receivexlog
Date: 2012-06-04 15:53:02
Message-ID: CABUevEyk7LzciGae1Q=9qzDhscWr-11OpsactA3YnicRdybY+Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jun 4, 2012 at 5:48 PM, Ants Aasma <ants(at)cybertec(dot)at> wrote:
> On Mon, Jun 4, 2012 at 6:20 PM, Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
>> On Mon, Jun 4, 2012 at 11:25 PM, Ants Aasma <ants(at)cybertec(dot)at> wrote:
>>> On Thu, Sep 29, 2011 at 11:30 PM, Magnus Hagander <magnus(at)hagander(dot)net> wrote:
>>>>> it doesn't say that is not possible to use this for a standby
>>>>> server... probably that's why i get the error i put a recovery.conf
>>>>> after pg_basebackup finished... maybe we can say that  more loudly?
>>>>
>>>> The idea is, if you use it with -x (or --xlog), it's for taking a
>>>> backup/clone, *not* for replication.
>>>>
>>>> If you use it without -x, then you can use it as the start of a
>>>> replica, by adding a recovery.conf.
>>>>
>>>> But you can't do both at once, that will confuse it.
>>>
>>> I stumbled upon this again today. There's nothing in the docs that
>>> would even hint that using -x shouldn't work to create a replica. Why
>>> does it get confused and can we (easily) make it not get confused? At
>>> the very least it needs a big fat warning in documentation for the -x
>>> option that the resulting backup might not be usable as a standby.
>>
>> Unless I'm missing something, you can use pg_basebackup -x for the
>> standby. If lots of WAL files are generated in the master after
>> pg_basebackup -x ends and before you start the standby instance,
>> you may get the following error. In this case, you need to consult with
>> archived WAL files even though you specified -x option in pg_basebackup.
>>
>>> FATAL:  could not receive data from WAL stream: FATAL:  requested WAL
>>> segment 00000001000000000000005C has already been removed
>>
>> Though we have the above problem, pg_basebackup -x is usable for
>> the standby, I think.
>
> I assumed from Magnus's comment that this is a known problem. I wonder
> what went wrong if it should have worked. In the case where this
> turned up the missing file was an xlog file with the new timeline ID
> but one segment before the timeline switch. I'll have to see if I can
> create a reproducible case for this.

No, it's more a "there's no reason to do that". I don't think it
should necessarily be an actual problem.

In your case the missing piece of information is why was there a
timeline switch? pg_basebackup shouldn't cause a timeline switch
whether you use it in -x mode or not.

--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ants Aasma 2012-06-04 16:06:48 Re: Updated version of pg_receivexlog
Previous Message Ants Aasma 2012-06-04 15:48:40 Re: Updated version of pg_receivexlog