pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Robert Haas <rhaas@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix minor problems with non-exclusive backup cleanup.
Date: Thu, 19 Dec 2019 14:07:22 +0000
Message-ID: <E1ihwSY-0005Qd-30@gemulon.postgresql.org> (raw)

Fix minor problems with non-exclusive backup cleanup.

The previous coding imagined that it could call before_shmem_exit()
when a non-exclusive backup began and then remove the previously-added
handler by calling cancel_before_shmem_exit() when that backup
ended. However, this only works provided that nothing else in the
system has registered a before_shmem_exit() hook in the interim,
because cancel_before_shmem_exit() is documented to remove a callback
only if it is the latest callback registered. It also only works
if nothing can ERROR out between the time that sessionBackupState
is reset and the time that cancel_before_shmem_exit(), which doesn't
seem to be strictly true.

To fix, leave the handler installed for the lifetime of the session,
arrange to install it just once, and teach it to quietly do nothing if
there isn't a non-exclusive backup in process.

This is a bug, but for now I'm not going to back-patch, because the
consequences are minor. It's possible to cause a spurious warning
to be generated, but that doesn't really matter. It's also possible
to trigger an assertion failure, but production builds shouldn't
have assertions enabled.

Patch by me, reviewed by Kyotaro Horiguchi, Michael Paquier (who
preferred a different approach, but got outvoted), Fujii Masao,
and Tom Lane, and with comments by various others.

Discussion: http://postgr.es/m/CA+TgmobMjnyBfNhGTKQEDbqXYE3_rXWpc4CM63fhyerNCes3mA@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/303640199d0436c5e7acdf50b837a027b5726594

Modified Files
--------------
src/backend/access/transam/xlog.c      | 32 +++++++++++++++++++++++++++++---
src/backend/access/transam/xlogfuncs.c | 17 ++---------------
src/backend/replication/basebackup.c   | 16 ++--------------
src/include/access/xlog.h              |  3 ++-
4 files changed, 35 insertions(+), 33 deletions(-)



view thread (6+ messages)  latest in thread

Message-ID: <E1ihwSY-0005Qd-30@gemulon.postgresql.org>
Permalink:  ../E1ihwSY-0005Qd-30@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1ihwSY-0005Qd-30@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: rhaas@postgresql.org
  Subject: Re: pgsql: Fix minor problems with non-exclusive backup cleanup.
  In-Reply-To: <E1ihwSY-0005Qd-30@gemulon.postgresql.org>
  References: <E1ihwSY-0005Qd-30@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