Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XGuSR-0008OT-54 for pgsql-docs@arkaria.postgresql.org; Mon, 11 Aug 2014 18:36:35 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XGuSQ-00054A-GP for pgsql-docs@arkaria.postgresql.org; Mon, 11 Aug 2014 18:36:34 +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 1XGuSP-000543-HS for pgsql-docs@postgresql.org; Mon, 11 Aug 2014 18:36:33 +0000 Received: from nm17-vm6.bullet.mail.ne1.yahoo.com ([98.138.91.110]) by makus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XGuSM-0000fC-3m for pgsql-docs@postgresql.org; Mon, 11 Aug 2014 18:36:31 +0000 Received: from [98.138.100.113] by nm17.bullet.mail.ne1.yahoo.com with NNFMP; 11 Aug 2014 18:36:28 -0000 Received: from [98.138.226.164] by tm104.bullet.mail.ne1.yahoo.com with NNFMP; 11 Aug 2014 18:36:28 -0000 Received: from [127.0.0.1] by omp1065.mail.ne1.yahoo.com with NNFMP; 11 Aug 2014 18:36:28 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 718586.94694.bm@omp1065.mail.ne1.yahoo.com Received: (qmail 34565 invoked by uid 60001); 11 Aug 2014 18:36:28 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1407782188; bh=CSMc/D1woyT7wE9LD6IoYeoElJRqtzSU743jpAKcZbc=; h=References:Message-ID:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=wbV1vCc3p4oDgtDf5bcnxGoMhHWvt1JKcikceB/a6OEAa3eex8Rh3dCwqrHk3tCabIrAIjci1Kypki/8VLc32JuHR18Vife2snJFCYep4gW73HoKVJ+R9+P6nvD/hnabcZG4CTbrfpLA0wgXYGXa8eMgHkjI7Alfo6NsReu3ToE= X-YMail-OSG: 5K_r6SkVM1kqx.p86vY..hXHpXt9FtHLKP.0T81AZ4OkWwC Oo3D8HK338SDYrQaPuYosnnRITvvuFL8OGvT.ZfOJdkEm3W2ISIgYs58dhBY eV1O8AQ9KCpP.vLonfOtRe9ybN_4P6urKTSzm6FDc7e4B5uWZ_IiBn2tuR6v gI92lhOTzFK3rGJ8bY2e7Os802i01F2QJD6OnFoxeEmtgquP.JFaJ.nlfquH wu7j53ac5s8B5lYCfh7Q10roR3gqYaYafMmi_tsKwjIVbm_XgD4xRM07wBqq tR5xdfbujH_lT6N80VE8WPpbgKUFrDJ3943MvAVIyWWTrV2gdMMTZf5eTNYo Xy.gt6gv9BzZcdr.CGCAIcwfiKJdYjRzr347aogA5nuflwA8hCRr5sGvQE1k lenUmF9nEst3wxO7jS2gO30JfiPF0kXwKn_uxovGjQihqtXmgUX2cJQ4enkV e77mLDAvGCJMTU7MWtVmjhHVRPHWvgQv7KUzcwuhr8.1ZmFDqw.4dcOxO.MO LbmrQNeaOc4GtAi2L7SbZWq3lCM07qWoMqLIUNCPHI2nXDJweODKUvluezve q0iSDagY.pxs- Received: from [24.178.25.147] by web122305.mail.ne1.yahoo.com via HTTP; Mon, 11 Aug 2014 11:36:28 PDT X-Rocket-MIMEInfo: 002.001, Sm9zaCBCZXJrdXMgPGpvc2hAYWdsaW9kYnMuY29tPiB3cm90ZToKPiBPbiAwOC8xMS8yMDE0IDEwOjIxIEFNLCBLZXZpbiBHcml0dG5lciB3cm90ZToKPj4.IElzIHRoZXJlIHNvbWUgZ29vZCByZWFzb24gd2h5ICJ0ZXN0ICEgLWYiIHdhcyBhZGRlZCB0byB0aGUKPj4.IHNhbXBsZT8KPj4KPj4gSW4gYW4gZW52aXJvbm1lbnQgd2l0aCBtb3JlIHRoYW4gb25lIGNsdXN0ZXIgYXJjaGl2aW5nLCBpdCBpcwo.PiBvdGhlcndpc2Ugd2F5IHRvbyBlYXN5IHRvIGNvcHkgYSBjb25maWcgZmlsZSBhbmQgaGF2ZSB0aGUBMAEBAQE- X-Mailer: YahooMailWebService/0.8.201.700 References: <53E5603B.5040102@agliodbs.com> <1407777686.41146.YahooMailNeo@web122306.mail.ne1.yahoo.com> <53E90488.9040103@agliodbs.com> Message-ID: <1407782188.34521.YahooMailNeo@web122305.mail.ne1.yahoo.com> Date: Mon, 11 Aug 2014 11:36:28 -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: <53E90488.9040103@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: > 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.=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. > > It depends on what you're guarding against.=A0 In the case I was dealing > with, the master crashed in the middle of an archive write.=A0 As a > result, the file existed, but was incomplete, and *needed* to be > overwritten.=A0 But because of 'test -f' archiving just kept failing. I've seen that happen, too.=A0 It's just that the script I used sent an email to the DBAs when that happened, so the problem was quickly investigated and resolved.=A0 Also, our monitoring "big board" set an=20 "LED" to red if we went an hour without a new WAL appearing in the=20 archive directory.=A0 IMV the archiving script should ensure there is=20 no data loss, and you should have monitoring or alert systems in=20 place to know when things stall. >> 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. > > Yeah, realistically, I think we need to start supplying a script or two > in /contrib and referencing that.=A0 I'm not sure how to make it work for > the Windows users though. That might work.=A0 We should do something, though.=A0 The example we give in the docs is not production quality IMO, and is something of an embarrassment.=A0 The problem is, it may be hard to get agreement on what that should look like.=A0 As a DBA, I insisted on the check for an existing file.=A0 I also insisted on having scripts send an email to the DBAs on the first occurrence of a failure (but not to spam us on each and every failed attempt). -- 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