aboutsummaryrefslogtreecommitdiff
path: root/src/backend/postmaster/walwriter.c
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2019-12-17 13:03:57 -0500
committerRobert Haas <rhaas@postgresql.org>2019-12-17 13:03:57 -0500
commit1e53fe0e70f610c34f4c9e770d108cd94151342c (patch)
tree371a110c218d1b236a1f27561c329f11d31195c2 /src/backend/postmaster/walwriter.c
parent5910d6c7e311f0b14e3d3cb9ce3597c01d3a3cde (diff)
downloadpostgresql-1e53fe0e70f610c34f4c9e770d108cd94151342c.tar.gz
postgresql-1e53fe0e70f610c34f4c9e770d108cd94151342c.zip
Use PostgresSigHupHandler in more places.
There seems to be no reason for every background process to have its own flag indicating that a config-file reload is needed. Instead, let's just use ConfigFilePending for that purpose everywhere. Patch by me, reviewed by Andres Freund and Daniel Gustafsson. Discussion: http://postgr.es/m/CA+TgmoZwDk=BguVDVa+qdA6SBKef=PKbaKDQALTC_9qoz1mJqg@mail.gmail.com
Diffstat (limited to 'src/backend/postmaster/walwriter.c')
-rw-r--r--src/backend/postmaster/walwriter.c20
1 files changed, 3 insertions, 17 deletions
diff --git a/src/backend/postmaster/walwriter.c b/src/backend/postmaster/walwriter.c
index 5a3573503c6..599478530f9 100644
--- a/src/backend/postmaster/walwriter.c
+++ b/src/backend/postmaster/walwriter.c
@@ -80,14 +80,12 @@ int WalWriterFlushAfter = 128;
/*
* Flags set by interrupt handlers for later service in the main loop.
*/
-static volatile sig_atomic_t got_SIGHUP = false;
static volatile sig_atomic_t shutdown_requested = false;
static void HandleWalWriterInterrupts(void);
/* Signal handlers */
static void wal_quickdie(SIGNAL_ARGS);
-static void WalSigHupHandler(SIGNAL_ARGS);
static void WalShutdownHandler(SIGNAL_ARGS);
/*
@@ -110,7 +108,7 @@ WalWriterMain(void)
* We have no particular use for SIGINT at the moment, but seems
* reasonable to treat like SIGTERM.
*/
- pqsignal(SIGHUP, WalSigHupHandler); /* set flag to read config file */
+ pqsignal(SIGHUP, PostgresSigHupHandler); /* set flag to read config file */
pqsignal(SIGINT, WalShutdownHandler); /* request shutdown */
pqsignal(SIGTERM, WalShutdownHandler); /* request shutdown */
pqsignal(SIGQUIT, wal_quickdie); /* hard crash time */
@@ -278,9 +276,9 @@ WalWriterMain(void)
static void
HandleWalWriterInterrupts(void)
{
- if (got_SIGHUP)
+ if (ConfigReloadPending)
{
- got_SIGHUP = false;
+ ConfigReloadPending = false;
ProcessConfigFile(PGC_SIGHUP);
}
if (shutdown_requested)
@@ -322,18 +320,6 @@ wal_quickdie(SIGNAL_ARGS)
_exit(2);
}
-/* SIGHUP: set flag to re-read config file at next convenient time */
-static void
-WalSigHupHandler(SIGNAL_ARGS)
-{
- int save_errno = errno;
-
- got_SIGHUP = true;
- SetLatch(MyLatch);
-
- errno = save_errno;
-}
-
/* SIGTERM: set flag to exit normally */
static void
WalShutdownHandler(SIGNAL_ARGS)