PATCH: Make pg_stop_backup() archive wait optional

From: David Steele <david(at)pgmasters(dot)net>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: PATCH: Make pg_stop_backup() archive wait optional
Date: 2017-02-28 00:25:32
Message-ID: 758e3fd1-45b4-5e28-75cd-e9e7f93a4c02@pgmasters.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Currently pg_stop_backup() will wait for all WAL to be archived before
returning. If there is a problem with the archive command or a large
backlog it may not return for a very long time (if ever). Backup
software is faced with the choice of cancelling the query and hoping the
stop backup record was written or waiting indefinitely.

The purpose of this patch is to make waiting for archive optional, with
the default being the current behavior, i.e., to wait for all WAL to be
archived. This functionality is already used internally by
pg_basebackup, so the only real change is to expose it through the
pg_stop_backup() function.

I wasn't sure where, if anywhere, to put tests (the underlying
functionality is tested in the pg_basebackup TAP tests). test/recovery
and bin/pg_basebackup did not seem like appropriate places and the
pg_regress tests are not capable enough. It seems like a new
test/backup suite would be a good idea but I wanted to get some feedback
before proceeding in that direction.

I also marked the pg_stop_* functions as parallel restricted, the same
as pg_start_backup(). Previously they were parallel safe which I don't
believe is accurate for the non-exclusive version at the very least,
since it is tied to a particular backend.

The patch applies cleanly on 30df93f but will be broken (and easily
fixed) by any cat version bump in later commits.

--
-David
david(at)pgmasters(dot)net

Attachment Content-Type Size
pgstopbackup-wait-v1.patch text/plain 6.1 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Seki, Eiji 2017-02-28 00:25:41 Re: Proposal: GetOldestXminExtend for ignoring arbitrary vacuum flags
Previous Message David Steele 2017-02-28 00:21:10 Re: Creation of "Future" commit fest, named 2017-07