Re: pg_basebackup application does not dump all database objects

Поиск
Список
Период
Сортировка
От Kristjan Mustkivi
Тема Re: pg_basebackup application does not dump all database objects
Дата
Msg-id CAOQPKasMoWOkdRSVa43G7ngT6dzAef4a6GptYPqx7X8UHbbovA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: pg_basebackup application does not dump all database objects  (Stephen Frost <sfrost@snowman.net>)
Ответы Re: pg_basebackup application does not dump all database objects  (Stephen Frost <sfrost@snowman.net>)
Список pgsql-docs
Hi Stephen,

Thank you very much for the feedback and a reference! I was under the
impression that pg_basebackup does everything
pg_start_backup/pg_stop_backup but with a more user-friendly manner
and additional steps. But they are then functionally different. For my
particular case the pg_start_backup/pg_stop_backup approach was better
as it retained the replication slots as well (the end goal was to move
the db from old hardware to the new one and have it on the new hw
exactly as it was on the old one). So I was surprised that
pg_basebackup did not bring the rep slots along.

With best regards,

Kristjan

On Tue, May 16, 2023 at 5:14 PM Stephen Frost <sfrost@snowman.net> wrote:
>
> 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



--
Kristjan Mustkivi

Email: kristjan.mustkivi@gmail.com



В списке pgsql-docs по дате отправления:

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: Postgres 14 documentation suggests range_agg is available, but it's not until Postgres 15
Следующее
От: Stephen Frost
Дата:
Сообщение: Re: pg_basebackup application does not dump all database objects