From: Laurenz Albe <laurenz.albe@cybertec.at>
To: abo@velvica.com
To: pgsql-docs@lists.postgresql.org
Subject: Re: Possible mistake in backup documentation
Date: Fri, 25 Sep 2020 14:32:26 +0200
Message-ID: <3e33df71449fdc083b1ed8a4dfe3ee129de59798.camel@cybertec.at> (raw)
In-Reply-To: <160078426053.14061.808669930112439771@wrigleys.postgresql.org>
References: <160078426053.14061.808669930112439771@wrigleys.postgresql.org>
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
Attachments:0001-Use-non-exclusive-backup-in-example.patch (text/x-patch, 2.1K) download
From 283fa644c15b08894fdff957e57e526b85913951 Mon Sep 17 00:00:00 2001
From: Laurenz Albe <laurenz.albe@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.808669930112439771@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.sgmlindex 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-docs@postgresql.org
Cc: laurenz.albe@cybertec.at, abo@velvica.com, pgsql-docs@lists.postgresql.org
Subject: Re: Possible mistake in backup documentation
In-Reply-To: <3e33df71449fdc083b1ed8a4dfe3ee129de59798.camel@cybertec.at>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox