I am trying to change the lock manager so read locks will not be granted
if there is a write-lock waiting for a lock.  The following patch helps,
but is incomplete.  Can someone figure out the right fix?  I tried
putting this code inside LockResolveConflicts(), but that didn't work
either.

---------------------------------------------------------------------------

*** ./backend/storage/lmgr/lock.c.orig	Fri Jan 23 01:18:01 1998
--- ./backend/storage/lmgr/lock.c	Fri Jan 23 01:18:53 1998
***************
*** 602,607 ****
--- 602,620 ----
  
  	status = LockResolveConflicts(ltable, lock, lockt, myXid);
  
+ 		/* ------------------------
+ 		 * If someone with a greater priority is waiting for the lock,
+ 		 * do not continue and share the lock, even if we can.  bjm
+ 		 * ------------------------
+ 		 */
+ 		int				myprio = ltable->ctl->prio[lockt];
+ 		PROC_QUEUE		*waitQueue = &(lock->waitProcs);
+ 		PROC			*topproc = (PROC *) MAKE_PTR(waitQueue->links.prev);
+ 
+ 		if (topproc && topproc->prio > myprio)
+ 			status = STATUS_FOUND;
+ 	}
+ 
  	if (status == STATUS_OK)
  	{
  		GrantLock(lock, lockt);

-- 
Bruce Momjian
maillist@candle.pha.pa.us

Fri, 23 Jan 1998 01:21:41 -0500 (EST)
Bruce Momjian <maillist@candle.pha.pa.us>
locking change help
Bruce Momjian wrote:
> 
> I am trying to change the lock manager so read locks will not be granted
> if there is a write-lock waiting for a lock.  The following patch helps,
> but is incomplete.  Can someone figure out the right fix?  I tried
> putting this code inside LockResolveConflicts(), but that didn't work
> either.

Is this to help writers from starving?

/* m */

Fri, 23 Jan 1998 11:25:36 +0100
Mattias Kregert <matti@algonet.se>
Re: [HACKERS] locking change help
> 
> Bruce Momjian wrote:
> > 
> > I am trying to change the lock manager so read locks will not be granted
> > if there is a write-lock waiting for a lock.  The following patch helps,
> > but is incomplete.  Can someone figure out the right fix?  I tried
> > putting this code inside LockResolveConflicts(), but that didn't work
> > either.
> 
> Is this to help writers from starving?

Yes.

-- 
Bruce Momjian
maillist@candle.pha.pa.us

Fri, 23 Jan 1998 09:59:47 -0500 (EST)
Bruce Momjian <maillist@candle.pha.pa.us>
Re: [HACKERS] locking change help