On Tue, 2020-09-22 at 14:17 +0000, PG Doc comments form wrote: > In "25.3.3.2. Making An Exclusive Low-Level Backup", you said that "The > exclusive backup method is deprecated and should be avoided. Prior to > PostgreSQL 9.6, this was the only low-level method available, but it is now > recommended that all users upgrade their scripts to use non-exclusive > backups". But in the example in "25.3.6.1. Standalone Hot Backups" you use > the exclusive version of backup command. Is it a mistake or not?
Yes, that's true. How about the attached patch? Perhaps that is too complicated, but I have no idea how to make it simpler. Ceterum censeo, we should not deprecate the exclusive backup API. Yours, Laurenz Albe
From 283fa644c15b08894fdff957e57e526b85913951 Mon Sep 17 00:00:00 2001 From: Laurenz Albe <laurenz.a...@cybertec.at> Date: Fri, 25 Sep 2020 14:26:58 +0200 Subject: [PATCH] Use non-exclusive backup in example Since we habe deprecated the exclusive backup API, we should not use it in examples. Discussion: https://postgr.es/m/160078426053.14061.808669930112439...@wrigleys.postgresql.org --- doc/src/sgml/backup.sgml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/doc/src/sgml/backup.sgml b/doc/src/sgml/backup.sgml index b9331830f7..ddf2aa3f35 100644 --- a/doc/src/sgml/backup.sgml +++ b/doc/src/sgml/backup.sgml @@ -1496,15 +1496,19 @@ archive_command = 'test ! -f /var/lib/pgsql/backup_in_progress || (test ! -f /va following: <programlisting> touch /var/lib/pgsql/backup_in_progress -psql -c "select pg_start_backup('hot_backup');" -tar -cf /var/lib/pgsql/backup.tar /var/lib/pgsql/data/ -psql -c "select pg_stop_backup();" -rm /var/lib/pgsql/backup_in_progress -tar -rf /var/lib/pgsql/backup.tar /var/lib/pgsql/archive/ +mkdir /tmp/data +psql -Atq -c "select pg_start_backup(label => 'hot_backup', exclusive => FALSE);" \ + -c "\! tar -cf /var/lib/pgsql/backup.tar -C /var/lib/pgsql/ data/" \ + -c "\o /tmp/data/backup_label" \ + -c "SELECT labelfile FROM pg_stop_backup(exclusive => FALSE);" +tar -rf /var/lib/pgsql/backup.tar -C /tmp data/backup_label +rm -r /var/lib/pgsql/backup_in_progress /tmp/data +tar -rf /var/lib/pgsql/backup.tar -C /var/lib/pgsql/ archive/ </programlisting> The switch file <filename>/var/lib/pgsql/backup_in_progress</filename> is created first, enabling archiving of completed WAL files to occur. - After the backup the switch file is removed. Archived WAL files are + After the backup the switch file is removed. <filename>backup_label</filename> + and archived WAL files are then added to the backup so that both base backup and all required WAL files are part of the same <application>tar</application> file. Please remember to add error handling to your backup scripts. -- 2.26.2