Re: pg_basebackup from cascading standby after timeline switch

From: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: Magnus Hagander <magnus(at)hagander(dot)net>, 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-27 10:06:12
Message-ID: 50DC1D94.8060401@vmware.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 23.12.2012 15:33, Fujii Masao wrote:
> On Fri, Dec 21, 2012 at 9:54 PM, Heikki Linnakangas
> <hlinnakangas(at)vmware(dot)com> wrote:
>> Yes, this should be backpatched to 9.2. I came up with the attached.
>
> In this patch, if '-X stream' is specified in pg_basebackup, the timeline
> history files are not backed up.

Good point.

> We should change pg_backup background
> process and walsender so that they stream also timeline history files,
> for example, by using 'TIMELINE_HISTORY' replication command?
> Or basebackup.c should send all timeline history files at the end of backup
> even if '-X stream' is specified?

Perhaps. We should enhance pg_receivexlog to follow timeline switches,
anyway. I was thinking of leaving that as a todo item, but pg_basebackup
-X stream shares the code, so we should implement that now to get that
support into both.

In the problem you reported on the other thread
(http://archives.postgresql.org/message-id/50DB5EA9.7010406@vmware.com),
you also need the timeline history files, but that one didn't use "-X"
at all. Even if we teach pg_basebackup to fetch the timeline history
files in "-X stream" mode, that still leaves the problem on that other
thread.

The simplest solution would be to always include all timeline history
files in the backup, even if -X is not used. Currently, however, pg_xlog
is backed up as an empty directory in that case, but that would no
longer be the case if we start including timeline history files there. I
wonder if that would confuse any existing backup scripts people are using.

- Heikki

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2012-12-27 12:08:56 Re: Proposal: Store "timestamptz" of database creation on "pg_database"
Previous Message Pavel Stehule 2012-12-27 06:07:06 dynamic SQL - possible performance regression in 9.2