Re: reassure me that it's good to copy pg_control last in a base backup

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Chapman Flack <chap(at)anastigmatix(dot)net>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: reassure me that it's good to copy pg_control last in a base backup
Date: 2017-12-22 06:07:00
Message-ID: 20171222060700.GC15816@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Dec 22, 2017 at 12:46:01AM -0500, Chapman Flack wrote:
> I was noticing that terminology in the long backup-from-standby thread
> I was reading, but it wasn't clear to me how the terms originated.
> What's exclusive about pg_start_backup/copy/pg_stop_backup? And what's
> nonexclusive about pg_basebackup (which, AFAICS, is following roughly
> the same sequence under the hood)?

You can run an exclusive backup only once at a time in a given PostgreSQL
server as it uses the on-disk backup_label file to determine the state the
server is in, while non-exclusive backups can be run across many sessions,
at the cost that you need to maintain the session alive for the duration
of the backup. pg_basebackup uses always non-exclusive backups, so it
never creates an on-disk backup_label file on the instance from which the
backup is taken but it writes the file by itself. pg_start_backup and
pg_stop_backup include a set of optional arguments to control if you want
to do a non-exclusive or an exclusive backup, the default being exclusive.
Non-exclusive backups can also be run while an exclusive backup is running.

> By the way, what does happen in that case? I'm guessing it wakes up,
> sees the backup_label file, decides it's doing a PITR, and starts
> replaying already-applied WAL from the start-of-backup checkpoint,
> rather than from the most recent one? Oops.

In short, yes. And it does not find the backup end record as well.
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Adam Lee 2017-12-22 06:10:36 Should we nonblocking open FIFO files in COPY?
Previous Message Kyotaro HORIGUCHI 2017-12-22 06:03:20 Re: [HACKERS] Restricting maximum keep segments by repslots