From 1e53fe0e70f610c34f4c9e770d108cd94151342c Mon Sep 17 00:00:00 2001 From: Robert Haas Date: Tue, 17 Dec 2019 13:03:57 -0500 Subject: 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 --- src/backend/replication/logical/launcher.c | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) (limited to 'src/backend/replication/logical/launcher.c') 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); } } -- cgit v1.2.3