On 7/1/20 4:32 PM, Bruce Momjian wrote:
On Wed, Jul  1, 2020 at 04:27:58PM -0400, David Steele wrote:
On 7/1/20 3:58 PM, Robert Haas wrote:
If we could jigger things so that you don't need to stop the backup at
all, you only start it, and whether you ever finish copying everything
is something about which the system need not know or care, that would
be a lot nicer. I'm not sure I see how to do that, though.

Well, the only thing pg_stop_backup() *really* needs to know is the starting
WAL position. pg_start_backup() gets that info so if it passes it back to
pg_stop_backup() that could be enough. Or as was proposed above, it just

Doesn't pg_start_backup already return this?

        SELECT pg_start_backup('test');
         pg_start_backup
        -----------------
-->   0/2000028

It does, though after looking at the code I think we need the entire backup_label. For any of this to be useful, pg_start_backup() *must* return backup_label anyway so it can be stored somewhere the backup software can find it.

Here's a thought. What if we just stored the oldest starting LSN and a count
of how many backups have been requested. When the backup ends it checks that
backup count is > 0 and starting LSN is <= its starting LSN. If not, it
throws an error. When backups go to 0 FPWs are turned off if they were off
before the first backup.

Can't we just error out of an exclusive-style backup is requested to
start and a previous exclusive-style backup has not been stopped?

That means only allowing one exclusive backup but it's not like we don't already have that limitation. But -- I'd rather not even need to specify exclusive/non-exclusive when the backup is started. Basically, all backups would be non-exclusive but we'd allow pg_stop_backup() to be called in a new session (or the same session).

Regards,
--
-David
da...@pgmasters.net


Reply via email to