diff options
| author | Vadim B. Mikheev <vadim4o@yahoo.com> | 1999-10-06 21:58:18 +0000 |
|---|---|---|
| committer | Vadim B. Mikheev <vadim4o@yahoo.com> | 1999-10-06 21:58:18 +0000 |
| commit | 47937403676d913c0e740eec6b85113865c6c8ab (patch) | |
| tree | 901b2566b404316b964f13c6a9477bb0fde7c285 /src/backend/storage/lmgr | |
| parent | 9dcd8c528fe08d3a442db46ad2045ff2183fc6a3 (diff) | |
| download | postgresql-47937403676d913c0e740eec6b85113865c6c8ab.tar.gz | |
XLOG (also known as WAL -:)) Bootstrap/Startup/Shutdown.
First step in cleaning up backend initialization code.
Fix for FATAL: now FATAL is ERROR + exit.
Diffstat (limited to 'src/backend/storage/lmgr')
| -rw-r--r-- | src/backend/storage/lmgr/proc.c | 36 |
1 files changed, 11 insertions, 25 deletions
diff --git a/src/backend/storage/lmgr/proc.c b/src/backend/storage/lmgr/proc.c index 159edf0549..0270b0e116 100644 --- a/src/backend/storage/lmgr/proc.c +++ b/src/backend/storage/lmgr/proc.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.61 1999/09/24 00:24:41 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.62 1999/10/06 21:58:07 vadim Exp $ * *------------------------------------------------------------------------- */ @@ -46,7 +46,7 @@ * This is so that we can support more backends. (system-wide semaphore * sets run out pretty fast.) -ay 4/95 * - * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.61 1999/09/24 00:24:41 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.62 1999/10/06 21:58:07 vadim Exp $ */ #include <sys/time.h> #include <unistd.h> @@ -70,7 +70,7 @@ #include "storage/proc.h" #include "utils/trace.h" -static void HandleDeadLock(int sig); +void HandleDeadLock(SIGNAL_ARGS); static void ProcFreeAllSemaphores(void); #define DeadlockCheckTimer pg_options[OPT_DEADLOCKTIMEOUT] @@ -84,12 +84,6 @@ static void ProcFreeAllSemaphores(void); */ SPINLOCK ProcStructLock; -/* - * For cleanup routines. Don't cleanup if the initialization - * has not happened. - */ -static bool ProcInitialized = FALSE; - static PROC_HDR *ProcGlobal = NULL; PROC *MyProc = NULL; @@ -167,8 +161,9 @@ InitProcGlobal(IPCKey key, int maxBackends) PROC_NSEMS_PER_SET, IPCProtection, IpcSemaphoreDefaultStartValue, - 0, - &semstat); + 0); + if (semId < 0) + elog(FATAL, "InitProcGlobal: IpcSemaphoreCreate failed"); /* mark this sema set allocated */ ProcGlobal->freeSemMap[i] = (1 << PROC_NSEMS_PER_SET); } @@ -189,12 +184,6 @@ InitProcess(IPCKey key) unsigned long location, myOffset; - /* ------------------ - * Routine called if deadlock timer goes off. See ProcSleep() - * ------------------ - */ - pqsignal(SIGALRM, HandleDeadLock); - SpinAcquire(ProcStructLock); /* attach to the free list */ @@ -203,7 +192,7 @@ InitProcess(IPCKey key) if (!found) { /* this should not happen. InitProcGlobal() is called before this. */ - elog(ERROR, "InitProcess: Proc Header uninitialized"); + elog(STOP, "InitProcess: Proc Header uninitialized"); } if (MyProc != NULL) @@ -271,8 +260,7 @@ InitProcess(IPCKey key) PROC_NSEMS_PER_SET, IPCProtection, IpcSemaphoreDefaultStartValue, - 0, - &semstat); + 0); /* * we might be reusing a semaphore that belongs to a dead backend. @@ -316,14 +304,12 @@ InitProcess(IPCKey key) */ location = MAKE_OFFSET(MyProc); if ((!ShmemPIDLookup(MyProcPid, &location)) || (location != MAKE_OFFSET(MyProc))) - elog(FATAL, "InitProc: ShmemPID table broken"); + elog(STOP, "InitProc: ShmemPID table broken"); MyProc->errType = NO_ERROR; SHMQueueElemInit(&(MyProc->links)); on_shmem_exit(ProcKill, (caddr_t) MyProcPid); - - ProcInitialized = TRUE; } /* @@ -755,8 +741,8 @@ ProcAddLock(SHM_QUEUE *elem) * up my semaphore. * -------------------- */ -static void -HandleDeadLock(int sig) +void +HandleDeadLock(SIGNAL_ARGS) { LOCK *mywaitlock; |
