Add support for incremental backup.
authorRobert Haas <rhaas@postgresql.org>
Wed, 20 Dec 2023 14:49:12 +0000 (09:49 -0500)
committerRobert Haas <rhaas@postgresql.org>
Wed, 20 Dec 2023 14:49:12 +0000 (09:49 -0500)
commitdc212340058b4e7ecfc5a7a81ec50e7a207bf288
tree79ffec15f6a8d9fce1333b99dd0b587e2459d38f
parent174c480508ac25568561443e6d4a82d5c1103487
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
49 files changed:
doc/src/sgml/backup.sgml
doc/src/sgml/config.sgml
doc/src/sgml/protocol.sgml
doc/src/sgml/ref/allfiles.sgml
doc/src/sgml/ref/pg_basebackup.sgml
doc/src/sgml/ref/pg_combinebackup.sgml [new file with mode: 0644]
doc/src/sgml/reference.sgml
src/backend/access/transam/xlogbackup.c
src/backend/access/transam/xlogrecovery.c
src/backend/backup/Makefile
src/backend/backup/basebackup.c
src/backend/backup/basebackup_incremental.c [new file with mode: 0644]
src/backend/backup/meson.build
src/backend/replication/repl_gram.y
src/backend/replication/repl_scanner.l
src/backend/replication/walsender.c
src/backend/storage/ipc/ipci.c
src/bin/Makefile
src/bin/meson.build
src/bin/pg_basebackup/bbstreamer_file.c
src/bin/pg_basebackup/pg_basebackup.c
src/bin/pg_basebackup/t/010_pg_basebackup.pl
src/bin/pg_combinebackup/.gitignore [new file with mode: 0644]
src/bin/pg_combinebackup/Makefile [new file with mode: 0644]
src/bin/pg_combinebackup/backup_label.c [new file with mode: 0644]
src/bin/pg_combinebackup/backup_label.h [new file with mode: 0644]
src/bin/pg_combinebackup/copy_file.c [new file with mode: 0644]
src/bin/pg_combinebackup/copy_file.h [new file with mode: 0644]
src/bin/pg_combinebackup/load_manifest.c [new file with mode: 0644]
src/bin/pg_combinebackup/load_manifest.h [new file with mode: 0644]
src/bin/pg_combinebackup/meson.build [new file with mode: 0644]
src/bin/pg_combinebackup/nls.mk [new file with mode: 0644]
src/bin/pg_combinebackup/pg_combinebackup.c [new file with mode: 0644]
src/bin/pg_combinebackup/reconstruct.c [new file with mode: 0644]
src/bin/pg_combinebackup/reconstruct.h [new file with mode: 0644]
src/bin/pg_combinebackup/t/001_basic.pl [new file with mode: 0644]
src/bin/pg_combinebackup/t/002_compare_backups.pl [new file with mode: 0644]
src/bin/pg_combinebackup/t/003_timeline.pl [new file with mode: 0644]
src/bin/pg_combinebackup/t/004_manifest.pl [new file with mode: 0644]
src/bin/pg_combinebackup/t/005_integrity.pl [new file with mode: 0644]
src/bin/pg_combinebackup/write_manifest.c [new file with mode: 0644]
src/bin/pg_combinebackup/write_manifest.h [new file with mode: 0644]
src/bin/pg_resetwal/pg_resetwal.c
src/include/access/xlogbackup.h
src/include/backup/basebackup.h
src/include/backup/basebackup_incremental.h [new file with mode: 0644]
src/include/nodes/replnodes.h
src/test/perl/PostgreSQL/Test/Cluster.pm
src/tools/pgindent/typedefs.list