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 1gASh1-0003ZW-Bc for pgsql-general@arkaria.postgresql.org; Thu, 11 Oct 2018 04:35:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gASgz-0004fn-Er for pgsql-general@arkaria.postgresql.org; Thu, 11 Oct 2018 04:35:21 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gASgz-0004fd-6g for pgsql-general@lists.postgresql.org; Thu, 11 Oct 2018 04:35:21 +0000 Received: from mx1.mailbox.org ([2001:67c:2050:104:0:1:25:1]) by magus.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gASgr-0001U7-Vn for pgsql-general@postgresql.org; Thu, 11 Oct 2018 04:35:20 +0000 Received: from smtp1.mailbox.org (smtp1.mailbox.org [80.241.60.240]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.mailbox.org (Postfix) with ESMTPS id 8167C48A11; Thu, 11 Oct 2018 06:35:10 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by hefe.heinlein-support.de (hefe.heinlein-support.de [91.198.250.172]) (amavisd-new, port 10030) with ESMTP id X_f4b4JFHaRW; Thu, 11 Oct 2018 06:35:08 +0200 (CEST) Message-ID: 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: Thu, 11 Oct 2018 06:35:06 +0200 In-Reply-To: <41a74e2ac23015149bc98631b8dcac0fdb6b6a51.camel@sina.com> References: <29dd7b5cf905ee53026f96b78a505f1b76b6031b.camel@sina.com> <0c552a0ee114314ceb026d65f75a98df3e8d22ff.camel@cybertec.at> <34d85bfc77e9a63890e28ea13953c30508233469.camel@cybertec.at> <41a74e2ac23015149bc98631b8dcac0fdb6b6a51.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: > 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. Ah, I finally understand your question. You assume tht timeline 1 and 2 have ended (that's how you drew it), and that consequently timeline 3 is the "earliest existing" timeline, so why doesn't PostgreSQL choose that one automatically? Even though you drew it that way, timeline 1 and 2 have not ended, in a way. There may be more on them. How should PostgreSQL know what is the last WAL entry on a certain timeline? For that, it would have to restore and examine *all* WAL segments on that timeline until that fails. But that is unreasonable because of the potential amount of time and work involved. Rather, PostgreSQL has to decide at the point where timeline 2 branches off which one it should follow. Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com