Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id D148DB5DC3E for ; Thu, 22 Sep 2011 17:06:22 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 58312-02 for ; Thu, 22 Sep 2011 20:06:15 +0000 (UTC) X-Greylist: delayed 00:06:39.790465 by SQLgrey-1.8.0-rc2 Received: from oproxy8-pub.bluehost.com (oproxy8-pub.bluehost.com [69.89.22.20]) by mail.postgresql.org (Postfix) with SMTP id 67AC9B5DC0F for ; Thu, 22 Sep 2011 17:06:15 -0300 (ADT) Received: (qmail 14879 invoked by uid 0); 22 Sep 2011 19:59:34 -0000 Received: from unknown (HELO host159.hostmonster.com) (74.220.207.159) by oproxy8.bluehost.com with SMTP; 22 Sep 2011 19:59:34 -0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=timbira.com; s=default; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:References:Subject:CC:To:MIME-Version:From:Date:Message-ID; bh=ns5xuep0btn63djaPDkaoY01DupiCQhGHzbwff4ye2M=; b=ZKyh2K7Gg9GXxX0sDOfePSHbdrCLB3/RIpCSpP4XlTeGSWOUTj17NMkrW0ux9jVSOm8XJA6FqJnVlljMT5NFRsEnQ6FyY1sYSn2qYfjJzmarJiAtbQjPqE5DieyEgNzA; Received: from [201.2.89.169] (helo=[10.3.2.2]) by host159.hostmonster.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1R6pQk-0001cs-7a; Thu, 22 Sep 2011 13:59:34 -0600 Message-ID: <4E7B9361.4050109@timbira.com> Date: Thu, 22 Sep 2011 16:58:25 -0300 From: Euler Taveira de Oliveira User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.21) Gecko/20110831 Icedove/3.1.13 MIME-Version: 1.0 To: Josh Kupershmidt CC: Greg Smith , pgsql-docs@postgresql.org Subject: Re: somewhat wrong archive_command example References: <1316524671.9044.12.camel@fsopti579.F-Secure.com> <4E794FB5.80400@2ndQuadrant.com> <1316613536.14119.6.camel@fsopti579.F-Secure.com> <4E7A6D0D.4060106@2ndQuadrant.com> <4E7A887F.8010908@timbira.com> <4E7B815B.7080500@timbira.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Identified-User: {1651:host159.hostmonster.com:timbirac:timbira.com} {sentby:smtp auth 201.2.89.169 authed with euler@timbira.com} X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201109/73 X-Sequence-Number: 6994 On 22-09-2011 16:29, Josh Kupershmidt wrote: > On Thu, Sep 22, 2011 at 2:41 PM, Euler Taveira de Oliveira > wrote: >> On 22-09-2011 15:15, Josh Kupershmidt wrote: >>> 1.) IMO it's more logical to put the test for whether the $ARCHIVE >>> directory exists before the test whether ${ARCHIVE}/${FILE} exists. >> >> No. If you do so, it will end up wasting a lot of cpu cycles testing >> something that is *always* true (if the directory exists). AFAICS this test >> is to handle a cp failure case nicely. > > Maybe I misunderstand you.. I was talking about this test, which was > in Greg's script already: > > if [ ! -d ${ARCHIVE} ] ; then > echo Archive directory does not exist>&2 > exit 1 > fi > No, I don't. > I don't see how it would make any difference performance-wise whether > this block is moved up to right before the "if [ -f ${ARCHIVE}/${FILE} > ] ; then" line: we expect both of these if-statements to evaluate > false if they are reached. > If the archive directory exists, it will test at least 2 times per check otherwise just one time per check (unless there is a new wal file -- in this case 2 times per check). It is not necessary to move up the test. As I said, the directory check is only for predict a cp failure. -- Euler Taveira de Oliveira - Timbira http://www.timbira.com.br/ PostgreSQL: Consultoria, Desenvolvimento, Suporte 24x7 e Treinamento