1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-12 05:01:15 +03:00

Deadlock ceallnup.

(void) change for aix and hp compilers.

protocol cleanup.
This commit is contained in:
Bruce Momjian
1998-01-27 15:35:30 +00:00
parent f49d41353d
commit b4564a98fa
8 changed files with 62 additions and 22 deletions

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.8 1998/01/20 22:11:55 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.9 1998/01/27 15:34:39 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -728,7 +728,7 @@ func_get_detail(char *funcname,
funcname);
elog(NOTICE, "that satisfies the given argument types. you will have to");
elog(NOTICE, "retype your query using explicit typecasts.");
func_error("func_get_detail", funcname, nargs, oid_array);
func_error("", funcname, nargs, oid_array);
}
else
{
@@ -758,7 +758,7 @@ func_get_detail(char *funcname,
elog(ERROR, "no such attribute or function \"%s\"",
funcname);
}
func_error("func_get_detail", funcname, nargs, oid_array);
func_error("", funcname, nargs, oid_array);
}
else
{

View File

@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.71 1998/01/27 03:11:46 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.72 1998/01/27 15:34:43 momjian Exp $
*
* NOTES
*
@@ -473,7 +473,7 @@ pmdaemonize(void)
int i;
if (fork())
exit(0);
_exit(0);
/* GH: If there's no setsid(), we hopefully don't need silent mode.
* Until there's a better solution.
*/

View File

@@ -7,12 +7,12 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lock.c,v 1.22 1998/01/27 03:00:28 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lock.c,v 1.23 1998/01/27 15:34:49 momjian Exp $
*
* NOTES
* Outside modules can create a lock table and acquire/release
* locks. A lock table is a shared memory hash table. When
* a process tries to acquire a lock of a type that conflicts
* a process tries to acquire a lock of a type that conflictRs
* with existing locks, it is put to sleep using the routines
* in storage/lmgr/proc.c.
*
@@ -39,6 +39,7 @@
#include "postgres.h"
#include "miscadmin.h"
#include "storage/shmem.h"
#include "storage/sinvaladt.h"
#include "storage/spin.h"
#include "storage/proc.h"
#include "storage/lock.h"
@@ -1415,7 +1416,8 @@ LockingDisabled()
*
* This code takes a list of locks a process holds, and the lock that
* the process is sleeping on, and tries to find if any of the processes
* waiting on its locks hold the lock it is waiting for.
* waiting on its locks hold the lock it is waiting for. If no deadlock
* is found, it goes on to look at all the processes waiting on their locks.
*
* We have already locked the master lock before being called.
*/
@@ -1427,7 +1429,16 @@ DeadLockCheck(SHM_QUEUE *lockQueue, LOCK *findlock, bool skip_check)
XIDLookupEnt *tmp = NULL;
SHMEM_OFFSET end = MAKE_OFFSET(lockQueue);
LOCK *lock;
static PROC* checked_procs[MaxBackendId];
static int nprocs;
if (skip_check)
{
/* initialize at start of recursion */
checked_procs[0] = MyProc;
nprocs = 1;
}
if (SHMQueueEmpty(lockQueue))
return false;
@@ -1457,18 +1468,29 @@ DeadLockCheck(SHM_QUEUE *lockQueue, LOCK *findlock, bool skip_check)
*/
if (lock == findlock && !skip_check)
return true;
else if (lock != findlock || !skip_check)
/*
* No sense in looking at the wait queue of the lock we are
* looking for as it is MyProc's lock entry.
* If lock == findlock, and I got here, skip_check must be true.
*/
if (lock != findlock)
{
PROC_QUEUE *waitQueue = &(lock->waitProcs);
PROC *proc;
int i;
int j;
proc = (PROC *) MAKE_PTR(waitQueue->links.prev);
for (i = 0; i < waitQueue->size; i++)
{
/* prevent endless loops */
if (proc != MyProc && skip_check)
for (j = 0; j < nprocs; j++)
if (checked_procs[j] == proc)
break;
if (j >= nprocs)
{
checked_procs[nprocs++] = proc;
Assert(nprocs <= MaxBackendId);
/* If we found a deadlock, we can stop right now */
if (DeadLockCheck(&(proc->lockQueue), findlock, false))
return true;