aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/transam/xlogbackup.c
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2023-12-20 09:49:12 -0500
committerRobert Haas <rhaas@postgresql.org>2023-12-20 09:49:12 -0500
commitdc212340058b4e7ecfc5a7a81ec50e7a207bf288 (patch)
tree79ffec15f6a8d9fce1333b99dd0b587e2459d38f /src/backend/access/transam/xlogbackup.c
parent174c480508ac25568561443e6d4a82d5c1103487 (diff)
downloadpostgresql-dc212340058b4e7ecfc5a7a81ec50e7a207bf288.tar.gz
postgresql-dc212340058b4e7ecfc5a7a81ec50e7a207bf288.zip
Add support for incremental backup.
To take an incremental backup, you use the new replication command UPLOAD_MANIFEST to upload the manifest for the prior backup. This prior backup could either be a full backup or another incremental backup. You then use BASE_BACKUP with the INCREMENTAL option to take the backup. pg_basebackup now has an --incremental=PATH_TO_MANIFEST option to trigger this behavior. An incremental backup is like a regular full backup except that some relation files are replaced with files with names like INCREMENTAL.${ORIGINAL_NAME}, and the backup_label file contains additional lines identifying it as an incremental backup. The new pg_combinebackup tool can be used to reconstruct a data directory from a full backup and a series of incremental backups. Patch by me. Reviewed by Matthias van de Meent, Dilip Kumar, Jakub Wartak, Peter Eisentraut, and Álvaro Herrera. Thanks especially to Jakub for incredibly helpful and extensive testing. Discussion: http://postgr.es/m/CA+TgmoYOYZfMCyOXFyC-P+-mdrZqm5pP2N7S-r0z3_402h9rsA@mail.gmail.com
Diffstat (limited to 'src/backend/access/transam/xlogbackup.c')
-rw-r--r--src/backend/access/transam/xlogbackup.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/backend/access/transam/xlogbackup.c b/src/backend/access/transam/xlogbackup.c
index 21d68133ae1..f51d4282bb8 100644
--- a/src/backend/access/transam/xlogbackup.c
+++ b/src/backend/access/transam/xlogbackup.c
@@ -77,6 +77,16 @@ build_backup_content(BackupState *state, bool ishistoryfile)
appendStringInfo(result, "STOP TIMELINE: %u\n", state->stoptli);
}
+ /* either both istartpoint and istarttli should be set, or neither */
+ Assert(XLogRecPtrIsInvalid(state->istartpoint) == (state->istarttli == 0));
+ if (!XLogRecPtrIsInvalid(state->istartpoint))
+ {
+ appendStringInfo(result, "INCREMENTAL FROM LSN: %X/%X\n",
+ LSN_FORMAT_ARGS(state->istartpoint));
+ appendStringInfo(result, "INCREMENTAL FROM TLI: %u\n",
+ state->istarttli);
+ }
+
data = result->data;
pfree(result);