Re: pg_basebackup from cascading standby after timeline switch

From: Amit kapila <amit(dot)kapila(at)huawei(dot)com>
To: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>, Magnus Hagander <magnus(at)hagander(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_basebackup from cascading standby after timeline switch
Date: 2012-12-22 05:04:54
Message-ID: 6C0B27F7206C9E4CA54AE035729E9C383BEA50D6@szxeml509-mbx
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Friday, December 21, 2012 6:24 PM Heikki Linnakangas wrote:
On 17.12.2012 18:58, Magnus Hagander wrote:
> On Mon, Dec 17, 2012 at 5:19 PM, Tom Lane<tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> Heikki Linnakangas<hlinnakangas(at)vmware(dot)com> writes:
>>>> I'm not happy with the fact that we just ignore the problem in a backup
>>>> taken from a standby, silently giving the user a backup that won't start
>>>> up. Why not include the timeline history file in the backup?
>>
>>> +1. I was not aware that we weren't doing that --- it seems pretty
>>> foolish, especially since as you say they're tiny.
>
>> Yeah, +1. That should probably have been a part of the whole
>> "basebackup from slave" patch, so it can probably be considered a
>> back-patchable bugfix in itself, no?

>Yes, this should be backpatched to 9.2. I came up with the attached.

> One solution to that would be to pay more attention to the timelines to
> include WAL from. basebackup.c could read the timeline history file, to
> see exactly where the timeline switches happened, and then construct the
> filename of each WAL segment using the correct timeline id. Another
> approach would be to do readdir() on pg_xlog, and include all WAL files,
> regardless of timeline IDs, that fall in the right XLogRecPtr range. The
> latter seems easier to backpatch.

I also think approach implemented by you is more better.
One small point, shouldn't it check (walsender_shutdown_requested || walsender_ready_to_stop) during ReadDir of pg_xlog similar to what is done in ReadDir() in SendDir?

With Regards,
Amit Kapila.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Kohei KaiGai 2012-12-22 05:18:24 Re: Review of Row Level Security
Previous Message Noah Misch 2012-12-22 04:01:19 Re: pgcrypto seeding problem when ssl=on