Re: Do results of pg_start_backup work without WAL segments created during backup?

From: David Steele <david(at)pgmasters(dot)net>
To: Thorsten Schöning <tschoening(at)am-soft(dot)de>, pgsql-admin <pgsql-admin(at)postgresql(dot)org>
Cc: Magnus Hagander <magnus(at)hagander(dot)net>
Subject: Re: Do results of pg_start_backup work without WAL segments created during backup?
Date: 2019-07-08 12:12:01
Message-ID: e3e7d102-5d9c-fea3-cfd4-e25c296fcd1a@pgmasters.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On 7/8/19 6:56 AM, Thorsten Schöning wrote:
>
> If the full backup works at all... :-) And if it doesn't, I would like
> to know what I don't understand yet.

It doesn't.

pg_start_backup() does a checkpoint, but then the database continues
writing as you copy the files in whatever order you choose. You may
copy a file that has a partial write or copy some files involved in a
transaction before it happens and others afterwards -- in fact this is
normal and expected.

The checkpoint constrains the range of WAL that you need, but that WAL
is absolutely needed to reconstruct the changes that happened during the
backup.

pg_basebackup is a better alternative than rolling your own and there
are third-party solutions that offer more functionality.

Above all be sure to test your backups. If you test the backups you are
currently taking you will quickly find that they do not work, i.e. they
will not recover to consistency.

Regards,
--
-David
david(at)pgmasters(dot)net

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Thorsten Schöning 2019-07-08 13:10:25 Re: Do results of pg_start_backup work without WAL segments created during backup?
Previous Message Thorsten Schöning 2019-07-08 10:56:24 Re: Do results of pg_start_backup work without WAL segments created during backup?