public inbox for [email protected]
help / color / mirror / Atom feedFrom: Laurenz Albe <[email protected]>
To: Robert Haas <[email protected]>
Cc: David Steele <[email protected]>
Cc: [email protected]
Subject: Re: Incremental backup from a streaming replication standby fails
Date: Sat, 20 Jul 2024 00:07:36 +0200
Message-ID: <[email protected]> (raw)
In-Reply-To: <CA+TgmoaFVjaN-JRvBA04pp+cZ5XjYuzofVbDBMyvMhVNiS23XQ@mail.gmail.com>
References: <[email protected]>
<[email protected]>
<CA+TgmobToSs9DNynYA-iQt9m5zVAnyDCbfwGwcmEOA5zecPk4w@mail.gmail.com>
<[email protected]>
<CA+TgmoZ2FrKX6WaDd8M-zqzR9Hr7bsVFOwo5ydCbeiSYz-2NdQ@mail.gmail.com>
<[email protected]>
<CA+TgmoaFVjaN-JRvBA04pp+cZ5XjYuzofVbDBMyvMhVNiS23XQ@mail.gmail.com>
On Fri, 2024-07-19 at 16:03 -0400, Robert Haas wrote:
> On Fri, Jul 19, 2024 at 2:41 PM Laurenz Albe <[email protected]> wrote:
> > I'd be alright with the hint, but I'd say "during making an *incremental*
> > standby backup", because that's the only case where it can happen.
> >
> > I think it would also be sufficient if we document that possibility.
> > When I got the error, I looked at the documentation of incremental
> > backup for any limitations with standby servers, but didn't find any.
> > A remark in the documentation would have satisfied me.
>
> Would you like to propose a patch adding a hint and/or adjusting the
> documentation? Or are you wanting me to do that?
Here is a patch.
I went for both the errhint and some documentation.
Yours,
Laurenz Albe
Attachments:
[text/x-patch] v1-0001-Add-documentation-and-hint-for-incremental-backup.patch (2.6K, ../[email protected]/2-v1-0001-Add-documentation-and-hint-for-incremental-backup.patch)
download | inline diff:
From a46b23afc919bfa0d0aa9bdad962b95a3ae407ec Mon Sep 17 00:00:00 2001
From: Laurenz Albe <[email protected]>
Date: Sat, 20 Jul 2024 00:05:26 +0200
Subject: [PATCH v1] Add documentation and hint for incremental backup on
standbys
Taking an incremental backup on a streaming replication standby immediately
after a base backup can result in the error
manifest requires WAL from final timeline n ending at XXX, but this backup starts at YYY
This message looks scary, even though the only problem is that the backup
would be empty and thus it makes no sense to take it anyway.
Add a clarifying errhint and some documentation to mitigate the problem.
Author: Laurenz Albe
Reviewed-by: Robert Haas, David Steele
Discussion: https://postgr.es/m/[email protected]
Backpatch to v17.
---
doc/src/sgml/backup.sgml | 9 +++++++++
src/backend/backup/basebackup_incremental.c | 3 ++-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/doc/src/sgml/backup.sgml b/doc/src/sgml/backup.sgml
index 91da3c26ba..0f84ebc36e 100644
--- a/doc/src/sgml/backup.sgml
+++ b/doc/src/sgml/backup.sgml
@@ -925,6 +925,15 @@ test ! -f /mnt/server/archivedir/00000001000000A900000065 && cp pg_wal/0
to manage. For a large database all of which is heavily modified,
incremental backups won't be much smaller than full backups.
</para>
+
+ <para>
+ Like a base backup, you can take an incremental backup from a streaming
+ replication standby server. But since a backup of a standby server cannot
+ initiate a checkpoint, it is possible that an incremental backup taken
+ right after a base backup will fail with an error, since it would have
+ to start with the same checkpoint as the base backup and would therefore
+ be empty.
+ </para>
</sect2>
<sect2 id="backup-lowlevel-base-backup">
diff --git a/src/backend/backup/basebackup_incremental.c b/src/backend/backup/basebackup_incremental.c
index 2108702397..85c16182a6 100644
--- a/src/backend/backup/basebackup_incremental.c
+++ b/src/backend/backup/basebackup_incremental.c
@@ -441,7 +441,8 @@ PrepareForIncrementalBackup(IncrementalBackupInfo *ib,
errmsg("manifest requires WAL from final timeline %u ending at %X/%X, but this backup starts at %X/%X",
range->tli,
LSN_FORMAT_ARGS(range->end_lsn),
- LSN_FORMAT_ARGS(backup_state->startpoint))));
+ LSN_FORMAT_ARGS(backup_state->startpoint)),
+ errhint("Perhaps there was too little activity since the previous backup, and this incremental backup would be empty.")));
}
else
{
--
2.45.2
view thread (9+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: Incremental backup from a streaming replication standby fails
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox