1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-15 19:21:59 +03:00

Revert SIGUSR1 multiplexing patch, per Tom's objection.

This commit is contained in:
Heikki Linnakangas
2008-12-09 15:59:39 +00:00
parent 7b05b3fa39
commit dea81a6cf6
10 changed files with 45 additions and 143 deletions

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/storage/lmgr/proc.c,v 1.203 2008/12/09 14:28:20 heikki Exp $
* $PostgreSQL: pgsql/src/backend/storage/lmgr/proc.c,v 1.204 2008/12/09 15:59:39 heikki Exp $
*
*-------------------------------------------------------------------------
*/
@ -289,7 +289,6 @@ InitProcess(void)
MyProc->databaseId = InvalidOid;
MyProc->roleId = InvalidOid;
MyProc->inCommit = false;
MemSet(MyProc->signalFlags, 0, NUM_PROCSIGNALS * sizeof(sig_atomic_t));
MyProc->vacuumFlags = 0;
if (IsAutoVacuumWorkerProcess())
MyProc->vacuumFlags |= PROC_IS_AUTOVACUUM;
@ -429,7 +428,6 @@ InitAuxiliaryProcess(void)
MyProc->databaseId = InvalidOid;
MyProc->roleId = InvalidOid;
MyProc->inCommit = false;
MemSet(MyProc->signalFlags, 0, NUM_PROCSIGNALS * sizeof(sig_atomic_t));
/* we don't set the "is autovacuum" flag in the launcher */
MyProc->vacuumFlags = 0;
MyProc->lwWaiting = false;
@ -1279,54 +1277,6 @@ ProcSendSignal(int pid)
PGSemaphoreUnlock(&proc->sem);
}
/*
* SendProcSignal - send the signal with the reason to a process.
*
* The process can be a backend or an auxiliary process that has a PGPROC
* entry, like an autovacuum worker.
*/
void
SendProcSignal(PGPROC *proc, ProcSignalReason reason)
{
pid_t pid;
/*
* If the process is gone, do nothing.
*
* Since there's no locking, it's possible that the process detaches
* from shared memory and exits right after this test, before we set
* the flag and send signal. And the PGPROC entry might even be recycled
* by a new process, so it's remotely possible that we signal a wrong
* process. That's OK, all the signals are such that no harm is done.
*/
pid = proc->pid;
if (pid == 0)
return;
/* Atomically set the proper flag */
proc->signalFlags[reason] = true;
/* Send SIGUSR1 to the process */
kill(pid, SIGUSR1);
}
/*
* CheckProcSignal - check to see if the particular reason has been
* signaled, and clear the signal flag. Should be called after
* receiving SIGUSR1.
*/
bool
CheckProcSignal(ProcSignalReason reason)
{
/* Careful here --- don't clear flag if we haven't seen it set */
if (MyProc->signalFlags[reason])
{
MyProc->signalFlags[reason] = false;
return true;
}
return false;
}
/*****************************************************************************
* SIGALRM interrupt support