postmaster: Commonalize FatalError paths
authorAndres Freund
Fri, 24 Jan 2025 22:08:31 +0000 (17:08 -0500)
committerAndres Freund
Fri, 24 Jan 2025 22:08:31 +0000 (17:08 -0500)
commit463a2ebd9fda4fa94833838d0a372f7fd53b5b8a
treed6829805a9442f7339e3caf38df0a5627ad6b4d8
parent8edd8c77c88e75822334ccb8376d2c151d6e5615
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
Discussion: https://postgr.es/m/kgng5nrvnlv335evmsuvpnh354rw7qyazl73kdysev2cr2v5zu@m3cfzxicm5kp
src/backend/postmaster/postmaster.c