pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: magodo <wztdyl@sina.com>
To: pgsql-general@postgresql.org
Subject: Re: how to identify the timeline of specified recovery_target_time when do multiple PITR
Date: Fri, 12 Oct 2018 05:42:12 +0200
Message-ID: <ec9fb3bf4873aa450f67556c3bbda85c8e4f1d34.camel@cybertec.at> (raw)
In-Reply-To: <32dd51b8c3848258511d97597a15292b2e97b7e0.camel@sina.com>
References: <29dd7b5cf905ee53026f96b78a505f1b76b6031b.camel@sina.com>
	<0c552a0ee114314ceb026d65f75a98df3e8d22ff.camel@cybertec.at>
	<c73ac63988c2a162b9842ad7b5d394387c3703a1.camel@sina.com>
	<34d85bfc77e9a63890e28ea13953c30508233469.camel@cybertec.at>
	<41a74e2ac23015149bc98631b8dcac0fdb6b6a51.camel@sina.com>
	<ccbdaf1d321cb8e8f21ab93ad6915757d3b5dfe5.camel@cybertec.at>
	<11f07b3786a54bf74a7ce5970422a0b22c3ffb50.camel@sina.com>
	<25a3b6f0128ed10635267488d689a75055958208.camel@cybertec.at>
	<32dd51b8c3848258511d97597a15292b2e97b7e0.camel@sina.com>

magodo wrote:
> > 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).

That means that the time spent grows linearly, but it is still a lot of time
if there are a lot of WAL archives.

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

PostgreSQL doesn't provide auch a functionality, and I can think of three reasons:
1) the high cost as mentioned above
2) during archive recovery, it does not happen very often that you have to
   choose between timelines at all.  It is more typical for streaming replication.
3) nobody saw a use case for such a functionality

If you really need this functionality, you'll have to write it yourself.

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com





view thread (10+ messages)

Message-ID: <ec9fb3bf4873aa450f67556c3bbda85c8e4f1d34.camel@cybertec.at>
Permalink:  ../ec9fb3bf4873aa450f67556c3bbda85c8e4f1d34.camel@cybertec.at/
Also on:    postgresql.org/message-id/ec9fb3bf4873aa450f67556c3bbda85c8e4f1d34.camel@cybertec.at

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: laurenz.albe@cybertec.at, wztdyl@sina.com
  Subject: Re: how to identify the timeline of specified recovery_target_time when do multiple PITR
  In-Reply-To: <ec9fb3bf4873aa450f67556c3bbda85c8e4f1d34.camel@cybertec.at>
  References: <29dd7b5cf905ee53026f96b78a505f1b76b6031b.camel@sina.com> <0c552a0ee114314ceb026d65f75a98df3e8d22ff.camel@cybertec.at> <c73ac63988c2a162b9842ad7b5d394387c3703a1.camel@sina.com> <34d85bfc77e9a63890e28ea13953c30508233469.camel@cybertec.at> <41a74e2ac23015149bc98631b8dcac0fdb6b6a51.camel@sina.com> <ccbdaf1d321cb8e8f21ab93ad6915757d3b5dfe5.camel@cybertec.at> <11f07b3786a54bf74a7ce5970422a0b22c3ffb50.camel@sina.com> <25a3b6f0128ed10635267488d689a75055958208.camel@cybertec.at> <32dd51b8c3848258511d97597a15292b2e97b7e0.camel@sina.com> <ec9fb3bf4873aa450f67556c3bbda85c8e4f1d34.camel@cybertec.at>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox