pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Fujii Masao <fujii@postgresql.org>
To: pgsql-committers@postgresql.org
Subject: pgsql: Fix bug in cancellation of non-exclusive backup to avoid asserti
Date: Mon, 18 Dec 2017 18:51:05 +0000
Message-ID: <E1eR0VF-0006VF-7i@gemulon.postgresql.org> (raw)

Fix bug in cancellation of non-exclusive backup to avoid assertion failure.

Previously an assertion failure occurred when pg_stop_backup() for
non-exclusive backup was aborted while it's waiting for WAL files to
be archived. This assertion failure happened in do_pg_abort_backup()
which was called when a non-exclusive backup was canceled.
do_pg_abort_backup() assumes that there is at least one non-exclusive
backup running when it's called. But pg_stop_backup() can be canceled
even after it marks the end of non-exclusive backup (e.g.,
during waiting for WAL archiving). This broke the assumption that
do_pg_abort_backup() relies on, and which caused an assertion failure.

This commit changes do_pg_abort_backup() so that it does nothing
when non-exclusive backup has been already marked as completed.
That is, the asssumption is also changed, and do_pg_abort_backup()
now can handle even the case where it's called when there is
no running backup.

Backpatch to 9.6 where SQL-callable non-exclusive backup was added.

Author: Masahiko Sawada and Michael Paquier
Reviewed-By: Robert Haas and Fujii Masao
Discussion: https://www.postgresql.org/message-id/CAD21AoD2L1Fu2c==gnVASMyFAAaq3y-AQ2uEVj-zTCGFFjvmDg@mail.gmail...

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/133d2fab2f83242ec99b15807a5920b48cc3d26c

Modified Files
--------------
src/backend/access/transam/xlog.c    | 36 ++++++++++++++++++++++++++++++++----
src/backend/replication/basebackup.c |  5 +++--
2 files changed, 35 insertions(+), 6 deletions(-)



view thread (3+ messages)  latest in thread

Message-ID: <E1eR0VF-0006VF-7i@gemulon.postgresql.org>
Permalink:  ../E1eR0VF-0006VF-7i@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1eR0VF-0006VF-7i@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: fujii@postgresql.org
  Subject: Re: pgsql: Fix bug in cancellation of non-exclusive backup to avoid asserti
  In-Reply-To: <E1eR0VF-0006VF-7i@gemulon.postgresql.org>
  References: <E1eR0VF-0006VF-7i@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