pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Fujii Masao <fujii@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Prevent BASE_BACKUP in the middle of another backup in the same
Date: Wed, 20 Jul 2022 00:58:25 +0000
Message-ID: <E1oDy2i-000LuR-H9@gemulon.postgresql.org> (raw)

Prevent BASE_BACKUP in the middle of another backup in the same session.

Multiple non-exclusive backups are able to be run conrrently in different
sessions. But, in the same session, only one non-exclusive backup can be
run at the same moment. If pg_backup_start (pg_start_backup in v14 or before)
is called in the middle of another non-exclusive backup in the same session,
an error is thrown.

However, previously, in logical replication walsender mode, even if that
walsender session had already called pg_backup_start and started
a non-exclusive backup, it could execute BASE_BACKUP command and
start another non-exclusive backup. Which caused subsequent pg_backup_stop
to throw an error because BASE_BACKUP unexpectedly reset the session state
marked by pg_backup_start.

This commit prevents BASE_BACKUP command in the middle of another
non-exclusive backup in the same session.

Back-patch to all supported branches.

Author: Fujii Masao
Reviewed-by: Kyotaro Horiguchi, Masahiko Sawada, Michael Paquier, Robert Haas
Discussion: https://postgr.es/m/3374718f-9fbf-a950-6d66-d973e027f44c@oss.nttdata.com

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/2aedf25eb4d0a89c38dbbad8e5bbda237838292f

Modified Files
--------------
src/backend/replication/basebackup.c | 6 ++++++
1 file changed, 6 insertions(+)



view thread (7+ messages)  latest in thread

Message-ID: <E1oDy2i-000LuR-H9@gemulon.postgresql.org>
Permalink:  ../E1oDy2i-000LuR-H9@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1oDy2i-000LuR-H9@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: Prevent BASE_BACKUP in the middle of another backup in the same
  In-Reply-To: <E1oDy2i-000LuR-H9@gemulon.postgresql.org>
  References: <E1oDy2i-000LuR-H9@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