Re: pg_basebackup from cascading standby after timeline switch - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: pg_basebackup from cascading standby after timeline switch
Date
Msg-id 50DC1D94.8060401@vmware.com
Whole thread Raw
In response to Re: pg_basebackup from cascading standby after timeline switch  (Fujii Masao <masao.fujii@gmail.com>)
Responses Re: pg_basebackup from cascading standby after timeline switch
List pgsql-hackers
On 23.12.2012 15:33, Fujii Masao wrote:
> On Fri, Dec 21, 2012 at 9:54 PM, Heikki Linnakangas
> <hlinnakangas@vmware.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



pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: dynamic SQL - possible performance regression in 9.2
Next
From: Stephen Frost
Date:
Subject: Re: Proposal: Store "timestamptz" of database creation on "pg_database"