1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2024-11-25 09:01:48 +02:00

Merge branch 'master' into wal_delete_refactoring

This commit is contained in:
Grigory Smolkin 2019-09-23 13:57:35 +03:00
commit 271d2d1305
3 changed files with 30 additions and 10 deletions

View File

@ -102,11 +102,11 @@ Current version - 2.1.5
`pg_probackup merge -B backup_dir --instance instance_name -i backup_id [option...]`
`pg_probackup delete -B backup_dir --instance instance_name { -i backup_id | --delete-wal | --delete-expired | --merge-expired }`
`pg_probackup delete -B backup_dir --instance instance_name { -i backup_id | --delete-wal | --delete-expired | --merge-expired } [option...]`
`pg_probackup archive-push -B backup_dir --instance instance_name --wal-file-path=wal_file_path --wal-file-name=wal_file_name [option...]`
`pg_probackup archive-get -B backup_dir --instance instance_name --wal-file-path=wal_file_path --wal-file-name=wal_file_name`
`pg_probackup archive-get -B backup_dir --instance instance_name --wal-file-path=wal_file_path --wal-file-name=wal_file_name [option...]`
## Versioning
@ -1070,7 +1070,9 @@ Specifies **the number of full backup copies** to keep in the backup catalog.
--retention-window=window
Defines the earliest point in time for which pg_probackup can complete the recovery. This option is set in **the number of days** from the current moment. For example, if `retention-window=7`, pg_probackup must delete all backup copies that are older than seven days, with all the corresponding WAL files.
If both `--retention-redundancy` and `--retention-window` options are set, pg_probackup keeps backup copies that satisfy at least one condition. For example, if you set `--retention-redundancy=2` and `--retention-window=7`, pg_probackup purges the backup catalog to keep only two full backup copies and all backups that are newer than seven days.
If both `--retention-redundancy` and `--retention-window` options are set, pg_probackup keeps backup copies that satisfy at least one condition. For example, if you set `--retention-redundancy=2` and `--retention-window=7`, pg_probackup purges the backup catalog to keep only two full backup copies and all backups that are newer than seven days:
pg_probackup set-config -B backup_dir --instance instance_name --retention-redundancy=2 --retention-window=7
To clean up the backup catalog in accordance with retention policy, run:
@ -1084,6 +1086,10 @@ If you would like to also remove the WAL files that are no longer required for a
>NOTE: Alternatively, you can use the `--delete-expired`, `--merge-expired`, `--delete-wal` flags and the `--retention-window` and `--retention-redundancy` options together with the [backup](#backup) command to remove and merge the outdated backup copies once the new backup is created.
You can set or override the current retention policy by specifying `--retention-redundancy` and `--retention-window` options directly when running `delete` or `backup` commands:
pg_probackup delete -B backup_dir --instance instance_name --delete-expired --retention-window=7 --retention-redundancy=2
Since incremental backups require that their parent full backup and all the preceding incremental backups are available, if any of such backups expire, they still cannot be removed while at least one incremental backup in this chain satisfies the retention policy. To avoid keeping expired backups that are still required to restore an active incremental one, you can merge them with this backup using the `--merge-expired` flag when running [backup](#backup) or [delete](#delete) commands.
Suppose you have backed up the *node* instance in the *backup_dir* directory, with the `--retention-window` option is set to *7*, and you have the following backups available on April 10, 2019:
@ -1380,6 +1386,7 @@ For details, see the section [Merging Backups](#merging-backups).
pg_probackup delete -B backup_dir --instance instance_name
[--help] [-j num_threads] [--progress]
[--retention-redundancy=redundancy][--retention-window=window]
[--delete-wal] {-i backup_id | --delete-expired [--merge-expired] | --merge-expired}
[--dry-run]
[logging_options]

View File

@ -114,6 +114,7 @@ gen_probackup_project.pl C:\path_to_postgresql_source_tree
Currently the latest documentation can be found at [github](https://postgrespro.github.io/pg_probackup).
Slightly outdated documentation can be found at [Postgres Pro Enterprise documentation](https://postgrespro.com/docs/postgrespro/current/app-pgprobackup).
Documentation for current devel can also be found at [github](https://github.com/postgrespro/pg_probackup/blob/master/Documentation.md)
## License

View File

@ -170,7 +170,10 @@ help_pg_probackup(void)
printf(_(" [--help]\n"));
printf(_("\n %s delete -B backup-path --instance=instance_name\n"), PROGRAM_NAME);
printf(_(" [--wal] [-i backup-id | --expired | --merge-expired]\n"));
printf(_(" [-j num-threads] [--progress]\n"));
printf(_(" [--retention-redundancy=retention-redundancy]\n"));
printf(_(" [--retention-window=retention-window]\n"));
printf(_(" [--delete-wal] [-i backup-id | --delete-expired | --merge-expired]\n"));
printf(_(" [--dry-run]\n"));
printf(_(" [--help]\n"));
@ -300,7 +303,7 @@ help_backup(void)
printf(_(" retention policy after successful backup completion\n"));
printf(_(" --merge-expired merge backups expired according to current\n"));
printf(_(" retention policy after successful backup completion\n"));
printf(_(" --delete-wal remove redundant archived wal files\n"));
printf(_(" --delete-wal remove redundant wal files in WAL archive\n"));
printf(_(" --retention-redundancy=retention-redundancy\n"));
printf(_(" number of full backups to keep; 0 disables; (default: 0)\n"));
printf(_(" --retention-window=retention-window\n"));
@ -556,18 +559,27 @@ static void
help_delete(void)
{
printf(_("\n%s delete -B backup-path --instance=instance_name\n"), PROGRAM_NAME);
printf(_(" [-i backup-id | --expired | --merge-expired] [--wal]\n"));
printf(_(" [-j num-threads] [--dry-run]\n\n"));
printf(_(" [-i backup-id | --delete-expired | --merge-expired] [--delete-wal]\n"));
printf(_(" [-j num-threads] [--progress]\n"));
printf(_(" [--retention-redundancy=retention-redundancy]\n"));
printf(_(" [--retention-window=retention-window]\n\n"));
printf(_(" -B, --backup-path=backup-path location of the backup storage area\n"));
printf(_(" --instance=instance_name name of the instance\n"));
printf(_(" -i, --backup-id=backup-id backup to delete\n"));
printf(_(" --expired delete backups expired according to current\n"));
printf(_(" -j, --threads=NUM number of parallel threads\n"));
printf(_(" --progress show progress\n"));
printf(_("\n Retention options:\n"));
printf(_(" --delete-expired delete backups expired according to current\n"));
printf(_(" retention policy\n"));
printf(_(" --merge-expired merge backups expired according to current\n"));
printf(_(" retention policy\n"));
printf(_(" --wal remove unnecessary wal files in WAL ARCHIVE\n"));
printf(_(" -j, --threads=NUM number of parallel threads\n"));
printf(_(" --delete-wal remove redundant wal files in WAL archive\n"));
printf(_(" --retention-redundancy=retention-redundancy\n"));
printf(_(" number of full backups to keep; 0 disables; (default: 0)\n"));
printf(_(" --retention-window=retention-window\n"));
printf(_(" number of days of recoverability; 0 disables; (default: 0)\n"));
printf(_(" --dry-run perform a trial run without any changes\n"));
printf(_("\n Logging options:\n"));