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 1g7aJB-0006F8-5N for pgsql-general@arkaria.postgresql.org; Wed, 03 Oct 2018 06:06:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1g7aJ8-0007hr-MQ for pgsql-general@arkaria.postgresql.org; Wed, 03 Oct 2018 06:06:50 +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 1g7aJ8-0007hj-6R for pgsql-general@lists.postgresql.org; Wed, 03 Oct 2018 06:06:50 +0000 Received: from mx2.mailbox.org ([80.241.60.215]) by makus.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1g7aJ0-0000RD-Mn for pgsql-general@postgresql.org; Wed, 03 Oct 2018 06:06:49 +0000 Received: from smtp1.mailbox.org (unknown [IPv6:2001:67c:2050:105:465:1:1:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx2.mailbox.org (Postfix) with ESMTPS id 01D98413E8; Wed, 3 Oct 2018 08:06:38 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by gerste.heinlein-support.de (gerste.heinlein-support.de [91.198.250.173]) (amavisd-new, port 10030) with ESMTP id mhmHzxnAJp1v; Wed, 3 Oct 2018 08:06:37 +0200 (CEST) Message-ID: <0c552a0ee114314ceb026d65f75a98df3e8d22ff.camel@cybertec.at> Subject: Re: how to identify the timeline of specified recovery_target_time when do multiple PITR From: Laurenz Albe To: magodo , pgsql-general@postgresql.org Date: Wed, 03 Oct 2018 08:06:35 +0200 In-Reply-To: <29dd7b5cf905ee53026f96b78a505f1b76b6031b.camel@sina.com> References: <29dd7b5cf905ee53026f96b78a505f1b76b6031b.camel@sina.com> Organization: Cybertec Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk magodo wrote: > I read the document about recovery configuration, it says: [...] > Therefore, suppose I am going to recover to a point of some child > timeline, to identify the point, I have to specify either > recovery_target_name or recovery_target_time, and also specify the > recovery_target_timeline. > > It is more like a tuple like (recovery_target_time, > recovery_target_timeline), that specify a real point among all history > branches. Am I understand this correctly? I think you understood the concept well enough. > If yes, what I want to ask is that, though the timeline is increasing > between different recovery, but each timestamp corresponds to a > timeline ID, one by one. So if I get a recovery_target_time, why should > I still specify the recovery_target_timeline? > > Suppose following illustration: > > A B > BASE-----+-----+------o1 (recover to A) 1 > | | C > +.....|.......----+---o2 (regret, recover to B) 2 > | | > +...........|..------o3 (regret again, recover to C) 3 > | > +........---- 4 Consider this ^ point in time. | Suppose you specify this point in time as recovery_target_time. Then it is not clear which of the timelines you want to follow. The point of time exists in timeline 1, 2 and 3. In other words, should recovery use the WAL from 0000000100000ABC00000012, 0000000200000ABC00000012 or 0000000300000ABC00000012? 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. Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com