Re: pg_stop_backup(wait_for_archive := true) on standby server

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: Stephen Frost <sfrost(at)snowman(dot)net>, Magnus Hagander <magnus(at)hagander(dot)net>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Noah Misch <noah(at)leadboat(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_stop_backup(wait_for_archive := true) on standby server
Date: 2017-08-05 14:51:24
Message-ID: CA+TgmoaAD9dUoM6X681MzYfeNDdiY2zisQgkD7CBP8DTdNUkOA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Aug 5, 2017 at 9:11 AM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> If we apply these patches to 9.6, then pg_stop_backup() on a standby
> will start writing backup history files and removing no-longer-needed
> backup history files. That's a clear behavior change, and it isn't a
> bug fix. Making the waitforarchive option work is a bug fix, but I'm
> not convinced we should take it as a license to change other aspects
> of the behavior in a point release.

After refreshing my memory further, I take it back. pg_stop_backup()
doesn't even have a second argument on v9.6, so back-porting this fix
to 9.6 is a meaningless thing; there's nothing to fix. What the
patches propose to do there instead is adopt the behavior proposed for
v10 when pg_stop_backup()'s second argument is true as the
unconditional behavior in v9.6. For that to be the right thing to do,
we have to decide that the current v9.6 behavior is a bug. But I
(still) think that's very arguable, because the whole point is that
we've just finished adding a flag in v10 to disable on the master the
*very same behavior* we're proposing to mandate on the standby in
v9.6. How can we say that v9.6's current behavior is a bug when v10
produces the same behavior with wait_for_archive = false? That just
doesn't make any sense.

I've pushed a minimal fix for v10 which should address Sawada-san's
original complaint: now, if you say wait_for_archive = true on a
standby, you'll get a warning if it didn't wait, or if archive_mode =
always, it will wait. I think the right thing to do about 9.6 is
document the behavior; there's no problem here that a user can't work
around by doing it right.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2017-08-05 14:52:35 Re: foreign table creation and NOT VALID check constraints
Previous Message Tom Lane 2017-08-05 14:33:23 Re: pg_stop_backup(wait_for_archive := true) on standby server