diff options
author | Robert Haas <rhaas@postgresql.org> | 2019-12-17 13:03:57 -0500 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2019-12-17 13:03:57 -0500 |
commit | 1e53fe0e70f610c34f4c9e770d108cd94151342c (patch) | |
tree | 371a110c218d1b236a1f27561c329f11d31195c2 /src/backend/replication/logical/launcher.c | |
parent | 5910d6c7e311f0b14e3d3cb9ce3597c01d3a3cde (diff) | |
download | postgresql-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/replication/logical/launcher.c')
-rw-r--r-- | src/backend/replication/logical/launcher.c | 23 |
1 files changed, 3 insertions, 20 deletions
diff --git a/src/backend/replication/logical/launcher.c b/src/backend/replication/logical/launcher.c index 4643af95fee..edca70c58c3 100644 --- a/src/backend/replication/logical/launcher.c +++ b/src/backend/replication/logical/launcher.c @@ -92,9 +92,6 @@ static void logicalrep_worker_onexit(int code, Datum arg); static void logicalrep_worker_detach(void); static void logicalrep_worker_cleanup(LogicalRepWorker *worker); -/* Flags set by signal handlers */ -static volatile sig_atomic_t got_SIGHUP = false; - static bool on_commit_launcher_wakeup = false; Datum pg_stat_get_subscription(PG_FUNCTION_ARGS); @@ -714,20 +711,6 @@ logicalrep_worker_onexit(int code, Datum arg) ApplyLauncherWakeup(); } -/* SIGHUP: set flag to reload configuration at next convenient time */ -static void -logicalrep_launcher_sighup(SIGNAL_ARGS) -{ - int save_errno = errno; - - got_SIGHUP = true; - - /* Waken anything waiting on the process latch */ - SetLatch(MyLatch); - - errno = save_errno; -} - /* * Count the number of registered (not necessarily running) sync workers * for a subscription. @@ -972,7 +955,7 @@ ApplyLauncherMain(Datum main_arg) LogicalRepCtx->launcher_pid = MyProcPid; /* Establish signal handlers. */ - pqsignal(SIGHUP, logicalrep_launcher_sighup); + pqsignal(SIGTERM, PostgresSigHupHandler); pqsignal(SIGTERM, die); BackgroundWorkerUnblockSignals(); @@ -1061,9 +1044,9 @@ ApplyLauncherMain(Datum main_arg) CHECK_FOR_INTERRUPTS(); } - if (got_SIGHUP) + if (ConfigReloadPending) { - got_SIGHUP = false; + ConfigReloadPending = false; ProcessConfigFile(PGC_SIGHUP); } } |