Re: Backup Question

From: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "Shaun Thomas *EXTERN*" <sthomas(at)optionshouse(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Backup Question
Date: 2013-10-23 07:54:33
Message-ID: A737B7A37273E048B164557ADEF4A58B17C50987@ntex2010i.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Shaun Thomas wrote:
>> Wrong. The database cannot check all data for consistency
>> upon backup. For one, that would take way too long.
>
> Well, what I meant, was that it would stop the database if it couldn't
> apply one of the transaction logs for whatever reason. It wasn't
> "inconsistent enough" for that. :)

It would not stop the database, it would stop applying the WALs
and run into an endless loop (contact primary, get told that it doesn't
have the WAL, try to read archive logs, fail, reiterate).

> > If you backup the standby, then you won't have a backup_label file.
> > You cannot restore a backup without that.
>
> Well, the backup_label gets copied to the archive log path when
> pg_stop_backup gets called. So, I do have it. But beyond that, I have
> the start/stop WAL locations, so I can get all the required files to apply,
> which are all that is really necessary.
>
>> Moreover, recovery needs a checkpoint/restartpoint to start.
>> Restartpoints on the standby won't be the same as checkpoints
>> on the primary, so I believe that even with the backup_label
>> file you would not be able to restore the data.
>
> I suppose I could build in a function to pause the backup until the
> restartpoint replays on the replica. Then at least, the backup "starts"
> on both systems with the same assumptions.

I'm not sure if checkpoints on primary and standby are synchronized.

Why don't you just shutdown the standby and take an offline
backup? That could certainly be used for PITR.
After the backup, restart the standby and let it catch up.

Yours,
Laurenz Albe

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Rémi Cura 2013-10-23 07:59:37 Re: Count of records in a row
Previous Message Rémi Cura 2013-10-23 07:52:22 Re: [postgis-users] Error with "return query" ( "return next" working ) with custom type