Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gAQyT-0007Ef-4K for pgsql-general@arkaria.postgresql.org; Thu, 11 Oct 2018 02:45:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gAQyR-0000b6-Ir for pgsql-general@arkaria.postgresql.org; Thu, 11 Oct 2018 02:45:15 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gAQdm-0007wv-30 for pgsql-general@lists.postgresql.org; Thu, 11 Oct 2018 02:23:54 +0000 Received: from mail3-163.sinamail.sina.com.cn ([202.108.3.163]) by makus.postgresql.org with smtp (Exim 4.89) (envelope-from ) id 1gAQda-0006kM-Rv for pgsql-general@postgresql.org; Thu, 11 Oct 2018 02:23:50 +0000 Received: from unknown (HELO t460p)([120.132.1.226]) by sina.com with ESMTP id 5BBEB427000064D4; Thu, 11 Oct 2018 10:23:36 +0800 (CST) X-Sender: wztdyl@sina.com X-Auth-ID: wztdyl@sina.com X-SMAIL-MID: 848434394109 Message-ID: <41a74e2ac23015149bc98631b8dcac0fdb6b6a51.camel@sina.com> Subject: Re: how to identify the timeline of specified recovery_target_time when do multiple PITR From: magodo To: Laurenz Albe , pgsql-general@postgresql.org Date: Thu, 11 Oct 2018 10:23:37 +0800 In-Reply-To: <34d85bfc77e9a63890e28ea13953c30508233469.camel@cybertec.at> References: <29dd7b5cf905ee53026f96b78a505f1b76b6031b.camel@sina.com> <0c552a0ee114314ceb026d65f75a98df3e8d22ff.camel@cybertec.at> <34d85bfc77e9a63890e28ea13953c30508233469.camel@cybertec.at> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.30.1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Wed, 2018-10-10 at 18:21 +0200, Laurenz Albe wrote: > magodo wrote: > > > By default, recovery will stay on the timeline where it started. > > > If you want to go to timeline 2 or 3, you have to specify > > > recovery_target_timeline. > > > > > For me, the specified point corresponds to timeline 1, because at > > that > > time, the timeline is 1 indeed (when there is no timeline 2 > > branched > > out yet). > > > > So in other word, my expectation is like I want to get the first > > timeline which covers the specified time. > > > > As you mentioned, there is no active timeline concept in postgres, > > then > > what is the best practice to meet my expectation? Do I have to > > somehow > > record the timestamp when archived wal's timeline has been changed, > > then compare the specified recovery target time with those records > > to > > find the first timeline which covers that time? > > As I wrote, that is the default behavior; PostgreSQL will stay on > the timeline that was active when recovery was started. > > Yours, > Laurenz Albe OK... Just take another example: A B BASE-----+-----+------o1 (recover to A) 1 | | C +.....|.......----+---o2 (regret, recover to B) 2 | | +...........|..------o3 (regret again, recover to C) 3 | +........---- 4 Suppose I'm at "o3" and want to recover to point "C". Because I want to recover to the first timeline which covers this time point, it means I wish to recover to timeline 2. Then the same question: > > what is the best practice to meet my expectation? Do I have to > > somehow > > record the timestamp when archived wal's timeline has been changed, > > then compare the specified recovery target time with those records > > to > > find the first timeline which covers that time? --- Magodo