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: Prefer standby promotion over recovery pause.
Date: Tue, 24 Mar 2020 03:50:04 +0000
Message-ID: <E1jGaZo-00048u-8S@gemulon.postgresql.org> (raw)

Prefer standby promotion over recovery pause.

Previously if a promotion was triggered while recovery was paused,
the paused state continued. Also recovery could be paused by executing
pg_wal_replay_pause() even while a promotion was ongoing. That is,
recovery pause had higher priority over a standby promotion.
But this behavior was not desirable because most users basically wanted
the recovery to complete as soon as possible and the server to become
the master when they requested a promotion.

This commit changes recovery so that it prefers a promotion over
recovery pause. That is, if a promotion is triggered while recovery
is paused, the paused state ends and a promotion continues. Also
this commit makes recovery pause functions like pg_wal_replay_pause()
throw an error if they are executed while a promotion is ongoing.

Internally, this commit adds new internal function PromoteIsTriggered()
that returns true if a promotion is triggered. Since the name of
this function and the existing function IsPromoteTriggered() are
confusingly similar, the commit changes the name of IsPromoteTriggered()
to IsPromoteSignaled, as more appropriate name.

Author: Fujii Masao
Reviewed-by: Atsushi Torikoshi, Sergei Kornilov
Discussion: https://postgr.es/m/00c194b2-dbbb-2e8a-5b39-13f14048ef0a@oss.nttdata.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/496ee647ecd2917369ffcf1eaa0b2cdca07c8730

Modified Files
--------------
doc/src/sgml/config.sgml               |  3 ++
doc/src/sgml/func.sgml                 |  7 ++++
src/backend/access/transam/xlog.c      | 67 ++++++++++++++++++++++++++++++----
src/backend/access/transam/xlogfuncs.c | 14 +++++++
src/backend/postmaster/startup.c       | 12 +++---
src/include/access/xlog.h              |  1 +
src/include/postmaster/startup.h       |  4 +-
7 files changed, 93 insertions(+), 15 deletions(-)



Message-ID: <E1jGaZo-00048u-8S@gemulon.postgresql.org>
Permalink:  ../E1jGaZo-00048u-8S@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1jGaZo-00048u-8S@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: Prefer standby promotion over recovery pause.
  In-Reply-To: <E1jGaZo-00048u-8S@gemulon.postgresql.org>
  References: <E1jGaZo-00048u-8S@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