Re: how to identify the timeline of specified recovery_target_time when do multiple PITR

From: magodo <wztdyl(at)sina(dot)com>
To: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, pgsql-general(at)postgresql(dot)org
Subject: Re: how to identify the timeline of specified recovery_target_time when do multiple PITR
Date: 2018-10-12 02:20:43
Message-ID: 32dd51b8c3848258511d97597a15292b2e97b7e0.camel@sina.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 2018-10-11 at 19:53 +0200, Laurenz Albe wrote:

> Indeed, your sentence
>
> > if , for example, it recovered to "A" at "o1", then
> > the switched WAL(in case of stop-then-recover) or .partial
> > corresponding WAL(in case of promote) is the last WAL of the
> > timeline1
>
> seems to contradict your drawing, which has B after A on timeline 1.

Err... I mean "o1" is the end of timelien1, and the last WAL is the one
"o1" was on just before recovering to "A".

> Example:
> Assume that timeline 1 reaches to 000000010000001500000030.
> We recover to point A, which is in the middle of
> 000000010000001500000020,
> and there branch to timeline 2.
> After some time, we decide to recover again, starting from a
> checkpoint in 000000010000001500000010.
> We want to recover to 2018-10-11 12:00:00.
>
> How can you know how many WAL segments there are on timeline 1, and
> if
> there is one that extends past 2018-10-11 12:00:00 or not?

This is the exact problem I want to figure out. My approach is as you
said, I will parse each archived WAL segment via `pg_xlogdump -r
Transaction`, and try to find the first least earliest WAL against the
specified time. This is a linear search, which has complexity of O(n).

So if you want to recover to that point of time, how do you choose the
timeline?

---
Magodo

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Laurenz Albe 2018-10-12 03:42:12 Re: how to identify the timeline of specified recovery_target_time when do multiple PITR
Previous Message Bruce Momjian 2018-10-11 22:48:38 Re: Code of Conduct plan