pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Fujii Masao <fujii@postgresql.org>
To: pgsql-committers@postgresql.org
Subject: pgsql: Remove files signaling a standby promotion request at postmaster
Date: Wed, 09 Sep 2015 14:06:44 +0000
Message-ID: <E1ZZg1M-0007qw-2X@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

Remove files signaling a standby promotion request at postmaster startup

This commit makes postmaster forcibly remove the files signaling
a standby promotion request. Otherwise, the existence of those files
can trigger a promotion too early, whether a user wants that or not.

This removal of files is usually unnecessary because they can exist
only during a few moments during a standby promotion. However
there is a race condition: if pg_ctl promote is executed and creates
the files during a promotion, the files can stay around even after
the server is brought up to new master. Then, if new standby starts
by using the backup taken from that master, the files can exist
at the server startup and should be removed in order to avoid
an unexpected promotion.

Back-patch to 9.1 where promote signal file was introduced.

Problem reported by Feike Steenbergen.
Original patch by Michael Paquier, modified by me.

Discussion: 20150528100705.4686.91426@wrigleys.postgresql.org

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/96f6a0cb41ee06673960019f0026b1b0fd1e644d

Modified Files
--------------
src/backend/access/transam/xlog.c   |   10 ++++++++++
src/backend/postmaster/postmaster.c |   21 +++++++++++++++++++++
src/include/access/xlog.h           |    1 +
3 files changed, 32 insertions(+)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


view thread (6+ messages)  latest in thread

Message-ID: <E1ZZg1M-0007qw-2X@gemulon.postgresql.org>
Permalink:  ../E1ZZg1M-0007qw-2X@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1ZZg1M-0007qw-2X@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: Remove files signaling a standby promotion request at postmaster
  In-Reply-To: <E1ZZg1M-0007qw-2X@gemulon.postgresql.org>
  References: <E1ZZg1M-0007qw-2X@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