Re: somewhat wrong archive_command example - Mailing list pgsql-docs

From Josh Kupershmidt
Subject Re: somewhat wrong archive_command example
Date
Msg-id CAK3UJREJd31vOd3QPrWTbB9a86D9HPV4PRNuc-B8gB5kxHT0OQ@mail.gmail.com
Whole thread Raw
In response to Re: somewhat wrong archive_command example  (Euler Taveira de Oliveira <euler@timbira.com>)
Responses Re: somewhat wrong archive_command example
List pgsql-docs
On Thu, Sep 22, 2011 at 2:41 PM, Euler Taveira de Oliveira
<euler@timbira.com> 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

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.

Josh

pgsql-docs by date:

Previous
From: Euler Taveira de Oliveira
Date:
Subject: Re: somewhat wrong archive_command example
Next
From: Euler Taveira de Oliveira
Date:
Subject: Re: somewhat wrong archive_command example