pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Remove pg_backup_start_callback and reuse similar code
Date: Wed, 19 Oct 2022 08:45:33 +0000
Message-ID: <E1ol4hg-0032Yb-MF@gemulon.postgresql.org> (raw)

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(-)



Message-ID: <E1ol4hg-0032Yb-MF@gemulon.postgresql.org>
Permalink:  ../E1ol4hg-0032Yb-MF@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1ol4hg-0032Yb-MF@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: alvherre@alvh.no-ip.org
  Subject: Re: pgsql: Remove pg_backup_start_callback and reuse similar code
  In-Reply-To: <E1ol4hg-0032Yb-MF@gemulon.postgresql.org>
  References: <E1ol4hg-0032Yb-MF@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox