mirror of
https://github.com/postgres/postgres.git
synced 2025-07-02 09:02:37 +03:00
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
This commit is contained in:
@ -111,9 +111,6 @@ static void store_flush_position(XLogRecPtr remote_lsn);
|
||||
|
||||
static void maybe_reread_subscription(void);
|
||||
|
||||
/* Flags set by signal handlers */
|
||||
static volatile sig_atomic_t got_SIGHUP = false;
|
||||
|
||||
/*
|
||||
* Should this worker apply changes for given relation.
|
||||
*
|
||||
@ -1270,9 +1267,9 @@ LogicalRepApplyLoop(XLogRecPtr last_received)
|
||||
CHECK_FOR_INTERRUPTS();
|
||||
}
|
||||
|
||||
if (got_SIGHUP)
|
||||
if (ConfigReloadPending)
|
||||
{
|
||||
got_SIGHUP = false;
|
||||
ConfigReloadPending = false;
|
||||
ProcessConfigFile(PGC_SIGHUP);
|
||||
}
|
||||
|
||||
@ -1563,20 +1560,6 @@ subscription_change_cb(Datum arg, int cacheid, uint32 hashvalue)
|
||||
MySubscriptionValid = false;
|
||||
}
|
||||
|
||||
/* SIGHUP: set flag to reload configuration at next convenient time */
|
||||
static void
|
||||
logicalrep_worker_sighup(SIGNAL_ARGS)
|
||||
{
|
||||
int save_errno = errno;
|
||||
|
||||
got_SIGHUP = true;
|
||||
|
||||
/* Waken anything waiting on the process latch */
|
||||
SetLatch(MyLatch);
|
||||
|
||||
errno = save_errno;
|
||||
}
|
||||
|
||||
/* Logical Replication Apply worker entry point */
|
||||
void
|
||||
ApplyWorkerMain(Datum main_arg)
|
||||
@ -1592,7 +1575,7 @@ ApplyWorkerMain(Datum main_arg)
|
||||
logicalrep_worker_attach(worker_slot);
|
||||
|
||||
/* Setup signal handling */
|
||||
pqsignal(SIGHUP, logicalrep_worker_sighup);
|
||||
pqsignal(SIGHUP, PostgresSigHupHandler);
|
||||
pqsignal(SIGTERM, die);
|
||||
BackgroundWorkerUnblockSignals();
|
||||
|
||||
|
Reference in New Issue
Block a user