[v9.2] Start new timeline for PITR

Lists: pgsql-hackers
From: David Fetter <david(at)fetter(dot)org>
To: PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: [v9.2] Start new timeline for PITR
Date: 2011-06-09 23:51:45
Message-ID: 20110609235145.GA28705@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Folks,

The nice people at VMware, where I work, have come up with a small
patch to allow PITR to create a new timeline. This is useful in cases
where you're using filesystem snapshots of $PGDATA which may be old.

PFA a patch implementing and documenting same :)

Cheers,
David.
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

Attachment Content-Type Size
new_timeline02.diff text/plain 4.7 KB

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [v9.2] Start new timeline for PITR
Date: 2011-06-10 00:02:48
Message-ID: 4DF15F28.8070305@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 6/9/11 4:51 PM, David Fetter wrote:
> Folks,
>
> The nice people at VMware, where I work, have come up with a small
> patch to allow PITR to create a new timeline. This is useful in cases
> where you're using filesystem snapshots of $PGDATA which may be old.
>
> PFA a patch implementing and documenting same :)

Can you explain here in email what the specific goals and expected
behavior of the option are?

--
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: David Fetter <david(at)fetter(dot)org>
Cc: PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [v9.2] Start new timeline for PITR
Date: 2011-06-10 00:59:04
Message-ID: 28593.1307667544@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

David Fetter <david(at)fetter(dot)org> writes:
> The nice people at VMware, where I work, have come up with a small
> patch to allow PITR to create a new timeline. This is useful in cases
> where you're using filesystem snapshots of $PGDATA which may be old.

Huh? We already start a new timeline when doing a non-crash-recovery
replay scenario.

The code looks pretty confused too, which makes it difficult to
reverse-engineer what your point is.

regards, tom lane


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: David Fetter <david(at)fetter(dot)org>, PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [v9.2] Start new timeline for PITR
Date: 2011-06-10 05:20:25
Message-ID: BANLkTimPRvSx5b_5ktyDA4Z0v9bHomF8Nw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Jun 9, 2011 at 8:59 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> David Fetter <david(at)fetter(dot)org> writes:
>> The nice people at VMware, where I work, have come up with a small
>> patch to allow PITR to create a new timeline.  This is useful in cases
>> where you're using filesystem snapshots of $PGDATA which may be old.
>
> Huh?  We already start a new timeline when doing a non-crash-recovery
> replay scenario.
>
> The code looks pretty confused too, which makes it difficult to
> reverse-engineer what your point is.

I am guessing that they are taking a filesystem snapshot, and then
using that to fire up PG. So to PG it looks like a crash recovery,
but they want a new timeline anyway.

<waves hands>

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


From: David Fetter <david(at)fetter(dot)org>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [v9.2] Start new timeline for PITR
Date: 2011-06-10 16:30:29
Message-ID: 20110610163029.GB5771@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Fri, Jun 10, 2011 at 01:20:25AM -0400, Robert Haas wrote:
> On Thu, Jun 9, 2011 at 8:59 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> > David Fetter <david(at)fetter(dot)org> writes:
> >> The nice people at VMware, where I work, have come up with a small
> >> patch to allow PITR to create a new timeline.  This is useful in cases
> >> where you're using filesystem snapshots of $PGDATA which may be old.
> >
> > Huh?  We already start a new timeline when doing a non-crash-recovery
> > replay scenario.
> >
> > The code looks pretty confused too, which makes it difficult to
> > reverse-engineer what your point is.
>
> I am guessing that they are taking a filesystem snapshot, and then
> using that to fire up PG. So to PG it looks like a crash recovery,
> but they want a new timeline anyway.
>
> <waves hands>

That's pretty much it. More detail:

Let's imagine we're taking filesystem snapshots each day by whatever
means. We're also archiving xlogs, but only have space for 48 hours'
worth. Now we want to recover to 3 days ago, but there are no WALs
from that time, so we do a crash recovery from the filesystem
snapshot. Doing continuous archiving from this conflicts with the
existing WALs, which we solve by creating a new timeline.

This also allows subsequent PITR to other times on the original
timeline.

Josh B pointed out that since this option to true conflicts with
another option, having both should prevent recovery from even
starting, and I'll work up a patch for this tonight or at latest
tomorrow.

Cheers,
David.
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate


