Re: incoorect restore_command

From: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Philipp Gramzow <phil(at)philphonic(dot)de>, pgsql-docs(at)lists(dot)postgresql(dot)org
Subject: Re: incoorect restore_command
Date: 2021-02-25 09:03:57
Message-ID: 06d9fc43-7ea9-20cc-191e-401136bc86fa@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

On 2021/02/25 15:54, Michael Paquier wrote:
> On Wed, Feb 24, 2021 at 08:15:59PM +0900, Fujii Masao wrote:
>> But I have one question; why do those commands use different
>> archive directories? Isn't it better to use the same one?
>
> storage.sgml uses /var/lib/pgsql/data for the location of the data,
> and the archive path is a mix between /mnt/server/archivedir/ and
> /var/lib/pgsql/archive/. However, the former is used for
> pg_archivecleanup and in postgresql.conf.sample, so why not just using
> /mnt/server/archivedir/ in backup.sgml? Please see the attached.

-archive_command = 'test ! -f /var/lib/pgsql/backup_in_progress || (test ! -f /var/lib/pgsql/archive/%f &amp;&amp; cp %p /var/lib/pgsql/archive/%f)'
+archive_command = 'test ! -f /var/lib/pgsql/backup_in_progress || (test ! -f /mnt/server/archivedir/%f &amp;&amp; cp %p /mnt/server/archivedir/%f)'

Regarding the section "Standalone Hot Backups", all the directories and
file seem to be placed under /var/lib/pgsql, so at least for me it looks a bit
strange to change only the path of archive directory. So I don't think that
we need to do this change.

-tar -rf /var/lib/pgsql/backup.tar /var/lib/pgsql/archive/
+tar -rf /var/lib/pgsql/backup.tar /mnt/server/archivedir/

Same as above.

-archive_command = 'gzip &lt; %p &gt; /var/lib/pgsql/archive/%f'
+archive_command = 'gzip &lt; %p &gt; /mnt/server/archivedir/%f.gz'
</programlisting>
You will then need to use <application>gunzip</application> during recovery:
<programlisting>
-restore_command = 'gunzip &lt; /mnt/server/archivedir/%f &gt; %p'
+restore_command = 'gunzip &lt; /mnt/server/archivedir/%f.gz &gt; %p'

LGTM. Thanks for the patch!

Regards,

--
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message PG Doc comments form 2021-02-25 13:30:09 set auto commit is not working
Previous Message Michael Paquier 2021-02-25 07:09:31 Re: pgbench: supports PGDATABASE / warning about -d