diff options
author | Michael Paquier <michael@paquier.xyz> | 2018-08-29 17:11:40 -0700 |
---|---|---|
committer | Michael Paquier <michael@paquier.xyz> | 2018-08-29 17:11:40 -0700 |
commit | 32f2792eb6163ce7265b22dad4a20ddd1b81c5eb (patch) | |
tree | b10d14b19e77ebb637a9eb0eb348e17bd987cd39 /src | |
parent | aac21f11df0dbe6ee32ac8151bd1ea2c7987f683 (diff) | |
download | postgresql-32f2792eb6163ce7265b22dad4a20ddd1b81c5eb.tar.gz postgresql-32f2792eb6163ce7265b22dad4a20ddd1b81c5eb.zip |
Stop bgworkers during fast shutdown with postmaster in startup phase
When a postmaster gets into its phase PM_STARTUP, it would start
background workers using BgWorkerStart_PostmasterStart mode immediately,
which would cause problems for a fast shutdown as the postmaster forgets
to send SIGTERM to already-started background workers. With smart and
immediate shutdowns, this correctly happened, and fast shutdown is the
only mode missing the shot.
Author: Alexander Kukushkin
Reviewed-by: Michael Paquier
Discussion: https://postgr.es/m/CAFh8B=mvnD8+DZUfzpi50DoaDfZRDfd7S=gwj5vU9GYn8UvHkA@mail.gmail.com
Backpatch-through: 9.5
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/postmaster/postmaster.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c index 235fd08884e..644b4c6b2c8 100644 --- a/src/backend/postmaster/postmaster.c +++ b/src/backend/postmaster/postmaster.c @@ -2664,7 +2664,7 @@ pmdie(SIGNAL_ARGS) signal_child(BgWriterPID, SIGTERM); if (WalReceiverPID != 0) signal_child(WalReceiverPID, SIGTERM); - if (pmState == PM_RECOVERY) + if (pmState == PM_STARTUP || pmState == PM_RECOVERY) { SignalSomeChildren(SIGTERM, BACKEND_TYPE_BGWORKER); /* |