From: Josh Berkus <josh(at)agliodbs(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [v9.2] Start new timeline for PITR
Date: 2011-06-10 18:53:49
Message-ID: 4DF2683D.9010404@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

David,

> Let's imagine we're taking filesystem snapshots each day by whatever
> means. We're also archiving xlogs, but only have space for 48 hours'
> worth. Now we want to recover to 3 days ago, but there are no WALs
> from that time, so we do a crash recovery from the filesystem
> snapshot. Doing continuous archiving from this conflicts with the
> existing WALs, which we solve by creating a new timeline.

How is this different from just changing the recovery_command?

--
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com


From: Josh Berkus <josh(at)agliodbs(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [v9.2] Start new timeline for PITR
Date: 2011-06-10 18:57:38
Message-ID: 4DF26922.4060109@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

David,

> Let's imagine we're taking filesystem snapshots each day by whatever
> means. We're also archiving xlogs, but only have space for 48 hours'
> worth. Now we want to recover to 3 days ago, but there are no WALs
> from that time, so we do a crash recovery from the filesystem
> snapshot. Doing continuous archiving from this conflicts with the
> existing WALs, which we solve by creating a new timeline.

How is this different from just changing the recovery_command?

--
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [v9.2] Start new timeline for PITR
Date: 2011-06-10 19:34:23
Message-ID: BANLkTimx0nO0+JhhjJWudzYvwoEKO=5fxg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Fri, Jun 10, 2011 at 2:53 PM, Josh Berkus <josh(at)agliodbs(dot)com> wrote:
>> Let's imagine we're taking filesystem snapshots each day by whatever
>> means.  We're also archiving xlogs, but only have space for 48 hours'
>> worth.  Now we want to recover to 3 days ago, but there are no WALs
>> from that time, so we do a crash recovery from the filesystem
>> snapshot.  Doing continuous archiving from this conflicts with the
>> existing WALs, which we solve by creating a new timeline.
>
> How is this different from just changing the recovery_command?

*scratches head*

How is it the same?

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Josh Berkus <josh(at)agliodbs(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [v9.2] Start new timeline for PITR
Date: 2011-06-10 19:38:37
Message-ID: 4DF272BD.3090309@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 10.06.2011 22:34, Robert Haas wrote:
> On Fri, Jun 10, 2011 at 2:53 PM, Josh Berkus<josh(at)agliodbs(dot)com> wrote:
>>> Let's imagine we're taking filesystem snapshots each day by whatever
>>> means. We're also archiving xlogs, but only have space for 48 hours'
>>> worth. Now we want to recover to 3 days ago, but there are no WALs
>>> from that time, so we do a crash recovery from the filesystem
>>> snapshot. Doing continuous archiving from this conflicts with the
>>> existing WALs, which we solve by creating a new timeline.
>>
>> How is this different from just changing the recovery_command?
>
> *scratches head*
>
> How is it the same?

Creating a dummy recovery.conf with bogus recovery_command would do the
trick.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com


From: Josh Berkus <josh(at)agliodbs(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [v9.2] Start new timeline for PITR
Date: 2011-06-10 19:39:03
Message-ID: 4DF272D7.6020001@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 6/10/11 12:34 PM, Robert Haas wrote:
> On Fri, Jun 10, 2011 at 2:53 PM, Josh Berkus <josh(at)agliodbs(dot)com> wrote:
>>> Let's imagine we're taking filesystem snapshots each day by whatever
>>> means. We're also archiving xlogs, but only have space for 48 hours'
>>> worth. Now we want to recover to 3 days ago, but there are no WALs
>>> from that time, so we do a crash recovery from the filesystem
>>> snapshot. Doing continuous archiving from this conflicts with the
>>> existing WALs, which we solve by creating a new timeline.
>>
>> How is this different from just changing the recovery_command?
>
> *scratches head*
>
> How is it the same?

Well, presumably I can just change recovery_command to recover from an
empty directory. Then the PITR copy will just come up as soon as it
finishes processing local snapshot WAL, and it'll start its own
timeline. How is this different from what the patch does?

--
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com


From: Jaime Casanova <jaime(at)2ndquadrant(dot)com>
To: David Fetter <david(at)fetter(dot)org>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [v9.2] Start new timeline for PITR
Date: 2011-06-17 14:57:13
Message-ID: BANLkTik7xf-7MMW92ECM1vY8asGtsWRF0w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Fri, Jun 10, 2011 at 11:30 AM, David Fetter <david(at)fetter(dot)org> wrote:
>
> This also allows subsequent PITR to other times on the original
> timeline.
>
> Josh B pointed out that since this option to true conflicts with
> another option, having both should prevent recovery from even
> starting, and I'll work up a patch for this tonight or at latest
> tomorrow.
>

Hi,

Are you still working on this? should we expect a new patch?

--
Jaime Casanova         www.2ndQuadrant.com
Professional PostgreSQL: Soporte 24x7 y capacitación


From: David Fetter <david(at)fetter(dot)org>
To: Jaime Casanova <jaime(at)2ndquadrant(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [v9.2] Start new timeline for PITR
Date: 2011-06-17 18:54:35
Message-ID: 20110617185435.GB2926@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Fri, Jun 17, 2011 at 09:57:13AM -0500, Jaime Casanova wrote:
> On Fri, Jun 10, 2011 at 11:30 AM, David Fetter <david(at)fetter(dot)org> wrote:
> >
> > This also allows subsequent PITR to other times on the original
> > timeline.
> >
> > Josh B pointed out that since this option to true conflicts with
> > another option, having both should prevent recovery from even
> > starting, and I'll work up a patch for this tonight or at latest
> > tomorrow.
>
> Hi,
>
> Are you still working on this? should we expect a new patch?

Yes, sorry about that. I let work get on top of me. Will try for a
new patch this evening.

Cheers,
David.
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate


From: Jaime Casanova <jaime(at)2ndquadrant(dot)com>
To: David Fetter <david(at)fetter(dot)org>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [v9.2] Start new timeline for PITR
Date: 2011-06-18 00:21:54
Message-ID: BANLkTi=BZPhkUsG9BogfxHZrqLJMymrTXg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Fri, Jun 17, 2011 at 1:54 PM, David Fetter <david(at)fetter(dot)org> wrote:
> On Fri, Jun 17, 2011 at 09:57:13AM -0500, Jaime Casanova wrote:
>>
>> Are you still working on this? should we expect a new patch?
>
> Yes, sorry about that.  I let work get on top of me.  Will try for a
> new patch this evening.
>

ok... i will wait it to review... just in advance, i really don't like
this name "create_new_timeline"... it will drive confusion

--
Jaime Casanova         www.2ndQuadrant.com
Professional PostgreSQL: Soporte 24x7 y capacitación