pgsql: postmaster: Commonalize FatalError paths

Started by Andres Freundover 1 year ago1 messagescomitters
Jump to latest
#1Andres Freund
andres@anarazel.de

postmaster: Commonalize FatalError paths

This includes some behavioral changes:

- Previously PM_WAIT_XLOG_ARCHIVAL wasn't handled in HandleFatalError(), that
doesn't seem quite right.

- Previously a fatal error in PM_WAIT_XLOG_SHUTDOWN lead to jumping back to
PM_WAIT_BACKENDS, no we go to PM_WAIT_DEAD_END. Jumping backwards doesn't
seem quite right and we didn't do so when checkpointer failed to fork during
a shutdown.

- Previously a checkpointer fork failure didn't call SetQuitSignalReason(),
which would lead to quickdie() reporting
"terminating connection because of unexpected SIGQUIT signal"
which seems even worse than the PMQUIT_FOR_CRASH message. If I saw that in
the log I'd suspect somebody outside of postgres sent SIGQUITs

Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: /messages/by-id/kgng5nrvnlv335evmsuvpnh354rw7qyazl73kdysev2cr2v5zu@m3cfzxicm5kp

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/463a2ebd9fda4fa94833838d0a372f7fd53b5b8a

Modified Files
--------------
src/backend/postmaster/postmaster.c | 74 +++++++++++++++++++++++++++++--------
1 file changed, 58 insertions(+), 16 deletions(-)