Re: Remove Deprecated Exclusive Backup Mode - Mailing list pgsql-hackers
From | Jehan-Guillaume de Rorthais |
---|---|
Subject | Re: Remove Deprecated Exclusive Backup Mode |
Date | |
Msg-id | 20200702140607.2e8f19c1@firost Whole thread Raw |
In response to | Re: Remove Deprecated Exclusive Backup Mode (Magnus Hagander <magnus@hagander.net>) |
List | pgsql-hackers |
On Thu, 2 Jul 2020 12:32:14 +0200 Magnus Hagander <magnus@hagander.net> wrote: [...] > > non-exclusive backup...this is not that easy anymore. And > > pg_is_in_backup() is quite misleading if the admin found it without reading > > doc. Maybe an admin > > Yeah, as it is now it should really be called pg_is_in_exclusive_backup(). +1 We end up to the same conclusion while discussing with Gilles Darold this morning. But considering the discussion bellow, this might not be needed anyway. > > function to list in progress non-exclusive backup and related backend pid > > might > > be a good start? > > > > I think it would make perfect sense to show manual (exclusive or > non-exclusive) base backups in pg_stat_progress_basebackup. There's no > fundamental need that one should only be for base backups taken with > pg_basebackup. In fact, I'd argue that's a mistake in the view in v13 that > it does not include this information. > > It could have "phase" set to "manual non-exclusive" for example, and leave > the other fields at NULL. Even in manual non-exclusive we could define some different phase: * waiting for checkpoint to finish * external backup * waiting for wal archiving to finish So maybe exposing the backup label and/or the method might be useful as well? > I guess in theory even for exclusive ones, with the pid column set to NULL. We are discussing removing the mandatory connection during the non-exclusive backup. If it become optional at some point, this PID might be NULL as well... > (As Stephen mentioned at some point in the future we might also want to > extend it to allow these tools to report their progress as well into it, > probably by just calling an admin function on the connection that they > already have). > > > > Tools like pg_basebackup (and probably pgbackrest/barman to some extends) > > still need the backup to abort on disconnection. Maybe it could flag its > > session using the replication protocol or call a new admin function or load > > a hook on session-shutdown to keep previous API behavior? > > Suddenly requiring a replication protocol connection for one thing, when > all their other things are done over a normal one, seems really terrible. Sorry, I misexplained. Adding such flag to the replication protocol was only for pg_basebackup. Other tools would use an admin function to achieve the same goal. > But having an admin function would work. > > But anything requiring loading of a hook is going to raise the bar > massively as suddenly somebody needs to install a compiled binary on the > server in order to use it. Contrib already provide many useful tools. How would it be different from eg. pg_archivecleanup? IIRC, end of session hook was discussed in the past, but I did not follow the thread by the time. But anyway, an admin function would probably make the job as well anyway. > But calling a separate function is pretty much > what I suggested upthread > (except I suggested a new version of pg_stop_backup, but implementation wise) > > But I'm not sure what previous API behavior you're looking to preserve here? Current non-exclusive backup are automatically aborted when the pg_start_backup() session disappear without pg_stop_backup(). I suppose this was the API behavior that Robert is concerned to loose when he is writing about people forgetting to end backups. And now you are talking about Stephen's idea to report the progress of a backup, this kind of API could be used as watchdog as well: if the frontend did not report before some optional kind of (user defined) timeout, abort the backup. We would have a "similar" behavior than current one. To be clear, I suppose these admin functions could be called from any backend session, taking some kind of backup id (eg. the token you were talking about upthread). Regards,
pgsql-hackers by date: