On Wed, Jul 1, 2020 at 4:27 PM David Steele <da...@pgmasters.net> wrote: > 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 passes the backup_label back to pg_stop_backup() for > parsing. To write the .backup file to WAL (which I personally think is > pretty useless) you'd need backup_label. > > The issue I have not been able to work around is that full page writes > need to be on for backups and they won't get turned back off if you > don't end all the backups that get started. > > 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. > > That way, we could have a single function to cancel all backups in > progress. Even if a new one started, one ending that was started prior > to the cancel would know that it could not end successfully and error. > > For the vast majority of people who have full page writes on, it > wouldn't really matter how many backups were running so we could > probably just skip all of that.
Yeah, I like this line of thinking. Not sure about the details. > If we wanted to really make it more foolproof we could add a checksum to > the backup label to make sure the user doesn't damage it before passing > it back. I don't see a whole lot of point in that, honestly. It doesn't make it impossible to damage the backup label; it just makes it harder. And that doesn't seem worth much. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company