Re: standalone hot backup docs

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: standalone hot backup docs
Date: 2007-12-17 09:02:18
Message-ID: 200712170902.lBH92IG26283@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andrew Dunstan wrote:
>
> The docs contain the following example of an archive_command for use
> with standalone hot backup:
>
> test -f /var/lib/pgsql/backup_in_progress && cp -i %p
> /var/lib/pgsql/archive/%f </dev/null
>
> Unfortunately, as I found out when I tried it, this command returns a
> non-zero (on Linux/bash) when the backup_in_progress file doesn't exist,
> which means that we keep accumulating WAL files when we should be
> recycling them.
>
> ISTM it would be better to use this:
>
> if test -f /var/lib/pgsql/backup_in_progress ; then cp -i %p
> /var/lib/pgsql/archive/%f </dev/null ; fi
>
> which only returns non-zero if the copy fails.
>
> If there's no objection I'll patch the docs accordingly - should they be
> backpatched also?

Yea, that example was wrong. Good catch. I did found a cleaner way to
implement it though:

archive_command = 'test ! -f /var/lib/pgsql/backup_in_progress || cp -i %p /var/lib/pgsql/archive/%f &lt; /dev/null'

That keeps the one-line format rather than the 'if' block with semicolons
required. I have applied this to CVS.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://postgres.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2007-12-17 09:20:34 Re: WORM and Read Only Tables (v0.1)
Previous Message Heikki Linnakangas 2007-12-17 08:09:17 Re: Requesting clarification on Vacuuming/Freezing behaviour