You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
Remove pg_backup_start_callback and reuse similar code
We had two copies of almost identical logic to revert shared memorystate when a running backup aborts; we can removepg_backup_start_callback if we adapt do_pg_abort_backup so that it canbe used for this purpose too.However, in order for this to work, we have to repurpose the flag passedto do_pg_abort_backup. It used to indicate whether to throw a warning(and the only caller always passed true). It now indicates whether thecallback is being called at start time (in which case the session backupstate is known not to have been set to RUNNING yet, so action is alwaystaken) or shmem time (in which case action is only taken if the sessionbackup state is RUNNING). Thus the meaning of the flag is no longersuperfluous, but it's actually quite critical to get right. I (Álvaro)chose to change the polarity and the code flow re. the flag from whatBharath submitted, for coding clarity.Co-authored-by: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>Discussion:https://www.postgresql.org/message-id/20221013111330.564fk5tkwe3ha77l%40alvherre.pgsql