Re: Incremental backup from a streaming replication standby fails

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: David Steele <david(at)pgmasters(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Incremental backup from a streaming replication standby fails
Date: 2024-07-25 12:50:58
Message-ID: c8e8946bea81209e8a53591c70e7c002048c00c1.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 2024-07-24 at 15:27 -0400, Robert Haas wrote:
> On Wed, Jul 24, 2024 at 6:46 AM Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> wrote:
> >    An incremental backup is only possible if replay would begin from a later
> >    checkpoint than the checkpoint that started the previous backup upon which
> >    it depends.
>
> My concern here is that the previous backup might have been taken on a
> standby, and therefore it did not start with a checkpoint. For a
> standby backup, replay will begin from a checkpoint record, but that
> record may be quite a bit earlier in the WAL. For instance, imagine
> checkpoint_timeout is set to 30 minutes on the standby. When the
> backup is taken, the most recent restartpoint could be up to 30
> minutes ago -- and it is the checkpoint record for that restartpoint
> from which replay will begin. I think that in my phrasing, it's always
> about the checkpoint from which replay would begin (which is always
> well-defined) not the checkpoint that started the backup (which is
> only logical on the primary).

I see.

The attached patch uses your wording for the first sentence.

I left out the last sentence from your suggestion, because it sounded
like it is likely to confuse the reader. I think you just wanted to
say that there are other possible causes for an incremental backup to
fail. I want to keep the text as simple as possible and focus on the case
that I hit, because I expect that a lot of people who experiment with
incremental backup or run tests could run into the same problem.

I don't think it will be a frequent occurrence during normal operation.

Yours,
Laurenz Albe

Attachment Content-Type Size
v3-0001-Document-an-error-with-incremental-backup-on-stan.patch text/x-patch 2.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2024-07-25 13:31:05 Re: Add 64-bit XIDs into PostgreSQL 15
Previous Message Joe Conway 2024-07-25 12:48:33 Re: CI, macports, darwin version problems