pgsql: Make pg_promote() detect postmaster death while waiting for prom

From: Fujii Masao <fujii(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Make pg_promote() detect postmaster death while waiting for prom
Date: 2019-09-06 05:29:06
Message-ID: E1i66ny-00010W-Nt@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Make pg_promote() detect postmaster death while waiting for promotion to end.

Previously even if postmaster died and WaitLatch() woke up with that event
while pg_promote() was waiting for the standby promotion to finish,
pg_promote() did nothing special and kept waiting until timeout occurred.
This could cause a busy loop.

This patch make pg_promote() return false immediately when postmaster
dies, to avoid such a busy loop.

Back-patch to v12 where pg_promote() was added.

Author: Fujii Masao
Reviewed-by: Michael Paquier
Discussion: https://postgr.es/m/CAHGQGwEs9ROgSp+QF+YdDU+xP8W=CY1k-_Ov-d_Z3JY+to3eXA@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/946647f845d0b0762656a8e07055f501c4b29688

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

Browse pgsql-committers by date

  From Date Subject
Next Message Fujii Masao 2019-09-06 05:30:07 pgsql: Make pg_promote() detect postmaster death while waiting for prom
Previous Message Michael Paquier 2019-09-06 05:01:26 pgsql: Make use of generic logging in vacuumlo and oid2name