diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2025-04-04 12:31:00 +0300 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2025-04-04 12:38:32 +0300 |
commit | 6e9c81836e101bc7f37ddc5e2f6ab58d62efcb24 (patch) | |
tree | b0c6e5c4cf53c29e34df1e8589aa5c829b74d737 /src/backend/tcop/postgres.c | |
parent | 8123e91f5aeb26c6e4cf583bb61c99281485af83 (diff) | |
download | postgresql-6e9c81836e101bc7f37ddc5e2f6ab58d62efcb24.tar.gz postgresql-6e9c81836e101bc7f37ddc5e2f6ab58d62efcb24.zip |
Use standard die() signal handler in walreceiver
This gets rid of the bespoken ProcessWalRcvInterrupts() function,
which lets walreceiver terminate at any CHECK_FOR_INTERRUPTS() call.
And it's less code anyway.
We can now use the standard libpqsrv_connect_params() libpq wrapper
from libpq-be-fe-helpers.h, removing more code. We attempted to do
that earlier already in commit 728f86fec6, but that was reverted
because it didn't call ProcessWalRcvInterrupts() and therefore didn't
react to shutdown requests. Now that ProcessWalRcvInterrupts() is
gone, it works. As stated in that commit, this also leads to
libpqwalreceiver reserving file descriptors for libpq conncetions,
which is nice.
Author: Andres Freund <andres@anarazel.de> (the earlier commit)
Author: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Yura Sokolov <y.sokolov@postgrespro.ru>
Diffstat (limited to 'src/backend/tcop/postgres.c')
-rw-r--r-- | src/backend/tcop/postgres.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index 89189848862..6ae9f38f0c8 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -3335,6 +3335,10 @@ ProcessInterrupts(void) */ proc_exit(1); } + else if (AmWalReceiverProcess()) + ereport(FATAL, + (errcode(ERRCODE_ADMIN_SHUTDOWN), + errmsg("terminating walreceiver process due to administrator command"))); else if (AmBackgroundWorkerProcess()) ereport(FATAL, (errcode(ERRCODE_ADMIN_SHUTDOWN), |