pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephen Frost <sfrost@snowman.net>
To: sonicmonkey@gmail.com
To: pgsql-docs@lists.postgresql.org
Subject: Re: pg_basebackup application does not dump all database objects
Date: Tue, 16 May 2023 10:14:45 -0400
Message-ID: <ZGOP1Tu5bDBkLIdE@tamriel.snowman.net> (raw)
In-Reply-To: <168423776321.714.17805484409630880522@wrigleys.postgresql.org>
References: <168423776321.714.17805484409630880522@wrigleys.postgresql.org>

Greetings,

* PG Doc comments form (noreply@postgresql.org) wrote:
> It would be good to point out on the pg_basebackup documentation that it
> behaves differently from
> 
> SELECT * FROM pg_start_backup('label', true, false);
> cp -a xxx yyy
> SELECT * FROM pg_stop_backup(false, true);

... that's not actually a backup.  Doing the above, you won't get a
backup_label and unless you take other steps, PG will end up thinking
it's doing crash recovery.  That's not good and can lead to corruption.
If you're going to consider taking a low-level backup you should read
the documentation here:

https://www.postgresql.org/docs/15/continuous-archiving.html#BACKUP-LOWLEVEL-BASE-BACKUP

Which specifically goes into the question about replication slots.

> method. One thing discovered was that the latter retains replication slot
> information on the clone while pg_basebackup discards all replication slot
> information. Not sure if it is a feature or a bug (replication slots
> retention is a good thing).

Our documentation points out a number of reasons why it's not, I'd
suggest you read the above.

> And perhaps there are more such subtle differences?

Not sure that there's really that many other differences between
pg_basebackup and a properly implemented low-level backup.  You
certainly have to do a lot more than what you have above to have a
properly implemented low-level backup though.

Thanks,

Stephen

Attachments:

  [application/pgp-signature] signature.asc (832B, ../ZGOP1Tu5bDBkLIdE@tamriel.snowman.net/2-signature.asc)
  download

view thread (5+ messages)  latest in thread

Message-ID: <ZGOP1Tu5bDBkLIdE@tamriel.snowman.net>
Permalink:  ../ZGOP1Tu5bDBkLIdE@tamriel.snowman.net/
Also on:    postgresql.org/message-id/ZGOP1Tu5bDBkLIdE@tamriel.snowman.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-docs@postgresql.org
  Cc: sfrost@snowman.net, sonicmonkey@gmail.com, pgsql-docs@lists.postgresql.org
  Subject: Re: pg_basebackup application does not dump all database objects
  In-Reply-To: <ZGOP1Tu5bDBkLIdE@tamriel.snowman.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox