Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XGtsn-00075i-VF for pgsql-docs@arkaria.postgresql.org; Mon, 11 Aug 2014 17:59:46 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XGtsn-0004GJ-76 for pgsql-docs@arkaria.postgresql.org; Mon, 11 Aug 2014 17:59:45 +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 1XGtsm-0004GC-LY for pgsql-docs@postgresql.org; Mon, 11 Aug 2014 17:59:44 +0000 Received: from 01.zmailcloud.com ([192.198.85.104] helo=mx-out-1.zmailcloud.com) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XGtsi-0001sq-3d for pgsql-docs@postgresql.org; Mon, 11 Aug 2014 17:59:43 +0000 Received: from smtp.01.com (smtp.01.com [10.10.0.43]) by mx-out-1.zmailcloud.com (Postfix) with ESMTP id E17AD563E95; Mon, 11 Aug 2014 12:59:37 -0500 (CDT) Received: from localhost (localhost [127.0.0.1]) by smtp-out-2.01.com (Postfix) with ESMTP id D7FA8602B0; Mon, 11 Aug 2014 12:59:37 -0500 (CDT) X-Virus-Scanned: amavisd-new at smtp-out-2.01.com Received: from smtp.01.com ([127.0.0.1]) by localhost (smtp-out-2.01.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 8zjit7OPiEtB; Mon, 11 Aug 2014 12:59:37 -0500 (CDT) Received: from smtp.01.com (localhost [127.0.0.1]) by smtp-out-2.01.com (Postfix) with ESMTP id B86856028A; Mon, 11 Aug 2014 12:59:37 -0500 (CDT) Received: from localhost (localhost [127.0.0.1]) by smtp-out-2.01.com (Postfix) with ESMTP id A15FB60276; Mon, 11 Aug 2014 12:59:37 -0500 (CDT) X-Virus-Scanned: amavisd-new at smtp-out-2.01.com Received: from smtp.01.com ([127.0.0.1]) by localhost (smtp-out-2.01.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id KLl9qBws7KKH; Mon, 11 Aug 2014 12:59:37 -0500 (CDT) Received: from [172.47.23.104] (70-36-143-82.dsl.dynamic.sonic.net [70.36.143.82]) by smtp-out-2.01.com (Postfix) with ESMTPSA id 4418560284; Mon, 11 Aug 2014 12:59:37 -0500 (CDT) Message-ID: <53E90488.9040103@agliodbs.com> Date: Mon, 11 Aug 2014 10:59:36 -0700 From: Josh Berkus Organization: PostgreSQL Experts Inc. User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: Kevin Grittner , "pgsql-docs@postgresql.org" Subject: Re: Sample archive_command is still problematic References: <53E5603B.5040102@agliodbs.com> <1407777686.41146.YahooMailNeo@web122306.mail.ne1.yahoo.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-docs Precedence: bulk Sender: pgsql-docs-owner@postgresql.org On 08/11/2014 10:21 AM, Kevin Grittner wrote: >> Is there some good reason why "test ! -f" was added to the >> sample? > > In an environment with more than one cluster archiving, it is > otherwise way too easy to copy a config file and have the WAL files > of the two systems overwriting one another. I consider a check for > an already existing file on the target to be very good practice. > The errors in the log are a clue that something went wrong, and > gives you a chance to fix things without data loss. It depends on what you're guarding against. In the case I was dealing with, the master crashed in the middle of an archive write. As a result, the file existed, but was incomplete, and *needed* to be overwritten. But because of 'test -f' archiving just kept failing. > The problem with the recommended command is that cp is not atomic. > The file can be read before the contents are materialized, causing > early end to recovery. I have seen it happen. The right way to do > this is to copy to a different name or directory and mv the file > into place once it is complete -- or use software which does that > automatically, like rsync does. Yeah, realistically, I think we need to start supplying a script or two in /contrib and referencing that. I'm not sure how to make it work for the Windows users though. -- Josh Berkus PostgreSQL Experts Inc. http://pgexperts.com -- Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-docs