Re: What's the dfifference between pg_start_backup+copy+pg_stop_backup+WAL vs. pg_start_backup+pg_stop_backup+copy+WAL?

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Thorsten Schöning <tschoening(at)am-soft(dot)de>, pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: Re: What's the dfifference between pg_start_backup+copy+pg_stop_backup+WAL vs. pg_start_backup+pg_stop_backup+copy+WAL?
Date: 2021-07-23 16:26:18
Message-ID: 32a24a871174e9362225be407a234251e837d9aa.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Fri, 2021-07-23 at 16:12 +0200, Thorsten Schöning wrote:
> I think your example is bad: If both rows are added in independent
> transactions, possibly inconsistent table data simply needs to be
> accepted. No backup mechanism will change anything on that, because
> the second row might always be inserted "too late".

Stephen has already pointed out the flaws in your reasoning, so let
me illustrate my example in more detail:

You add the rows in A and B in two different transactions: first
the row in A, then the dependent row in B.

At that time the data file for A has already been backed up.
After both rows are committed, the data file for B is backed up.

Now if you replay WAL to a point in time before all that took
place (which you can do, because your BACKUP_END record was written
before you started your backup), you will have the row in B, but
not the row in A. Data corruption.

Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Ron Watkins 2021-07-23 16:35:42 Backup/Restore
Previous Message Stephen Frost 2021-07-23 15:24:19 Re: What's the dfifference between pg_start_backup+copy+pg_stop_backup+WAL vs. pg_start_backup+pg_stop_backup+copy+WAL?