From 96f6a0cb41ee06673960019f0026b1b0fd1e644d Mon Sep 17 00:00:00 2001 From: Fujii Masao Date: Wed, 9 Sep 2015 22:51:44 +0900 Subject: 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 --- src/include/access/xlog.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/include/access/xlog.h') diff --git a/src/include/access/xlog.h b/src/include/access/xlog.h index 6dacee2fbbd..790ca66f8a6 100644 --- a/src/include/access/xlog.h +++ b/src/include/access/xlog.h @@ -261,6 +261,7 @@ extern XLogRecPtr GetRedoRecPtr(void); extern XLogRecPtr GetInsertRecPtr(void); extern XLogRecPtr GetFlushRecPtr(void); extern void GetNextXidAndEpoch(TransactionId *xid, uint32 *epoch); +extern void RemovePromoteSignalFiles(void); extern bool CheckPromoteSignal(void); extern void WakeupRecovery(void); -- cgit v1.2.3