pgsql: Remove pg_backup_start_callback and reuse similar code - Mailing list pgsql-committers

From Alvaro Herrera
Subject pgsql: Remove pg_backup_start_callback and reuse similar code
Date
Msg-id E1ol4hg-0032Yb-MF@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Remove pg_backup_start_callback and reuse similar code

We had two copies of almost identical logic to revert shared memory
state when a running backup aborts; we can remove
pg_backup_start_callback if we adapt do_pg_abort_backup so that it can
be used for this purpose too.

However, in order for this to work, we have to repurpose the flag passed
to do_pg_abort_backup.  It used to indicate whether to throw a warning
(and the only caller always passed true).  It now indicates whether the
callback is being called at start time (in which case the session backup
state is known not to have been set to RUNNING yet, so action is always
taken) or shmem time (in which case action is only taken if the session
backup state is RUNNING).  Thus the meaning of the flag is no longer
superfluous, but it's actually quite critical to get right.  I (Álvaro)
chose to change the polarity and the code flow re. the flag from what
Bharath submitted, for coding clarity.

Co-authored-by: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Discussion: https://www.postgresql.org/message-id/20221013111330.564fk5tkwe3ha77l%40alvherre.pgsql

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/df3737a651f40a398c14348b0482e97031e7a7d4

Modified Files
--------------
src/backend/access/transam/xlog.c | 81 +++++++++++++++++----------------------
1 file changed, 35 insertions(+), 46 deletions(-)


pgsql-committers by date:

Previous
From: Michael Paquier
Date:
Subject: pgsql: Rework shutdown callback of archiver modules
Next
From: Thomas Munro
Date:
Subject: pgsql: Track LLVM 15 changes.