Re: Incremental backup from a streaming replication standby fails

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
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-24 19:27:02
Message-ID: CA+TgmobigpSed3tMqRkA16-wFCHgf4kSMrDmpiSVmKmz9YhQNQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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).

> If you take the incremental backup on the primary, this
> condition is always satisfied, because each backup triggers a new
> checkpoint. On a standby, replay begins from the most recent restartpoint.
> Therefore, an incremental backup of a standby server can fail if there has
> been very little activity since the previous backup, since no new
> restartpoint might have been created.

--
Robert Haas
EDB: http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2024-07-24 19:27:14 Re: Regarding t_cid in Neon heap WAL records
Previous Message Joe Conway 2024-07-24 19:25:37 Re: CI, macports, darwin version problems