Skip site navigation (1) Skip section navigation (2)

Re: somewhat wrong archive_command example

From: Euler Taveira de Oliveira <euler(at)timbira(dot)com>
To: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
Cc: Greg Smith <greg(at)2ndquadrant(dot)com>, pgsql-docs(at)postgresql(dot)org
Subject: Re: somewhat wrong archive_command example
Date: 2011-09-22 19:58:25
Message-ID: 4E7B9361.4050109@timbira.com (view raw or flat)
Thread:
Lists: pgsql-docs
On 22-09-2011 16:29, Josh Kupershmidt wrote:
> On Thu, Sep 22, 2011 at 2:41 PM, Euler Taveira de Oliveira
> <euler(at)timbira(dot)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
>
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

In response to

pgsql-docs by date

Next:From: Jaime CasanovaDate: 2011-09-23 03:50:47
Subject: synchronous_commit is not boolean anymore
Previous:From: Josh KupershmidtDate: 2011-09-22 19:29:25
Subject: Re: somewhat wrong archive_command example

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group