postgresql/src/backend/postmaster
Fujii Masao 496ee647ec Prefer standby promotion over recovery pause.
Previously if a promotion was triggered while recovery was paused,
the paused state continued. Also recovery could be paused by executing
pg_wal_replay_pause() even while a promotion was ongoing. That is,
recovery pause had higher priority over a standby promotion.
But this behavior was not desirable because most users basically wanted
the recovery to complete as soon as possible and the server to become
the master when they requested a promotion.

This commit changes recovery so that it prefers a promotion over
recovery pause. That is, if a promotion is triggered while recovery
is paused, the paused state ends and a promotion continues. Also
this commit makes recovery pause functions like pg_wal_replay_pause()
throw an error if they are executed while a promotion is ongoing.

Internally, this commit adds new internal function PromoteIsTriggered()
that returns true if a promotion is triggered. Since the name of
this function and the existing function IsPromoteTriggered() are
confusingly similar, the commit changes the name of IsPromoteTriggered()
to IsPromoteSignaled, as more appropriate name.

Author: Fujii Masao
Reviewed-by: Atsushi Torikoshi, Sergei Kornilov
Discussion: https://postgr.es/m/00c194b2-dbbb-2e8a-5b39-13f14048ef0a@oss.nttdata.com
2020-03-24 12:46:48 +09:00
..
autovacuum.c Unify several ways to tracking backend type 2020-03-13 14:01:10 +01:00
bgworker.c Unify several ways to tracking backend type 2020-03-13 14:01:10 +01:00
bgwriter.c Update copyrights for 2020 2020-01-01 12:21:45 -05:00
checkpointer.c Update copyrights for 2020 2020-01-01 12:21:45 -05:00
fork_process.c Update copyrights for 2020 2020-01-01 12:21:45 -05:00
interrupt.c Update copyrights for 2020 2020-01-01 12:21:45 -05:00
Makefile Partially deduplicate interrupt handling for background processes. 2019-12-17 13:14:28 -05:00
pgarch.c Unify several ways to tracking backend type 2020-03-13 14:01:10 +01:00
pgstat.c Add wait events for WAL archive and recovery pause. 2020-03-24 11:12:21 +09:00
postmaster.c Unify several ways to tracking backend type 2020-03-13 14:01:10 +01:00
startup.c Prefer standby promotion over recovery pause. 2020-03-24 12:46:48 +09:00
syslogger.c Remove am_syslogger global variable 2020-03-13 14:01:15 +01:00
walwriter.c Update copyrights for 2020 2020-01-01 12:21:45 -05:00