Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Ykokn-0003Js-ER for pgsql-hackers@arkaria.postgresql.org; Wed, 22 Apr 2015 07:07:25 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Ykokm-0001Fd-Pt for pgsql-hackers@arkaria.postgresql.org; Wed, 22 Apr 2015 07:07:24 +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 1Ykokl-0001FV-Nf for pgsql-hackers@postgresql.org; Wed, 22 Apr 2015 07:07:23 +0000 Received: from mail-qg0-x234.google.com ([2607:f8b0:400d:c04::234]) by magus.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1Ykokh-00042R-Q2 for pgsql-hackers@postgresql.org; Wed, 22 Apr 2015 07:07:22 +0000 Received: by qgfi89 with SMTP id i89so79371759qgf.1 for ; Wed, 22 Apr 2015 00:07:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=ceVDPczr9sjMcb7xgc7jZ3oaVjF9Jp3X6/k5YurZjvs=; b=o3Fsz3ScrhkiCuEYCmiVWxk6ANeH7o7qv3cGNg4EHiAYJ/yV21+AFIVLN96Tf5fRnl MWhOMEaAH8wMnfjnSzFIdrxD4UbWLMznQ83kngqWpZcGObPWS0cGspdf3GJZsZQK6npf KrnlaSW7CYhFE/LhTco6q2q4irAjddWRqKwOTa3HocC0LCfXB/H03Nf0VIbQihqkwEfY JMKw6Pv+SrGVa7AIBSt0woW3dif3zHGcH2JOr1LUDtP2hsLBdrPEK/z9p2VqYmCnFWME 0e+gRn83n4SzbjlNZiz2effUaYX/ZIvnL5pKWvqkp8gAy6hxisdIKlwqUMLEW0P87J8x 1gHg== MIME-Version: 1.0 X-Received: by 10.55.20.2 with SMTP id e2mr45377368qkh.52.1429686437574; Wed, 22 Apr 2015 00:07:17 -0700 (PDT) Received: by 10.140.97.69 with HTTP; Wed, 22 Apr 2015 00:07:17 -0700 (PDT) In-Reply-To: <553741FE.1080403@iki.fi> 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> <553741FE.1080403@iki.fi> Date: Wed, 22 Apr 2015 16:07:17 +0900 Message-ID: Subject: Re: Streaming replication and WAL archive interactions From: Michael Paquier To: hlinnaka@iki.fi Cc: Robert Haas , Venkata Balaji N , Andres Freund , Fujii Masao , Borodin Vladimir , PostgreSQL-development Content-Type: text/plain; charset=ISO-8859-1 X-Pg-Spam-Score: -2.7 (--) 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 Wed, Apr 22, 2015 at 3:38 PM, Heikki Linnakangas wrote: > On 04/22/2015 03:30 AM, Michael Paquier wrote: >> >> This is going to change a behavior that people are used to for a >> couple of releases. I would not mind having this patch do >> "archive_mode = on during recovery" => archive only segments generated >> by this node + the last partial segment on the old timeline at >> promotion, without renaming to preserve backward compatible behavior. >> If master and standby point to separate archive locations, this way >> the operator can sort out later the one he would want to use. If they >> point to the same location, archive_command scripts already do >> internally such renaming, at least that's what I suspect an >> experienced user would do, now it is true that not many people are >> experienced in this area I see mistakes regarding such things on a >> weekly basis... This .partial segment renaming is something that we >> should let the archive_command manage with its internal logic. > > > Currently, the archive command doesn't know if the segment it's archiving is > partial or not, so you can't put any logic there to manage it. But if we > archive it with the .partial suffix, then you can put logic in the > restore_command to check for .partial files, if you really want to. Well, now you can check as well if there is a file with the same name already archived and append a suffix to the new file copied, keep the two files, and then let restore_command sort things up as it wants with the two segment files it finds. > I feel that the best approach is to archive the last, partial segment, but > with the .partial suffix. I don't see any plausible real-world setup where > the current behavior would be better. I don't really see much need to > archive the partial segment at all, but there's also no harm in doing it, as > long as it's clearly marked with the .partial suffix. Well, as long as it is clearly archived at promotion, even with a suffix, I guess that I am fine... This will need some tweaking on restore_command for existing applications, but as long as it is clearly documented I am fine. Shouldn't this be a different patch though? > BTW, pg_receivexlog also uses a ".partial" file, while it's streaming WAL > from the server. The .partial suffix is removed when the segment is > complete. So there's some precedence to this. pg_receivexlog adds just > ".partial" to the filename, it doesn't add any information of what portion > of the file is valid like I suggested here, though. Perhaps we should follow > pg_receivexlog's example at promotion too, for consistency. Consistency here sounds good to me. -- Michael -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers