Re: What is the correct steps if tar process is killed during pg_start_backup() and pg_stop_backup()

From: Matheus de Oliveira <matioli(dot)matheus(at)gmail(dot)com>
To: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
Cc: Shih Théo *EXTERN* <galaxyshih(at)gmail(dot)com>, "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: What is the correct steps if tar process is killed during pg_start_backup() and pg_stop_backup()
Date: 2015-07-15 11:50:59
Message-ID: CAJghg4KZi8mKoauhabGMhU067CcaMZvBSn4gvFF9qjuhMcJLgQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Wed, Jul 15, 2015 at 6:10 AM, Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
wrote:

> > Q2) What if I decide to re-tar again my data,
> > should I need to invoke pg_stop_backup() first and perform
> pg_start_backup() -> tar ->
> > pg_stop_backup()?
>
> No, that is not necessary.
>

I'd say that although it is not necessary, it is a good practice. As you
are going to do the copy all over again, better reduce the window required
for recovery. If you don't call pg_stop_backup, the restore will consider
the first needed WAL file to be the one returned by the call of
pg_start_backup; if this call and the tar error are not very closer in time
and you have a lot of activity in the system that generated many WAL files,
then the restore will require more WAL files then it is actually necessary.

Besides, if you are doing an script for this procedure, you'd better have
the script handle the error and call the pg_stop_backup directly.

At last, any reason for not using pg_basebackup in this case? I'd say it is
preferred over pg_start_backup+tar+pg_stop_backup, and less error prone.

Regards,
--
Matheus de Oliveira

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Ryan King - NOAA Affiliate 2015-07-15 14:13:53 Re: could not create shared memory segment: Invalid argument
Previous Message Albe Laurenz 2015-07-15 09:10:19 Re: What is the correct steps if tar process is killed during pg_start_backup() and pg_stop_backup()