Document restrictions regarding incremental backups and standbys.
authorRobert Haas <[email protected]>
Thu, 25 Jul 2024 19:45:06 +0000 (15:45 -0400)
committerRobert Haas <[email protected]>
Thu, 25 Jul 2024 20:09:24 +0000 (16:09 -0400)
If you try to take an incremental backup on a standby and there hasn't
been much system activity, it might fail. Document why this happens.
Also add a hint to the error message you get, to make it more likely
that users will understand what has gone wrong.

Laurenz Albe and Robert Haas

Discussion: https://postgr.es/m/5468641ad821dad7aa3b2d65bf843146443a1b68[email protected]

doc/src/sgml/backup.sgml
src/backend/backup/basebackup_incremental.c

index 91da3c26ba03ed67362098c852d91ffdc42c87a0..e4e4c56cf14032131d64014538c571482cee8576 100644 (file)
@@ -925,6 +925,17 @@ test ! -f /mnt/server/archivedir/00000001000000A900000065 &amp;&amp; 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>
+    An incremental backup is only possible if replay would begin from a later
+    checkpoint than for the previous backup upon which it depends.  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.
+   </para>
   </sect2>
 
   <sect2 id="backup-lowlevel-base-backup">
index a8691b680dfd46cbfabe37b8388b6a577ba700e2..cc2e168129a67bc6036d8ed42436bb331501a98e 100644 (file)
@@ -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("This can happen for incremental backups on a standby if there was little activity since the previous backup.")));
        }
        else
        {