Обсуждение: Possible mistake in backup documentation
The following documentation comment has been logged on the website: Page: https://www.postgresql.org/docs/12/wal.html Description: Hello! 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?
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
Вложения
On Fri, Sep 25, 2020 at 2:32 PM Laurenz Albe <laurenz.albe@cybertec.at> wrote:
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.
Well, technically it is *correct*. It's just rather silly that we are using the deprecated API in the example.
How about the attached patch?
Perhaps that is too complicated, but I have no idea how to make it simpler.
For this example, can't we just show two sessions. That is, "in a psql, run pg_start_backup(). Then in a different session, copy all the files, and then back in psql run pg_stop_backup()" or such?
This is still just an example of a low level operation, where the recommendation is (and is there iirc) to use a different tool for it already.
Ceterum censeo, we should not deprecate the exclusive backup API.
Well. We should depreciate the way it works now, but we should also provide a *better* way to solve the actual problem. This is not necessarily an API that looks the way the deprecated one looks -- the focus should be on providing a solution to the problem, not to un-deprecate the API.
On Fri, 2020-09-25 at 14:50 +0200, Magnus Hagander wrote: > On Fri, Sep 25, 2020 at 2:32 PM Laurenz Albe <laurenz.albe@cybertec.at> wrote: > > 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. > > Well, technically it is *correct*. It's just rather silly that we are using the deprecated API in the example. > > > How about the attached patch? > > Perhaps that is too complicated, but I have no idea how to make it simpler. > > For this example, can't we just show two sessions. That is, "in a psql, run pg_start_backup(). > Then in a different session, copy all the files, and then back in psql run pg_stop_backup()" or such? > > This is still just an example of a low level operation, where the recommendation is (and is there iirc) > to use a different tool for it already. I thought the point of the example is to show a workable script that could perform a backup and could be used as a starting point to develop your own backup solution. (I know that there are people who think writing your own backup solution is evil, but I am not one of them.) If we replace that with a verbal description of how to do it, the example just duplicates what is already documented. In that case I would opt for simply removing the example. Yours, Laurenz Albe
Greetings, * Laurenz Albe (laurenz.albe@cybertec.at) wrote: > On Fri, 2020-09-25 at 14:50 +0200, Magnus Hagander wrote: > > On Fri, Sep 25, 2020 at 2:32 PM Laurenz Albe <laurenz.albe@cybertec.at> wrote: > > > 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. > > > > Well, technically it is *correct*. It's just rather silly that we are using the deprecated API in the example. > > > > > How about the attached patch? > > > Perhaps that is too complicated, but I have no idea how to make it simpler. > > > > For this example, can't we just show two sessions. That is, "in a psql, run pg_start_backup(). > > Then in a different session, copy all the files, and then back in psql run pg_stop_backup()" or such? > > > > This is still just an example of a low level operation, where the recommendation is (and is there iirc) > > to use a different tool for it already. > > I thought the point of the example is to show a workable script that could > perform a backup and could be used as a starting point to develop your own > backup solution. (I know that there are people who think writing your own > backup solution is evil, but I am not one of them.) That's certainly not actually the case. We don't currently have anywhere close to sufficient documention (unless you are reading the code and understand how PG works) for someone to develop their own backup solution using the low-level API. There's been attempts to fix that, and I suspect there'll be another attempt to improve the situation for v14, but not sure if that'll be successful. > If we replace that with a verbal description of how to do it, the example just > duplicates what is already documented. > > In that case I would opt for simply removing the example. Removing the example, as it really doesn't do what it implies, is probably the best way to address this. I'm not convinced that we could come up with a sufficient verbal description, but I'm happy to take a look and provide feedback if someone wants to try. Thanks, Stephen