pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Tweak pg_promote() to report failures on kill() or postmaster fa
Date: Mon, 28 Aug 2023 23:45:24 +0000
Message-ID: <E1qalvA-001QcE-52@gemulon.postgresql.org> (raw)

Tweak pg_promote() to report failures on kill() or postmaster failures

Since its introduction in 10074651e335, pg_promote() has been returning
a false status in three cases:
- SIGUSR1 not sent to the postmaster process.
- Postmaster death during standby promotion.
- Standby not promoted within the specified wait time.

An application calling this function will have a hard time understanding
what a false state returned actually means.

Per discussion, this switches the two first states to fail rather than
return a "false" status, making the second case more consistent with the
existing CHECK_FOR_INTERRUPTS in the wait loop.  False is only returned
when the promotion is not completed within the specified time (60s by
default).

Author: Ashutosh Sharma
Reviewed-by: Fujii Masao, Laurenz Albe, Michael Paquier
Discussion: https://postgr.es/m/CAE9k0P=QTrwptL0t4J0fuBRDDjgsT-0PVKd-ikd96i1hyL7Bcg@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/f593c5517d14a949ae659eec470eb6bc0d2fdd5d

Modified Files
--------------
src/backend/access/transam/xlogfuncs.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)



Message-ID: <E1qalvA-001QcE-52@gemulon.postgresql.org>
Permalink:  ../E1qalvA-001QcE-52@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1qalvA-001QcE-52@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 using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: michael@paquier.xyz, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Tweak pg_promote() to report failures on kill() or postmaster fa
  In-Reply-To: <E1qalvA-001QcE-52@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