pgsql: Remove files signaling a standby promotion request at postmaster

From: Fujii Masao <fujii(at)postgresql(dot)org>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Remove files signaling a standby promotion request at postmaster
Date: 2015-09-09 14:06:44
Message-ID: E1ZZg1M-0007r0-38@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-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(dot)4686(dot)91426(at)wrigleys(dot)postgresql(dot)org

Branch
------
REL9_5_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/65f37b3e9b0aea59cc98a2e23f45bb8fb6a56395

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(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Teodor Sigaev 2015-09-09 15:44:02 pgsql: Microvacuum for GIST
Previous Message Fujii Masao 2015-09-09 13:13:04 Re: Re: [COMMITTERS] pgsql: Map basebackup tablespaces using a tablespace_map file