Re: pg_basebackup and wal streaming - Mailing list pgsql-hackers

From Magnus Hagander
Subject Re: pg_basebackup and wal streaming
Date
Msg-id AANLkTimbvgR_CKabp2j=aD+Ma89B3VvX5anO1x6F97qz@mail.gmail.com
Whole thread Raw
In response to Re: pg_basebackup and wal streaming  (Magnus Hagander <magnus@hagander.net>)
Responses Re: pg_basebackup and wal streaming  (Yeb Havinga <yebhavinga@gmail.com>)
List pgsql-hackers
On Sat, Feb 26, 2011 at 16:28, Magnus Hagander <magnus@hagander.net> wrote:
> On Sun, Feb 20, 2011 at 21:37, Dimitri Fontaine <dimitri@2ndquadrant.fr> wrote:
>> Hi,
>>
>> Magnus Hagander <magnus@hagander.net> writes:
>>> Better late than never (or?), here's the final cleanup of
>>> pg_streamrecv for moving into the main distribution, per discussion
>>> back in late dec or early jan. It also includes the "stream logs in
>>> parallel to backup" part that was not completed on pg_basebackup.
>>
>> And that's something I've been so interested in!  It's only fair game
>> that I spend time reviewing after my insisting for having it :)
>>
>> The programs (pg_basebackup and pg_receivexlog) both work as expected,
>> and show in the pg_stat_replication system view.
>>
>> pg_basebackup -x option should be revised so that it's easier to make
>> the difference between streaming WAL while the base backup is ongoing
>> and fetching them at the end, taking the risk to corrupt the whole
>> backup as soon as wal_keep_segments is undersized.
>>
>>  -x, --xlog[=stream]       include required WAL files in backup
>>
>> It could be --xlog=stream|fetch or something that reads better.
>
> Yeha, that's probably true. I wanted to avoid making it mandatory, but
> it's actually easier this way. Will change it to that.
>
>
>> Now, on to the code itself.
>>
>> I wonder if the segment_callback() routine would better be a while{}
>> loop rather than a recursive construct.  Also, it looks like a lib
>> function but it's doing exit(1)…
>
> Actually, it's even better to just reorder the checks in the other
> order - that way we don't need a loop *or* a self-call.
>
>
>> Unfortunately I can't comment (or won't risk learning enough details
>> tonight to try to be smart here) on FindStreamingStart() implementation,
>> that seems crucial.
>
> It is - so if you can find the time to, that would be great...


Attached is an updated version of the patch that includes these
changes, as well as Windows support and an initial cut at a ref page
for pg_receivexlog (needs some more detail still).


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

Attachment

pgsql-hackers by date:

Previous
From: Magnus Hagander
Date:
Subject: Re: Parallel restore checks wrong thread return value?
Next
From: Tom Lane
Date:
Subject: Re: wCTE: why not finish sub-updates at the end, not the beginning?