public inbox for [email protected]  
help / color / mirror / Atom feed
From: Euler Taveira de Oliveira <[email protected]>
To: Josh Kupershmidt <[email protected]>
Cc: Greg Smith <[email protected]>
Cc: [email protected]
Subject: Re: somewhat wrong archive_command example
Date: Thu, 22 Sep 2011 16:58:25 -0300
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAK3UJREJd31vOd3QPrWTbB9a86D9HPV4PRNuc-B8gB5kxHT0OQ@mail.gmail.com>
References: <[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<CAK3UJRHChOcGQ0kzu01wZX6PB9pScHSzg1X+hThdR7QXWoe1yw@mail.gmail.com>
	<[email protected]>
	<CAK3UJREJd31vOd3QPrWTbB9a86D9HPV4PRNuc-B8gB5kxHT0OQ@mail.gmail.com>

On 22-09-2011 16:29, Josh Kupershmidt wrote:
> On Thu, Sep 22, 2011 at 2:41 PM, Euler Taveira de Oliveira
> <[email protected]>  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



view thread (24+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: somewhat wrong archive_command example
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox