Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XGtHo-0005tM-UZ for pgsql-docs@arkaria.postgresql.org; Mon, 11 Aug 2014 17:21:33 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XGtHo-0003Wf-6T for pgsql-docs@arkaria.postgresql.org; Mon, 11 Aug 2014 17:21:32 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XGtHn-0003WY-10 for pgsql-docs@postgresql.org; Mon, 11 Aug 2014 17:21:31 +0000 Received: from nm6-vm4.bullet.mail.ne1.yahoo.com ([98.138.91.166]) by makus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XGtHj-0007f7-Hy for pgsql-docs@postgresql.org; Mon, 11 Aug 2014 17:21:29 +0000 Received: from [98.138.226.179] by nm6.bullet.mail.ne1.yahoo.com with NNFMP; 11 Aug 2014 17:21:26 -0000 Received: from [98.138.88.232] by tm14.bullet.mail.ne1.yahoo.com with NNFMP; 11 Aug 2014 17:21:26 -0000 Received: from [127.0.0.1] by omp1032.mail.ne1.yahoo.com with NNFMP; 11 Aug 2014 17:21:26 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 420950.364.bm@omp1032.mail.ne1.yahoo.com Received: (qmail 24547 invoked by uid 60001); 11 Aug 2014 17:21:26 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1407777686; bh=I6yqCISQCSrqZTQrgVOdC7Fmi6EahkamTUuiYMoXI5E=; h=References:Message-ID:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=pZqcuni69YrUh81fn3yXapuUY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AgL21udC9zZXJ2ZXIvYXJjaGl2ZWRpci8lZicKPgo.IFRoaXMgaXMgYSBwcm9ibGVtYXRpYyByZWNvbW1lbmRhdGlvbi4KCkkgYWdyZWUgd2l0aCB0aGF0IHN0YXRlbWVudCwgLi4uCgo.IElmIHRoZXJlJ3MgYW4BMAEBAQE- X-Mailer: YahooMailWebService/0.8.201.700 References: <53E5603B.5040102@agliodbs.com> Message-ID: <1407777686.41146.YahooMailNeo@web122306.mail.ne1.yahoo.com> Date: Mon, 11 Aug 2014 10:21:26 -0700 From: Kevin Grittner Reply-To: Kevin Grittner Subject: Re: Sample archive_command is still problematic To: Josh Berkus , "pgsql-docs@postgresql.org" In-Reply-To: <53E5603B.5040102@agliodbs.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable 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 Josh Berkus wrote: > The example archive_command we give in the docs is this one: > > archive_command =3D 'test ! -f /mnt/server/archivedir/%f && cp %p /mnt/se= rver/archivedir/%f' > > This is a problematic recommendation. I agree with that statement, ... > If there's any reason why copying the archive file gets > interrupted (storage blip, for example), then the command will > fail and will continue to fail forever, ending archiving. ... but not for that reason. > 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.=A0 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. 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.=A0 I have seen it happen.=A0 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. -- Kevin Grittner EDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company --=20 Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-docs