]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Remove files signaling a standby promotion request at postmaster startup
authorFujii Masao <fujii@postgresql.org>
Wed, 9 Sep 2015 13:51:44 +0000 (22:51 +0900)
committerFujii Masao <fujii@postgresql.org>
Wed, 9 Sep 2015 13:52:40 +0000 (22:52 +0900)
commit47387732ba28e940e27f3f82c657d11bab628e1a
treefad77a700479663241e8be24d4d4e3785a0ec5a3
parentcb1b9b959cf068650999af55e160cdce88c4a5a4
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/backend/access/transam/xlog.c
src/backend/postmaster/postmaster.c
src/include/access/xlog.h