diff options
Diffstat (limited to 'src/backend/postmaster/postmaster.c')
-rw-r--r-- | src/backend/postmaster/postmaster.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c index 1818f7ce46a..baa43b203f1 100644 --- a/src/backend/postmaster/postmaster.c +++ b/src/backend/postmaster/postmaster.c @@ -1176,6 +1176,27 @@ PostmasterMain(int argc, char *argv[]) RemovePgTempFiles(); /* + * Forcibly remove the files signaling a standby promotion + * request. Otherwise, the existence of those files triggers + * 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. + * + * Note that promotion signal files need to be removed before + * the startup process is invoked. Because, after that, they can + * be used by postmaster's SIGUSR1 signal handler. + */ + RemovePromoteSignalFiles(); + + /* * If enabled, start up syslogger collection subprocess */ SysLoggerPID = SysLogger_Start(); |