Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Yl0PW-0006H7-8N for pgsql-hackers@arkaria.postgresql.org; Wed, 22 Apr 2015 19:34:14 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Yl0PV-00047O-EP for pgsql-hackers@arkaria.postgresql.org; Wed, 22 Apr 2015 19:34:13 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Yl0PU-00047E-AK for pgsql-hackers@postgresql.org; Wed, 22 Apr 2015 19:34:12 +0000 Received: from mail-wi0-x22f.google.com ([2a00:1450:400c:c05::22f]) by magus.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1Yl0PQ-0001RX-Tw for pgsql-hackers@postgresql.org; Wed, 22 Apr 2015 19:34:11 +0000 Received: by widdi4 with SMTP id di4so190422774wid.0 for ; Wed, 22 Apr 2015 12:34:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:reply-to:user-agent:mime-version:to:cc :subject:references:in-reply-to:content-type :content-transfer-encoding; bh=A/JWlzSLBht/ZN7uefYO5jE+txOHyt2+4Dd+Xamztu8=; b=evw6KASRTSuJxtVhgNqGBq8JxnTKohyQIgZvwVN6OeiwqagCS0Fh1JNC4Z4hwatEaM N+uE1de/1sk87tZpXkDs+lJ1GC+BL+lS1QATa1P2W1aGe6LP4ui5r6Xd5M2gygpQUV0q 4LaZMlKQcXcxmK7Ot9xMdPpMaY8280A2b+7JHBN0EK/CWX0aURVOKyk/5ux9TRvQwKZa YcXRMY1FsmVqFxca67JnVFDaNmlWGsxgQJFYAGXtHFbmKEsF5NdlkFgTg5MsngcBab4u X3l76CaQmuSmdL/ofzTbha2pGN9Xbz/nFXqQfSzk9Zikwgc9DjYEgOXu36eUEW9+ZeeS PQ5g== X-Received: by 10.180.78.135 with SMTP id b7mr8712369wix.65.1429731247721; Wed, 22 Apr 2015 12:34:07 -0700 (PDT) Received: from [192.168.1.99] (dsl-hkibrasgw1-58c38f-82.dhcp.inet.fi. [88.195.143.82]) by mx.google.com with ESMTPSA id w5sm9064375wiz.11.2015.04.22.12.34.05 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Apr 2015 12:34:06 -0700 (PDT) Message-ID: <5537F7AD.1060604@iki.fi> Date: Wed, 22 Apr 2015 22:34:05 +0300 From: Heikki Linnakangas Reply-To: hlinnaka@iki.fi User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.6.0 MIME-Version: 1.0 To: Robert Haas CC: Michael Paquier , Venkata Balaji N , Andres Freund , Fujii Masao , Borodin Vladimir , PostgreSQL-development Subject: Re: Streaming replication and WAL archive interactions References: <548AF1CB.80702@vmware.com> <689EB259-44C2-4820-B901-4F6B1C55A1E4@simply.name> <549083D6.1000301@vmware.com> <54949108.3030109@vmware.com> <552FA38F.9060005@iki.fi> <5535FE71.1010905@iki.fi> <55362CAD.2000207@iki.fi> <55373D17.5050706@iki.fi> <5537EFEF.6060808@iki.fi> In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.4 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 04/22/2015 10:21 PM, Robert Haas wrote: > On Wed, Apr 22, 2015 at 3:01 PM, Heikki Linnakangas wrote: >> For example, imagine that perform point-in-time recovery to WAL position >> 0/1237E568, on timeline 1. That falls within segment >> 000000010000000000000012. Then we end recovery, and switch to timeline 2. >> After the switch, and some more WAL-logged actions, we'll have these files >> in pg_xlog: >> >> 000000010000000000000011 >> 000000010000000000000012 >> 000000020000000000000012 >> 000000020000000000000013 >> 000000020000000000000014 > > Is the 000000010000000000000012 file a "partial" segment of the sort > you're proposing to no longer achive? If you did pure archive recovery, with no streaming replication involved, then no. If it was created by streaming replication, and the replication had not filled the whole segment yet, then yes, it would be a partial segment. >> Note that there are two segments ending in "12". They both have the same >> point up to offset 0x37E568, corresponding to the switch point 0/1237E568. >> After that, the contents diverge: the segment on the new timeline contains a >> checkpoint/end-of-recovery record at that point, followed by new WAL >> belonging to the new timeline. > > Check. > >> Recovery knows about that, so that if you set recovery target to timeline 2, >> and it needs the WAL at the beginning of segment 12 (still belonging to >> timeline 1), it will try to restoring both "000000010000000000000012" and >> "000000020000000000000012". > > What if you set the recovery target to timeline 3? It depends how timeline 3 was created. If timeline 3 was forked off from timeline 2, then recovery would find it. If it was forked off directly from timeline 1, then no. - Heikki -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers